pci.h File Reference

#include <stdint.h>
#include <gpxe/device.h>
#include <gpxe/tables.h>
#include <gpxe/pci_io.h>
#include "pci_ids.h"

Go to the source code of this file.

Data Structures

struct  pci_device_id
 A PCI device ID list entry. More...
struct  pci_device
 A PCI device. More...
struct  pci_driver
 A PCI driver. More...

Defines

#define PCI_COMMAND_IO   0x1
#define PCI_COMMAND_MEM   0x2
#define PCI_COMMAND_MASTER   0x4
#define PCI_CACHE_LINE_SIZE   0x0c
#define PCI_LATENCY_TIMER   0x0d
#define PCI_COMMAND_SPECIAL   0x8
#define PCI_COMMAND_INVALIDATE   0x10
#define PCI_COMMAND_VGA_PALETTE   0x20
#define PCI_COMMAND_PARITY   0x40
#define PCI_COMMAND_WAIT   0x80
#define PCI_COMMAND_SERR   0x100
#define PCI_COMMAND_FAST_BACK   0x200
#define PCI_COMMAND_INTX_DISABLE   0x400
#define PCI_VENDOR_ID   0x00
#define PCI_DEVICE_ID   0x02
#define PCI_COMMAND   0x04
#define PCI_STATUS   0x06
#define PCI_STATUS_CAP_LIST   0x10
#define PCI_STATUS_66MHZ   0x20
#define PCI_STATUS_UDF   0x40
#define PCI_STATUS_FAST_BACK   0x80
#define PCI_STATUS_PARITY   0x100
#define PCI_STATUS_DEVSEL_MASK   0x600
#define PCI_STATUS_DEVSEL_FAST   0x000
#define PCI_STATUS_DEVSEL_MEDIUM   0x200
#define PCI_STATUS_DEVSEL_SLOW   0x400
#define PCI_STATUS_SIG_TARGET_ABORT   0x800
#define PCI_STATUS_REC_TARGET_ABORT   0x1000
#define PCI_STATUS_REC_MASTER_ABORT   0x2000
#define PCI_STATUS_SIG_SYSTEM_ERROR   0x4000
#define PCI_STATUS_DETECTED_PARITY   0x8000
#define PCI_REVISION   0x08
#define PCI_REVISION_ID   0x08
#define PCI_CLASS_REVISION   0x08
#define PCI_CLASS_CODE   0x0b
#define PCI_SUBCLASS_CODE   0x0a
#define PCI_HEADER_TYPE   0x0e
#define PCI_HEADER_TYPE_NORMAL   0
#define PCI_HEADER_TYPE_BRIDGE   1
#define PCI_HEADER_TYPE_CARDBUS   2
#define PCI_CARDBUS_CIS   0x28
#define PCI_SUBSYSTEM_VENDOR_ID   0x2c
#define PCI_SUBSYSTEM_ID   0x2e
#define PCI_BASE_ADDRESS_0   0x10
#define PCI_BASE_ADDRESS_1   0x14
#define PCI_BASE_ADDRESS_2   0x18
#define PCI_BASE_ADDRESS_3   0x1c
#define PCI_BASE_ADDRESS_4   0x20
#define PCI_BASE_ADDRESS_5   0x24
#define PCI_BASE_ADDRESS_SPACE   0x01
#define PCI_BASE_ADDRESS_SPACE_IO   0x01
#define PCI_BASE_ADDRESS_SPACE_MEMORY   0x00
#define PCI_BASE_ADDRESS_MEM_TYPE_MASK   0x06
#define PCI_BASE_ADDRESS_MEM_TYPE_32   0x00
#define PCI_BASE_ADDRESS_MEM_TYPE_1M   0x02
#define PCI_BASE_ADDRESS_MEM_TYPE_64   0x04
#define PCI_BASE_ADDRESS_MEM_MASK   (~0x0f)
#define PCI_BASE_ADDRESS_IO_MASK   (~0x03)
#define PCI_ROM_ADDRESS   0x30
#define PCI_ROM_ADDRESS_ENABLE   0x01
#define PCI_CAPABILITY_LIST   0x34
#define PCI_INTERRUPT_LINE   0x3c
#define PCI_INTERRUPT_PIN   0x3d
#define PCI_PRIMARY_BUS   0x18
#define PCI_SECONDARY_BUS   0x19
#define PCI_SUBORDINATE_BUS   0x1a
#define PCI_SEC_LATENCY_TIMER   0x1b
#define PCI_IO_BASE   0x1c
#define PCI_IO_LIMIT   0x1d
#define PCI_IO_RANGE_TYPE_MASK   0x0f
#define PCI_IO_RANGE_TYPE_16   0x00
#define PCI_IO_RANGE_TYPE_32   0x01
#define PCI_IO_RANGE_MASK   ~0x0f
#define PCI_SEC_STATUS   0x1e
#define PCI_MEMORY_BASE   0x20
#define PCI_MEMORY_LIMIT   0x22
#define PCI_MEMORY_RANGE_TYPE_MASK   0x0f
#define PCI_MEMORY_RANGE_MASK   ~0x0f
#define PCI_PREF_MEMORY_BASE   0x24
#define PCI_PREF_MEMORY_LIMIT   0x26
#define PCI_PREF_RANGE_TYPE_MASK   0x0f
#define PCI_PREF_RANGE_TYPE_32   0x00
#define PCI_PREF_RANGE_TYPE_64   0x01
#define PCI_PREF_RANGE_MASK   ~0x0f
#define PCI_PREF_BASE_UPPER32   0x28
#define PCI_PREF_LIMIT_UPPER32   0x2c
#define PCI_IO_BASE_UPPER16   0x30
#define PCI_IO_LIMIT_UPPER16   0x32
#define PCI_ROM_ADDRESS1   0x38
#define PCI_BRIDGE_CONTROL   0x3e
#define PCI_BRIDGE_CTL_PARITY   0x01
#define PCI_BRIDGE_CTL_SERR   0x02
#define PCI_BRIDGE_CTL_NO_ISA   0x04
#define PCI_BRIDGE_CTL_VGA   0x08
#define PCI_BRIDGE_CTL_MASTER_ABORT   0x20
#define PCI_BRIDGE_CTL_BUS_RESET   0x40
#define PCI_BRIDGE_CTL_FAST_BACK   0x80
#define PCI_CB_CAPABILITY_LIST   0x14
#define PCI_CAP_LIST_ID   0
#define PCI_CAP_ID_PM   0x01
#define PCI_CAP_ID_AGP   0x02
#define PCI_CAP_ID_VPD   0x03
#define PCI_CAP_ID_SLOTID   0x04
#define PCI_CAP_ID_MSI   0x05
#define PCI_CAP_ID_CHSWP   0x06
#define PCI_CAP_ID_EXP   0x10
#define PCI_CAP_LIST_NEXT   1
#define PCI_CAP_FLAGS   2
#define PCI_CAP_SIZEOF   4
#define PCI_PM_PMC   2
#define PCI_PM_CAP_VER_MASK   0x0007
#define PCI_PM_CAP_PME_CLOCK   0x0008
#define PCI_PM_CAP_RESERVED   0x0010
#define PCI_PM_CAP_DSI   0x0020
#define PCI_PM_CAP_AUX_POWER   0x01C0
#define PCI_PM_CAP_D1   0x0200
#define PCI_PM_CAP_D2   0x0400
#define PCI_PM_CAP_PME   0x0800
#define PCI_PM_CAP_PME_MASK   0xF800
#define PCI_PM_CAP_PME_D0   0x0800
#define PCI_PM_CAP_PME_D1   0x1000
#define PCI_PM_CAP_PME_D2   0x2000
#define PCI_PM_CAP_PME_D3   0x4000
#define PCI_PM_CAP_PME_D3cold   0x8000
#define PCI_PM_CTRL   4
#define PCI_PM_CTRL_STATE_MASK   0x0003
#define PCI_PM_CTRL_PME_ENABLE   0x0100
#define PCI_PM_CTRL_DATA_SEL_MASK   0x1e00
#define PCI_PM_CTRL_DATA_SCALE_MASK   0x6000
#define PCI_PM_CTRL_PME_STATUS   0x8000
#define PCI_PM_PPB_EXTENSIONS   6
#define PCI_PM_PPB_B2_B3   0x40
#define PCI_PM_BPCC_ENABLE   0x80
#define PCI_PM_DATA_REGISTER   7
#define PCI_PM_SIZEOF   8
#define PCI_AGP_VERSION   2
#define PCI_AGP_RFU   3
#define PCI_AGP_STATUS   4
#define PCI_AGP_STATUS_RQ_MASK   0xff000000
#define PCI_AGP_STATUS_SBA   0x0200
#define PCI_AGP_STATUS_64BIT   0x0020
#define PCI_AGP_STATUS_FW   0x0010
#define PCI_AGP_STATUS_RATE4   0x0004
#define PCI_AGP_STATUS_RATE2   0x0002
#define PCI_AGP_STATUS_RATE1   0x0001
#define PCI_AGP_COMMAND   8
#define PCI_AGP_COMMAND_RQ_MASK   0xff000000
#define PCI_AGP_COMMAND_SBA   0x0200
#define PCI_AGP_COMMAND_AGP   0x0100
#define PCI_AGP_COMMAND_64BIT   0x0020
#define PCI_AGP_COMMAND_FW   0x0010
#define PCI_AGP_COMMAND_RATE4   0x0004
#define PCI_AGP_COMMAND_RATE2   0x0002
#define PCI_AGP_COMMAND_RATE1   0x0001
#define PCI_AGP_SIZEOF   12
#define PCI_SID_ESR   2
#define PCI_SID_ESR_NSLOTS   0x1f
#define PCI_SID_ESR_FIC   0x20
#define PCI_SID_CHASSIS_NR   3
#define PCI_MSI_FLAGS   2
#define PCI_MSI_FLAGS_64BIT   0x80
#define PCI_MSI_FLAGS_QSIZE   0x70
#define PCI_MSI_FLAGS_QMASK   0x0e
#define PCI_MSI_FLAGS_ENABLE   0x01
#define PCI_MSI_RFU   3
#define PCI_MSI_ADDRESS_LO   4
#define PCI_MSI_ADDRESS_HI   8
#define PCI_MSI_DATA_32   8
#define PCI_MSI_DATA_64   12
#define PCI_ERR_UNCOR_STATUS   4
#define PCI_ERR_UNC_TRAIN   0x00000001
#define PCI_ERR_UNC_DLP   0x00000010
#define PCI_ERR_UNC_POISON_TLP   0x00001000
#define PCI_ERR_UNC_FCP   0x00002000
#define PCI_ERR_UNC_COMP_TIME   0x00004000
#define PCI_ERR_UNC_COMP_ABORT   0x00008000
#define PCI_ERR_UNC_UNX_COMP   0x00010000
#define PCI_ERR_UNC_RX_OVER   0x00020000
#define PCI_ERR_UNC_MALF_TLP   0x00040000
#define PCI_ERR_UNC_ECRC   0x00080000
#define PCI_ERR_UNC_UNSUP   0x00100000
#define PCI_ERR_UNCOR_MASK   8
#define PCI_ERR_UNCOR_SEVER   12
#define PCI_ERR_COR_STATUS   16
#define PCI_ERR_COR_RCVR   0x00000001
#define PCI_ERR_COR_BAD_TLP   0x00000040
#define PCI_ERR_COR_BAD_DLLP   0x00000080
#define PCI_ERR_COR_REP_ROLL   0x00000100
#define PCI_ERR_COR_REP_TIMER   0x00001000
#define PCI_ERR_COR_MASK   20
#define PCI_ANY_ID   0xffff
 Match-anything ID.
#define PCI_DRIVERS   __table ( struct pci_driver, "pci_drivers" )
 PCI driver table.
#define __pci_driver   __table_entry ( PCI_DRIVERS, 01 )
 Declare a PCI driver.
#define PCI_DEVFN(slot, func)   ( ( (slot) << 3 ) | (func) )
#define PCI_SLOT(devfn)   ( ( (devfn) >> 3 ) & 0x1f )
#define PCI_FUNC(devfn)   ( (devfn) & 0x07 )
#define PCI_BUS(busdevfn)   ( (busdevfn) >> 8 )
#define PCI_BUSDEVFN(bus, devfn)   ( ( (bus) << 8 ) | (devfn) )
#define PCI_BASE_CLASS(class)   ( (class) >> 16 )
#define PCI_SUB_CLASS(class)   ( ( (class) >> 8 ) & 0xff )
#define PCI_PROG_INTF(class)   ( (class) & 0xff )
#define PCI_ID(_vendor, _device, _name, _description, _data)
#define PCI_ROM(_vendor, _device, _name, _description, _data)   PCI_ID( _vendor, _device, _name, _description, _data )

Functions

 FILE_LICENCE (GPL2_ONLY)
void adjust_pci_device (struct pci_device *pci)
 Enable PCI device.
unsigned long pci_bar_start (struct pci_device *pci, unsigned int reg)
 Find the start of a PCI BAR.
int pci_find_capability (struct pci_device *pci, int capability)
 Look for a PCI capability.
unsigned long pci_bar_size (struct pci_device *pci, unsigned int reg)
 Find the size of a PCI BAR.
static void pci_set_drvdata (struct pci_device *pci, void *priv)
 Set PCI driver-private data.
static void * pci_get_drvdata (struct pci_device *pci)
 Get PCI driver-private data.


Define Documentation

#define PCI_COMMAND_IO   0x1

Definition at line 32 of file pci.h.

Referenced by adjust_pci_device(), and atl1e_reset_hw().

#define PCI_COMMAND_MEM   0x2

Definition at line 33 of file pci.h.

Referenced by adjust_pci_device(), atl1e_reset_hw(), and atl1e_setup_pcicmd().

#define PCI_COMMAND_MASTER   0x4

Definition at line 34 of file pci.h.

Referenced by adjust_pci_device(), atl1e_reset_hw(), and atl1e_setup_pcicmd().

#define PCI_CACHE_LINE_SIZE   0x0c

Definition at line 36 of file pci.h.

Referenced by ath5k_probe(), rtl8169_init_phy(), and rtl_hw_start_8169().

#define PCI_LATENCY_TIMER   0x0d

Definition at line 37 of file pci.h.

Referenced by adjust_pci_device(), ath5k_probe(), rtl8169_init_phy(), and tg3_get_invariants().

#define PCI_COMMAND_SPECIAL   0x8

Definition at line 39 of file pci.h.

#define PCI_COMMAND_INVALIDATE   0x10

Definition at line 40 of file pci.h.

Referenced by e1000_pci_clear_mwi(), and tg3_get_invariants().

#define PCI_COMMAND_VGA_PALETTE   0x20

Definition at line 41 of file pci.h.

#define PCI_COMMAND_PARITY   0x40

Definition at line 42 of file pci.h.

Referenced by bnx2_init_board(), and tg3_get_invariants().

#define PCI_COMMAND_WAIT   0x80

Definition at line 43 of file pci.h.

#define PCI_COMMAND_SERR   0x100

Definition at line 44 of file pci.h.

Referenced by bnx2_init_board(), and tg3_get_invariants().

#define PCI_COMMAND_FAST_BACK   0x200

Definition at line 45 of file pci.h.

#define PCI_COMMAND_INTX_DISABLE   0x400

Definition at line 46 of file pci.h.

Referenced by myri10ge_net_irq().

#define PCI_VENDOR_ID   0x00

Definition at line 49 of file pci.h.

Referenced by pcibus_probe().

#define PCI_DEVICE_ID   0x02

Definition at line 50 of file pci.h.

#define PCI_COMMAND   0x04

#define PCI_STATUS   0x06

Definition at line 53 of file pci.h.

Referenced by pci_find_capability(), skge_reset(), sky2_hw_intr(), and sky2_reset().

#define PCI_STATUS_CAP_LIST   0x10

Definition at line 54 of file pci.h.

Referenced by pci_find_capability().

#define PCI_STATUS_66MHZ   0x20

Definition at line 55 of file pci.h.

#define PCI_STATUS_UDF   0x40

Definition at line 56 of file pci.h.

#define PCI_STATUS_FAST_BACK   0x80

Definition at line 57 of file pci.h.

#define PCI_STATUS_PARITY   0x100

Definition at line 58 of file pci.h.

#define PCI_STATUS_DEVSEL_MASK   0x600

Definition at line 59 of file pci.h.

#define PCI_STATUS_DEVSEL_FAST   0x000

Definition at line 60 of file pci.h.

#define PCI_STATUS_DEVSEL_MEDIUM   0x200

Definition at line 61 of file pci.h.

#define PCI_STATUS_DEVSEL_SLOW   0x400

Definition at line 62 of file pci.h.

#define PCI_STATUS_SIG_TARGET_ABORT   0x800

Definition at line 63 of file pci.h.

#define PCI_STATUS_REC_TARGET_ABORT   0x1000

Definition at line 64 of file pci.h.

#define PCI_STATUS_REC_MASTER_ABORT   0x2000

Definition at line 65 of file pci.h.

#define PCI_STATUS_SIG_SYSTEM_ERROR   0x4000

Definition at line 66 of file pci.h.

#define PCI_STATUS_DETECTED_PARITY   0x8000

Definition at line 67 of file pci.h.

#define PCI_REVISION   0x08

Definition at line 69 of file pci.h.

Referenced by pcibus_probe(), rhine_probe1(), sis900_probe(), and tulip_probe().

#define PCI_REVISION_ID   0x08

#define PCI_CLASS_REVISION   0x08

Definition at line 71 of file pci.h.

Referenced by falcon_probe_nic_variant().

#define PCI_CLASS_CODE   0x0b

Definition at line 72 of file pci.h.

#define PCI_SUBCLASS_CODE   0x0a

Definition at line 73 of file pci.h.

#define PCI_HEADER_TYPE   0x0e

Definition at line 74 of file pci.h.

Referenced by pci_find_capability(), and pcibus_probe().

#define PCI_HEADER_TYPE_NORMAL   0

Definition at line 75 of file pci.h.

Referenced by pci_find_capability().

#define PCI_HEADER_TYPE_BRIDGE   1

Definition at line 76 of file pci.h.

Referenced by pci_find_capability().

#define PCI_HEADER_TYPE_CARDBUS   2

Definition at line 77 of file pci.h.

Referenced by pci_find_capability().

#define PCI_CARDBUS_CIS   0x28

Definition at line 81 of file pci.h.

#define PCI_SUBSYSTEM_VENDOR_ID   0x2c

Definition at line 82 of file pci.h.

Referenced by e1000_sw_init(), and tg3_get_invariants().

#define PCI_SUBSYSTEM_ID   0x2e

Definition at line 83 of file pci.h.

Referenced by e1000_sw_init(), and tg3_get_invariants().

#define PCI_BASE_ADDRESS_0   0x10

#define PCI_BASE_ADDRESS_1   0x14

Definition at line 86 of file pci.h.

Referenced by e1000e_probe(), ns83820_probe(), and velocity_get_pci_info().

#define PCI_BASE_ADDRESS_2   0x18

Definition at line 87 of file pci.h.

Referenced by efab_probe().

#define PCI_BASE_ADDRESS_3   0x1c

Definition at line 88 of file pci.h.

#define PCI_BASE_ADDRESS_4   0x20

Definition at line 89 of file pci.h.

#define PCI_BASE_ADDRESS_5   0x24

Definition at line 90 of file pci.h.

Referenced by pci_read_bases().

#define PCI_BASE_ADDRESS_SPACE   0x01

Definition at line 92 of file pci.h.

#define PCI_BASE_ADDRESS_SPACE_IO   0x01

Definition at line 93 of file pci.h.

#define PCI_BASE_ADDRESS_SPACE_MEMORY   0x00

Definition at line 94 of file pci.h.

#define PCI_BASE_ADDRESS_MEM_TYPE_MASK   0x06

Definition at line 96 of file pci.h.

#define PCI_BASE_ADDRESS_MEM_TYPE_32   0x00

Definition at line 97 of file pci.h.

#define PCI_BASE_ADDRESS_MEM_TYPE_1M   0x02

Definition at line 98 of file pci.h.

#define PCI_BASE_ADDRESS_MEM_TYPE_64   0x04

Definition at line 99 of file pci.h.

#define PCI_BASE_ADDRESS_MEM_MASK   (~0x0f)

Definition at line 100 of file pci.h.

Referenced by pci_bar_size(), pci_bar_start(), pci_read_bases(), and pci_resource_flags().

#define PCI_BASE_ADDRESS_IO_MASK   (~0x03)

#define PCI_ROM_ADDRESS   0x30

Definition at line 102 of file pci.h.

Referenced by undipci_find_rom().

#define PCI_ROM_ADDRESS_ENABLE   0x01

Definition at line 103 of file pci.h.

#define PCI_CAPABILITY_LIST   0x34

Definition at line 107 of file pci.h.

Referenced by pci_find_capability().

#define PCI_INTERRUPT_LINE   0x3c

Definition at line 109 of file pci.h.

Referenced by pcibus_probe().

#define PCI_INTERRUPT_PIN   0x3d

Definition at line 110 of file pci.h.

#define PCI_PRIMARY_BUS   0x18

Definition at line 113 of file pci.h.

#define PCI_SECONDARY_BUS   0x19

Definition at line 114 of file pci.h.

#define PCI_SUBORDINATE_BUS   0x1a

Definition at line 115 of file pci.h.

#define PCI_SEC_LATENCY_TIMER   0x1b

Definition at line 116 of file pci.h.

#define PCI_IO_BASE   0x1c

Definition at line 117 of file pci.h.

#define PCI_IO_LIMIT   0x1d

Definition at line 118 of file pci.h.

#define PCI_IO_RANGE_TYPE_MASK   0x0f

Definition at line 119 of file pci.h.

#define PCI_IO_RANGE_TYPE_16   0x00

Definition at line 120 of file pci.h.

#define PCI_IO_RANGE_TYPE_32   0x01

Definition at line 121 of file pci.h.

#define PCI_IO_RANGE_MASK   ~0x0f

Definition at line 122 of file pci.h.

#define PCI_SEC_STATUS   0x1e

Definition at line 123 of file pci.h.

#define PCI_MEMORY_BASE   0x20

Definition at line 124 of file pci.h.

#define PCI_MEMORY_LIMIT   0x22

Definition at line 125 of file pci.h.

#define PCI_MEMORY_RANGE_TYPE_MASK   0x0f

Definition at line 126 of file pci.h.

#define PCI_MEMORY_RANGE_MASK   ~0x0f

Definition at line 127 of file pci.h.

#define PCI_PREF_MEMORY_BASE   0x24

Definition at line 128 of file pci.h.

#define PCI_PREF_MEMORY_LIMIT   0x26

Definition at line 129 of file pci.h.

#define PCI_PREF_RANGE_TYPE_MASK   0x0f

Definition at line 130 of file pci.h.

#define PCI_PREF_RANGE_TYPE_32   0x00

Definition at line 131 of file pci.h.

#define PCI_PREF_RANGE_TYPE_64   0x01

Definition at line 132 of file pci.h.

#define PCI_PREF_RANGE_MASK   ~0x0f

Definition at line 133 of file pci.h.

#define PCI_PREF_BASE_UPPER32   0x28

Definition at line 134 of file pci.h.

#define PCI_PREF_LIMIT_UPPER32   0x2c

Definition at line 135 of file pci.h.

#define PCI_IO_BASE_UPPER16   0x30

Definition at line 136 of file pci.h.

#define PCI_IO_LIMIT_UPPER16   0x32

Definition at line 137 of file pci.h.

#define PCI_ROM_ADDRESS1   0x38

Definition at line 140 of file pci.h.

#define PCI_BRIDGE_CONTROL   0x3e

Definition at line 142 of file pci.h.

#define PCI_BRIDGE_CTL_PARITY   0x01

Definition at line 143 of file pci.h.

#define PCI_BRIDGE_CTL_SERR   0x02

Definition at line 144 of file pci.h.

#define PCI_BRIDGE_CTL_NO_ISA   0x04

Definition at line 145 of file pci.h.

#define PCI_BRIDGE_CTL_VGA   0x08

Definition at line 146 of file pci.h.

#define PCI_BRIDGE_CTL_MASTER_ABORT   0x20

Definition at line 147 of file pci.h.

#define PCI_BRIDGE_CTL_BUS_RESET   0x40

Definition at line 148 of file pci.h.

#define PCI_BRIDGE_CTL_FAST_BACK   0x80

Definition at line 149 of file pci.h.

#define PCI_CB_CAPABILITY_LIST   0x14

Definition at line 151 of file pci.h.

Referenced by pci_find_capability().

#define PCI_CAP_LIST_ID   0

Definition at line 155 of file pci.h.

Referenced by pci_find_capability().

#define PCI_CAP_ID_PM   0x01

Definition at line 156 of file pci.h.

Referenced by bnx2_init_board(), pci_set_power_state(), and tg3_probe().

#define PCI_CAP_ID_AGP   0x02

Definition at line 157 of file pci.h.

#define PCI_CAP_ID_VPD   0x03

Definition at line 158 of file pci.h.

#define PCI_CAP_ID_SLOTID   0x04

Definition at line 159 of file pci.h.

#define PCI_CAP_ID_MSI   0x05

Definition at line 160 of file pci.h.

#define PCI_CAP_ID_CHSWP   0x06

Definition at line 161 of file pci.h.

#define PCI_CAP_ID_EXP   0x10

Definition at line 162 of file pci.h.

#define PCI_CAP_LIST_NEXT   1

Definition at line 163 of file pci.h.

Referenced by pci_find_capability().

#define PCI_CAP_FLAGS   2

Definition at line 164 of file pci.h.

#define PCI_CAP_SIZEOF   4

Definition at line 165 of file pci.h.

#define PCI_PM_PMC   2

Definition at line 169 of file pci.h.

Referenced by pci_set_power_state().

#define PCI_PM_CAP_VER_MASK   0x0007

Definition at line 170 of file pci.h.

#define PCI_PM_CAP_PME_CLOCK   0x0008

Definition at line 171 of file pci.h.

#define PCI_PM_CAP_RESERVED   0x0010

Definition at line 172 of file pci.h.

#define PCI_PM_CAP_DSI   0x0020

Definition at line 173 of file pci.h.

#define PCI_PM_CAP_AUX_POWER   0x01C0

Definition at line 174 of file pci.h.

#define PCI_PM_CAP_D1   0x0200

Definition at line 175 of file pci.h.

Referenced by pci_set_power_state().

#define PCI_PM_CAP_D2   0x0400

Definition at line 176 of file pci.h.

Referenced by pci_set_power_state().

#define PCI_PM_CAP_PME   0x0800

Definition at line 177 of file pci.h.

#define PCI_PM_CAP_PME_MASK   0xF800

Definition at line 178 of file pci.h.

#define PCI_PM_CAP_PME_D0   0x0800

Definition at line 179 of file pci.h.

#define PCI_PM_CAP_PME_D1   0x1000

Definition at line 180 of file pci.h.

#define PCI_PM_CAP_PME_D2   0x2000

Definition at line 181 of file pci.h.

#define PCI_PM_CAP_PME_D3   0x4000

Definition at line 182 of file pci.h.

#define PCI_PM_CAP_PME_D3cold   0x8000

Definition at line 183 of file pci.h.

#define PCI_PM_CTRL   4

Definition at line 184 of file pci.h.

Referenced by bnx2_set_power_state_0(), pci_set_power_state(), and tg3_set_power_state_0().

#define PCI_PM_CTRL_STATE_MASK   0x0003

Definition at line 185 of file pci.h.

Referenced by bnx2_set_power_state_0(), pci_set_power_state(), and tg3_set_power_state_0().

#define PCI_PM_CTRL_PME_ENABLE   0x0100

Definition at line 186 of file pci.h.

#define PCI_PM_CTRL_DATA_SEL_MASK   0x1e00

Definition at line 187 of file pci.h.

#define PCI_PM_CTRL_DATA_SCALE_MASK   0x6000

Definition at line 188 of file pci.h.

#define PCI_PM_CTRL_PME_STATUS   0x8000

Definition at line 189 of file pci.h.

Referenced by bnx2_set_power_state_0(), and tg3_set_power_state_0().

#define PCI_PM_PPB_EXTENSIONS   6

Definition at line 190 of file pci.h.

#define PCI_PM_PPB_B2_B3   0x40

Definition at line 191 of file pci.h.

#define PCI_PM_BPCC_ENABLE   0x80

Definition at line 192 of file pci.h.

#define PCI_PM_DATA_REGISTER   7

Definition at line 193 of file pci.h.

#define PCI_PM_SIZEOF   8

Definition at line 194 of file pci.h.

#define PCI_AGP_VERSION   2

Definition at line 198 of file pci.h.

#define PCI_AGP_RFU   3

Definition at line 199 of file pci.h.

#define PCI_AGP_STATUS   4

Definition at line 200 of file pci.h.

#define PCI_AGP_STATUS_RQ_MASK   0xff000000

Definition at line 201 of file pci.h.

#define PCI_AGP_STATUS_SBA   0x0200

Definition at line 202 of file pci.h.

#define PCI_AGP_STATUS_64BIT   0x0020

Definition at line 203 of file pci.h.

#define PCI_AGP_STATUS_FW   0x0010

Definition at line 204 of file pci.h.

#define PCI_AGP_STATUS_RATE4   0x0004

Definition at line 205 of file pci.h.

#define PCI_AGP_STATUS_RATE2   0x0002

Definition at line 206 of file pci.h.

#define PCI_AGP_STATUS_RATE1   0x0001

Definition at line 207 of file pci.h.

#define PCI_AGP_COMMAND   8

Definition at line 208 of file pci.h.

#define PCI_AGP_COMMAND_RQ_MASK   0xff000000

Definition at line 209 of file pci.h.

#define PCI_AGP_COMMAND_SBA   0x0200

Definition at line 210 of file pci.h.

#define PCI_AGP_COMMAND_AGP   0x0100

Definition at line 211 of file pci.h.

#define PCI_AGP_COMMAND_64BIT   0x0020

Definition at line 212 of file pci.h.

#define PCI_AGP_COMMAND_FW   0x0010

Definition at line 213 of file pci.h.

#define PCI_AGP_COMMAND_RATE4   0x0004

Definition at line 214 of file pci.h.

#define PCI_AGP_COMMAND_RATE2   0x0002

Definition at line 215 of file pci.h.

#define PCI_AGP_COMMAND_RATE1   0x0001

Definition at line 216 of file pci.h.

#define PCI_AGP_SIZEOF   12

Definition at line 217 of file pci.h.

#define PCI_SID_ESR   2

Definition at line 221 of file pci.h.

#define PCI_SID_ESR_NSLOTS   0x1f

Definition at line 222 of file pci.h.

#define PCI_SID_ESR_FIC   0x20

Definition at line 223 of file pci.h.

#define PCI_SID_CHASSIS_NR   3

Definition at line 224 of file pci.h.

#define PCI_MSI_FLAGS   2

Definition at line 228 of file pci.h.

#define PCI_MSI_FLAGS_64BIT   0x80

Definition at line 229 of file pci.h.

#define PCI_MSI_FLAGS_QSIZE   0x70

Definition at line 230 of file pci.h.

#define PCI_MSI_FLAGS_QMASK   0x0e

Definition at line 231 of file pci.h.

#define PCI_MSI_FLAGS_ENABLE   0x01

Definition at line 232 of file pci.h.

#define PCI_MSI_RFU   3

Definition at line 233 of file pci.h.

#define PCI_MSI_ADDRESS_LO   4

Definition at line 234 of file pci.h.

#define PCI_MSI_ADDRESS_HI   8

Definition at line 235 of file pci.h.

#define PCI_MSI_DATA_32   8

Definition at line 236 of file pci.h.

#define PCI_MSI_DATA_64   12

Definition at line 237 of file pci.h.

#define PCI_ERR_UNCOR_STATUS   4

Definition at line 241 of file pci.h.

Referenced by sky2_hw_intr(), and sky2_reset().

#define PCI_ERR_UNC_TRAIN   0x00000001

Definition at line 242 of file pci.h.

#define PCI_ERR_UNC_DLP   0x00000010

Definition at line 243 of file pci.h.

#define PCI_ERR_UNC_POISON_TLP   0x00001000

Definition at line 244 of file pci.h.

#define PCI_ERR_UNC_FCP   0x00002000

Definition at line 245 of file pci.h.

#define PCI_ERR_UNC_COMP_TIME   0x00004000

Definition at line 246 of file pci.h.

#define PCI_ERR_UNC_COMP_ABORT   0x00008000

Definition at line 247 of file pci.h.

#define PCI_ERR_UNC_UNX_COMP   0x00010000

Definition at line 248 of file pci.h.

#define PCI_ERR_UNC_RX_OVER   0x00020000

Definition at line 249 of file pci.h.

#define PCI_ERR_UNC_MALF_TLP   0x00040000

Definition at line 250 of file pci.h.

#define PCI_ERR_UNC_ECRC   0x00080000

Definition at line 251 of file pci.h.

#define PCI_ERR_UNC_UNSUP   0x00100000

Definition at line 252 of file pci.h.

#define PCI_ERR_UNCOR_MASK   8

Definition at line 253 of file pci.h.

#define PCI_ERR_UNCOR_SEVER   12

Definition at line 255 of file pci.h.

#define PCI_ERR_COR_STATUS   16

Definition at line 257 of file pci.h.

#define PCI_ERR_COR_RCVR   0x00000001

Definition at line 258 of file pci.h.

#define PCI_ERR_COR_BAD_TLP   0x00000040

Definition at line 259 of file pci.h.

#define PCI_ERR_COR_BAD_DLLP   0x00000080

Definition at line 260 of file pci.h.

#define PCI_ERR_COR_REP_ROLL   0x00000100

Definition at line 261 of file pci.h.

#define PCI_ERR_COR_REP_TIMER   0x00001000

Definition at line 262 of file pci.h.

#define PCI_ERR_COR_MASK   20

Definition at line 263 of file pci.h.

#define PCI_ANY_ID   0xffff

Match-anything ID.

Definition at line 279 of file pci.h.

Referenced by pci_probe().

#define PCI_DRIVERS   __table ( struct pci_driver, "pci_drivers" )

PCI driver table.

Definition at line 344 of file pci.h.

Referenced by pci_probe().

struct pci_driver sis190_pci_driver __pci_driver   __table_entry ( PCI_DRIVERS, 01 ) [read]

Declare a PCI driver.

Definition at line 347 of file pci.h.

#define PCI_DEVFN ( slot,
func   )     ( ( (slot) << 3 ) | (func) )

Definition at line 349 of file pci.h.

Referenced by efi_snp_netdev(), and phantom_probe().

#define PCI_SLOT ( devfn   )     ( ( (devfn) >> 3 ) & 0x1f )

#define PCI_FUNC ( devfn   )     ( (devfn) & 0x07 )

#define PCI_BUS ( busdevfn   )     ( (busdevfn) >> 8 )

Definition at line 352 of file pci.h.

Referenced by pxenv_undi_get_nic_type().

#define PCI_BUSDEVFN ( bus,
devfn   )     ( ( (bus) << 8 ) | (devfn) )

Definition at line 353 of file pci.h.

Referenced by efi_snp_netdev(), pcibios_read(), pcibios_write(), pcibus_probe(), and undipci_probe().

#define PCI_BASE_CLASS ( class   )     ( (class) >> 16 )

Definition at line 355 of file pci.h.

Referenced by pxenv_undi_get_nic_type(), and undipci_probe().

#define PCI_SUB_CLASS ( class   )     ( ( (class) >> 8 ) & 0xff )

Definition at line 356 of file pci.h.

Referenced by pxenv_undi_get_nic_type().

#define PCI_PROG_INTF ( class   )     ( (class) & 0xff )

Definition at line 357 of file pci.h.

Referenced by pxenv_undi_get_nic_type().

#define PCI_ID ( _vendor,
_device,
_name,
_description,
_data   ) 

Value:

{       \
        .vendor = _vendor,                                              \
        .device = _device,                                              \
        .name = _name,                                                  \
        .driver_data = _data                                            \
}

Definition at line 367 of file pci.h.

#define PCI_ROM ( _vendor,
_device,
_name,
_description,
_data   )     PCI_ID( _vendor, _device, _name, _description, _data )

Definition at line 373 of file pci.h.


Function Documentation

FILE_LICENCE ( GPL2_ONLY   ) 

void adjust_pci_device ( struct pci_device pci  ) 

Enable PCI device.

Parameters:
pci PCI device
Set device to be a busmaster in case BIOS neglected to do so. Also adjust PCI latency timer to a reasonable value, 32.

Definition at line 143 of file pci.c.

References pci_device::bus, DBG, pci_device::devfn, PCI_COMMAND, PCI_COMMAND_IO, PCI_COMMAND_MASTER, PCI_COMMAND_MEM, PCI_FUNC, PCI_LATENCY_TIMER, pci_read_config_byte(), pci_read_config_word(), PCI_SLOT, pci_write_config_byte(), and pci_write_config_word().

Referenced by a3c90x_probe(), amd8111e_probe(), arbel_probe(), ath5k_probe(), atl1e_probe(), b44_probe(), bnx2_init_board(), dmfe_probe(), e1000_probe(), e1000e_probe(), efab_probe(), forcedeth_probe(), hermon_probe(), ifec_pci_probe(), igb_probe(), linda_probe(), mtd_probe(), mtnic_probe(), myri10ge_pci_probe(), natsemi_probe(), ns83820_probe(), pcnet32_probe(), phantom_probe(), pnic_probe(), rhine_probe(), rtl8169_probe(), rtl818x_probe(), rtl_probe(), sis190_init_board(), sis900_probe(), skge_probe(), sky2_probe(), sundance_probe(), tg3_probe(), tlan_probe(), tulip_probe(), velocity_get_pci_info(), virtnet_probe(), vxge_probe(), and w89c840_probe().

00143                                                   {
00144         unsigned short new_command, pci_command;
00145         unsigned char pci_latency;
00146 
00147         pci_read_config_word ( pci, PCI_COMMAND, &pci_command );
00148         new_command = ( pci_command | PCI_COMMAND_MASTER |
00149                         PCI_COMMAND_MEM | PCI_COMMAND_IO );
00150         if ( pci_command != new_command ) {
00151                 DBG ( "PCI BIOS has not enabled device %02x:%02x.%x! "
00152                       "Updating PCI command %04x->%04x\n", pci->bus,
00153                       PCI_SLOT ( pci->devfn ), PCI_FUNC ( pci->devfn ),
00154                       pci_command, new_command );
00155                 pci_write_config_word ( pci, PCI_COMMAND, new_command );
00156         }
00157 
00158         pci_read_config_byte ( pci, PCI_LATENCY_TIMER, &pci_latency);
00159         if ( pci_latency < 32 ) {
00160                 DBG ( "PCI device %02x:%02x.%x latency timer is unreasonably "
00161                       "low at %d. Setting to 32.\n", pci->bus,
00162                       PCI_SLOT ( pci->devfn ), PCI_FUNC ( pci->devfn ),
00163                       pci_latency );
00164                 pci_write_config_byte ( pci, PCI_LATENCY_TIMER, 32);
00165         }
00166 }

unsigned long pci_bar_start ( struct pci_device pci,
unsigned int  reg 
)

Find the start of a PCI BAR.

Parameters:
pci PCI device
reg PCI register number
Return values:
start BAR start address
Reads the specified PCI base address register, and returns the address portion of the BAR (i.e. without the flags).

If the address exceeds the size of an unsigned long (i.e. if a 64-bit BAR has a non-zero high dword on a 32-bit machine), the return value will be zero.

Definition at line 90 of file pci.c.

References pci_bar(), PCI_BASE_ADDRESS_IO_MASK, PCI_BASE_ADDRESS_MEM_MASK, PCI_BASE_ADDRESS_SPACE, and PCI_BASE_ADDRESS_SPACE_MEMORY.

Referenced by amd8111e_probe(), arbel_probe(), bnx2_init_board(), dmfe_probe(), e1000_probe(), e1000e_probe(), efab_probe(), forcedeth_probe(), hermon_probe(), igb_probe(), mtnic_init_pci(), ns83820_probe(), phantom_map_crb(), skge_probe(), sky2_probe(), tg3_probe(), undipci_find_rom(), velocity_get_pci_info(), and vxge_probe().

00090                                                                          {
00091         unsigned long bar;
00092 
00093         bar = pci_bar ( pci, reg );
00094         if ( (bar & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY ){
00095                 return ( bar & PCI_BASE_ADDRESS_MEM_MASK );
00096         } else {
00097                 return ( bar & PCI_BASE_ADDRESS_IO_MASK );
00098         }
00099 }

int pci_find_capability ( struct pci_device pci,
int  cap 
)

Look for a PCI capability.

Parameters:
pci PCI device to query
cap Capability code
Return values:
address Address of capability, or 0 if not found
Determine whether or not a device supports a given PCI capability. Returns the address of the requested capability structure within the device's PCI configuration space, or 0 if the device does not support it.

Definition at line 18 of file pciextra.c.

References DBG, id, PCI_CAP_LIST_ID, PCI_CAP_LIST_NEXT, PCI_CAPABILITY_LIST, PCI_CB_CAPABILITY_LIST, PCI_HEADER_TYPE, PCI_HEADER_TYPE_BRIDGE, PCI_HEADER_TYPE_CARDBUS, PCI_HEADER_TYPE_NORMAL, pci_read_config_byte(), pci_read_config_word(), PCI_STATUS, and PCI_STATUS_CAP_LIST.

Referenced by ath5k_hw_attach(), ath5k_hw_nic_wakeup(), bnx2_init_board(), e1000_read_pcie_cap_reg(), e1000e_read_pcie_cap_reg(), igb_read_pcie_cap_reg(), igb_write_pcie_cap_reg(), mac_address_from_string_specs(), pci_set_power_state(), rtl8169_probe(), sky2_reset(), sky2_rx_start(), tg3_get_invariants(), and tg3_probe().

00018                                                             {
00019         uint16_t status;
00020         uint8_t pos, id;
00021         uint8_t hdr_type;
00022         int ttl = 48;
00023 
00024         pci_read_config_word ( pci, PCI_STATUS, &status );
00025         if ( ! ( status & PCI_STATUS_CAP_LIST ) )
00026                 return 0;
00027 
00028         pci_read_config_byte ( pci, PCI_HEADER_TYPE, &hdr_type );
00029         switch ( hdr_type & 0x7F ) {
00030         case PCI_HEADER_TYPE_NORMAL:
00031         case PCI_HEADER_TYPE_BRIDGE:
00032         default:
00033                 pci_read_config_byte ( pci, PCI_CAPABILITY_LIST, &pos );
00034                 break;
00035         case PCI_HEADER_TYPE_CARDBUS:
00036                 pci_read_config_byte ( pci, PCI_CB_CAPABILITY_LIST, &pos );
00037                 break;
00038         }
00039         while ( ttl-- && pos >= 0x40 ) {
00040                 pos &= ~3;
00041                 pci_read_config_byte ( pci, pos + PCI_CAP_LIST_ID, &id );
00042                 DBG ( "PCI Capability: %d\n", id );
00043                 if ( id == 0xff )
00044                         break;
00045                 if ( id == cap )
00046                         return pos;
00047                 pci_read_config_byte ( pci, pos + PCI_CAP_LIST_NEXT, &pos );
00048         }
00049         return 0;
00050 }

unsigned long pci_bar_size ( struct pci_device pci,
unsigned int  reg 
)

Find the size of a PCI BAR.

Parameters:
pci PCI device
reg PCI register number
Return values:
size BAR size
It should not be necessary for any Etherboot code to call this function.

Definition at line 62 of file pciextra.c.

References PCI_BASE_ADDRESS_IO_MASK, PCI_BASE_ADDRESS_MEM_MASK, PCI_BASE_ADDRESS_SPACE_IO, PCI_COMMAND, pci_read_config_dword(), pci_read_config_word(), pci_write_config_dword(), pci_write_config_word(), and size.

Referenced by amd8111e_probe(), e1000_probe(), e1000e_probe(), efab_probe(), forcedeth_probe(), igb_probe(), phantom_map_crb(), tg3_probe(), velocity_get_pci_info(), and vxge_probe().

00062                                                                         {
00063         uint16_t cmd;
00064         uint32_t start, size;
00065 
00066         /* Save the original command register */
00067         pci_read_config_word ( pci, PCI_COMMAND, &cmd );
00068         /* Save the original bar */
00069         pci_read_config_dword ( pci, reg, &start );
00070         /* Compute which bits can be set */
00071         pci_write_config_dword ( pci, reg, ~0 );
00072         pci_read_config_dword ( pci, reg, &size );
00073         /* Restore the original size */
00074         pci_write_config_dword ( pci, reg, start );
00075         /* Find the significant bits */
00076         /* Restore the original command register. This reenables decoding. */
00077         pci_write_config_word ( pci, PCI_COMMAND, cmd );
00078         if ( start & PCI_BASE_ADDRESS_SPACE_IO ) {
00079                 size &= PCI_BASE_ADDRESS_IO_MASK;
00080         } else {
00081                 size &= PCI_BASE_ADDRESS_MEM_MASK;
00082         }
00083         /* Find the lowest bit set */
00084         size = size & ~( size - 1 );
00085         return size;
00086 }

static void pci_set_drvdata ( struct pci_device pci,
void *  priv 
) [inline, static]

static void* pci_get_drvdata ( struct pci_device pci  )  [inline, static]


Generated on Tue Apr 6 20:01:51 2010 for gPXE by  doxygen 1.5.7.1