📄 pci.h
字号:
/*
*
* PCI Local Bus: constants, structures, and OSL procedure calls
*/
#ifndef _OSL_PCI_H
#define _OSL_PCI_H
#ifdef VXWORKS
#include <vxWorks.h>
#ifdef IXDP425
#include <ixp425Pci.h>
#else
#include <drv/pci/pciConfigLib.h>
#if (CPU_FAMILY != PPC)
#include <drv/pci/pciIntLib.h>
#endif
#endif
#endif /* VXWORKS */
/*#include "wis_types.h"*/
#ifdef IXDP425
#define PCI_CFG_VENDOR_ID 0x00
#define PCI_CFG_DEVICE_ID 0x02
#define PCI_CFG_COMMAND 0x04
#define PCI_CFG_STATUS 0x06
#define PCI_CFG_REVISION 0x08
#define PCI_CFG_PROGRAMMING_IF 0x09
#define PCI_CFG_SUBCLASS 0x0a
#define PCI_CFG_CLASS 0x0b
#define PCI_CFG_CACHE_LINE_SIZE 0x0c
#define PCI_CFG_LATENCY_TIMER 0x0d
#define PCI_CFG_HEADER_TYPE 0x0e
#define PCI_CFG_BIST 0x0f
#define PCI_CFG_BASE_ADDRESS_0 0x10
#define PCI_CFG_BASE_ADDRESS_1 0x14
#define PCI_CFG_BASE_ADDRESS_2 0x18
#define PCI_CFG_BASE_ADDRESS_3 0x1c
#define PCI_CFG_BASE_ADDRESS_4 0x20
#define PCI_CFG_BASE_ADDRESS_5 0x24
#define PCI_CFG_CIS 0x28
#define PCI_CFG_SUB_VENDER_ID 0x2c
#define PCI_CFG_SUB_SYSTEM_ID 0x2e
#define PCI_CFG_EXPANSION_ROM 0x30
#define PCI_CFG_CAP_PTR 0x34
#define PCI_CFG_DEV_INT_LINE 0x3c
#define PCI_CFG_DEV_INT_PIN 0x3d
#define PCI_CFG_MIN_GRANT 0x3e
#define PCI_CFG_MAX_LATENCY 0x3f
#define PCI_CFG_SPECIAL_USE 0x41
#define PCI_CFG_MODE 0x43
#ifndef PCI_CACHE_LINE_SIZE
# if defined(_CACHE_ALIGN_SIZE)
# define PCI_CACHE_LINE_SIZE (_CACHE_ALIGN_SIZE/4)
# else
# define PCI_CACHE_LINE_SIZE (32/4)
# endif
#endif /* PCI_CACHE_LINE_SIZE */
/* Latency Timer value - 255 PCI clocks */
#ifndef PCI_LATENCY_TIMER
#define PCI_LATENCY_TIMER 0xff
#endif /* PCI_LATENCY_TIMER */
#endif /* !IXDP425 */
/*
* PCI Configuration Header offsets
*/
#define PCI_VENDOR_ID 0x00 /* 16 bits */
#define PCI_DEVICE_ID 0x02 /* 16 bits */
#define PCI_CONF_VENID 0x0 /* vendor id, 2 bytes */
#define PCI_CONF_DEVID 0x2 /* device id, 2 bytes */
#define PCI_CONF_COMM 0x4 /* command register, 2 bytes */
#define PCI_CONF_STAT 0x6 /* status register, 2 bytes */
#define PCI_CONF_REVID 0x8 /* revision id, 1 byte */
#define PCI_CONF_PROGCLASS 0x9 /* programming class code, 1 byte */
#define PCI_CONF_SUBCLASS 0xA /* sub-class code, 1 byte */
#define PCI_CONF_BASCLASS 0xB /* basic class code, 1 byte */
#define PCI_CONF_CACHE_LINESZ 0xC /* cache line size, 1 byte */
#define PCI_CONF_LATENCY_TIMER 0xD /* latency timer, 1 byte */
#define PCI_CONF_HEADER 0xE /* header type, 1 byte */
#define PCI_CONF_BIST 0xF /* builtin self test, 1 byte */
#define PCI_CONF_BASE0 0x10 /* base register 0, 4 bytes */
#define PCI_CONF_BASE1 0x14 /* base register 1, 4 bytes */
#define PCI_CONF_BASE2 0x18 /* base register 2, 4 bytes */
#define PCI_CONF_BASE3 0x1c /* base register 3, 4 bytes */
#define PCI_CONF_BASE4 0x20 /* base register 4, 4 bytes */
#define PCI_CONF_BASE5 0x24 /* base register 5, 4 bytes */
#define PCI_CONF_CIS 0x28 /* Cardbus CIS Pointer */
#define PCI_CONF_SUBVENID 0x2c /* Subsystem Vendor ID */
#define PCI_CONF_SUBSYSID 0x2e /* Subsystem ID */
#define PCI_CONF_ROM 0x30 /* ROM base register, 4 bytes */
#define PCI_CONF_ILINE 0x3c /* interrupt line, 1 byte */
#define PCI_CONF_IPIN 0x3d /* interrupt pin, 1 byte */
#define PCI_CONF_MIN_G 0x3e /* minimum grant, 1 byte */
#define PCI_CONF_MAX_L 0x3f /* maximum grant, 1 byte */
#define PCI_MBASE_MASK ~0xf /* mask for memory base address */
/*
* PCI to PCI bridge configuration space header format
*/
#define PCI_BCNF_PRIBUS 0x18 /* primary bus number */
#define PCI_BCNF_SECBUS 0x19 /* secondary bus number */
#define PCI_BCNF_SUBBUS 0x1a /* subordinate bus number */
/*
* PCI command register bits
*/
#define PCI_COMMAND 0x04 /* 16 bits */
#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */
#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */
#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */
#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */
#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */
#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */
#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */
#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */
#define PCI_COMMAND_SERR 0x100 /* Enable SERR */
#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */
#define PCI_COMM_IO 0x0001 /* I/O access enable */
#define PCI_COMM_MAE 0x0002 /* memory access enable */
#define PCI_COMM_ME 0x0004 /* master enable */
#define PCI_COMM_SPEC_CYC 0x0008
#define PCI_COMM_MEMWR_INVAL 0x0010
#define PCI_COMM_PALETTE_SNOOP 0x0020
#define PCI_COMM_PARITY_DETECT 0x0040
#define PCI_COMM_WAIT_CYC_ENAB 0x0080
#define PCI_COMM_SERR_ENABLE 0x0100
#define PCI_COMM_BACK2BACK_ENAB 0x0200
/*
* PCI Interrupt pin value
*/
#define PCI_INTA 1
#define PCI_INTB 2
#define PCI_INTC 3
#define PCI_INTD 4
/*
* PCI status register bits
*/
#define PCI_STAT_66MHZ 0x0020 /* 66 MHz capable */
#define PCI_STAT_UDF 0x0040 /* UDF supported */
#define PCI_STAT_FBBC 0x0080 /* Fast Back-to-Back Capable */
#define PCI_STAT_S_PERROR 0x0100 /* Data Parity Reported */
#define PCI_STAT_DEVSELT 0x0600 /* Device select timing */
#define PCI_STAT_S_TARG_AB 0x0800 /* Signaled Target Abort */
#define PCI_STAT_R_TARG_AB 0x1000 /* Received Target Abort */
#define PCI_STAT_R_MAST_AB 0x2000 /* Received Master Abort */
#define PCI_STAT_S_SYSERR 0x4000 /* Signaled System Error */
#define PCI_STAT_PERROR 0x8000 /* Detected Parity Error */
/*
* PCI class codes
*/
#define PCI_CLASS_NONE 0x0 /* class code for pre-2.0 devices */
#define PCI_CLASS_MASS 0x1 /* Mass storage Controller class */
#define PCI_CLASS_NET 0x2 /* Network Controller class */
#define PCI_CLASS_DISPLAY 0x3 /* Display Controller class */
#define PCI_CLASS_MM 0x4 /* Multimedia Controller class */
#define PCI_CLASS_MEM 0x5 /* Memory Controller class */
#define PCI_CLASS_BRIDGE 0x6 /* Bridge Controller class */
#define PCI_CLASS_COMM 0x7 /* Communications Controller class */
#define PCI_CLASS_PERIPH 0x8 /* Peripheral Controller class */
#define PCI_CLASS_INPUT 0x9 /* Input Device class */
#define PCI_CLASS_DOCK 0xa /* Docking Station class */
#ifndef VXWORKS /* <<Collides with pciConfigLib.h>> */
#define PCI_CLASS_PROCESSOR 0xb /* Processor class */
#endif
#define PCI_CLASS_SERIALBUS 0xc /* Serial Bus class */
/*
* PCI Sub-class codes - base class 0x0 (no new devices should use this code).
*/
#define PCI_NONE_NOTVGA 0x0 /* All devices except VGA compatible */
#define PCI_NONE_VGA 0x1 /* VGA compatible */
/*
* PCI Sub-class codes - base class 0x1
*/
#define PCI_MASS_SCSI 0x0 /* SCSI bus Controller */
#define PCI_MASS_IDE 0x1 /* IDE Controller */
#define PCI_MASS_FD 0x2 /* floppy disk Controller */
#define PCI_MASS_IPI 0x3 /* IPI bus Controller */
#define PCI_MASS_RAID 0x4 /* RAID Controller */
#define PCI_MASS_OTHER 0x80 /* Other Mass Storage Controller */
/*
* programming interface for IDE
*/
#define PCI_IDE_IF_NATIVE_PRI 0x01 /* primary channel is native */
#define PCI_IDE_IF_PROG_PRI 0x02 /* primary can operate in either mode */
#define PCI_IDE_IF_NATIVE_SEC 0x04 /* secondary channel is native */
#define PCI_IDE_IF_PROG_SEC 0x08 /* sec. can operate in either mode */
#define PCI_IDE_IF_MASK 0x0f /* programming interface mask */
/*
* PCI Sub-class codes - base class 0x2
*/
#define PCI_NET_ENET 0x0 /* Ethernet Controller */
#define PCI_NET_TOKEN 0x1 /* Token Ring Controller */
#define PCI_NET_FDDI 0x2 /* FDDI Controller */
#define PCI_NET_ATM 0x3 /* ATM Controller */
#define PCI_NET_OTHER 0x80 /* Other Network Controller */
/*
* PCI Sub-class codes - base class 0x3
*/
#define PCI_DISPLAY_VGA 0x0 /* VGA device */
#define PCI_DISPLAY_XGA 0x1 /* XGA device */
#define PCI_DISPLAY_OTHER 0x80 /* Other Display Device */
/*
* programming interface for display
*/
#define PCI_DISPLAY_IF_VGA 0x0b /* VGA compatible */
#define PCI_DISPLAY_IF_8514 0x1b /* 8514 compatible */
/*
* PCI Sub-class codes - base class 0x4
*/
#define PCI_MM_VIDEO 0x0 /* Video device */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -