69 if (
sizeof (
unsigned long ) >
sizeof (
uint32_t ) ) {
155 unsigned short new_command, pci_command;
156 unsigned char pci_latency;
161 if ( pci_command != new_command ) {
162 DBGC ( pci,
PCI_FMT " device not enabled by BIOS! Updating " 163 "PCI command %04x->%04x\n",
164 PCI_ARGS ( pci ), pci_command, new_command );
169 if ( pci_latency < 32 ) {
170 DBGC ( pci,
PCI_FMT " latency timer is unreasonably low at " 171 "%d. Setting to 32.\n",
PCI_ARGS ( pci ), pci_latency );
199 if ( (
tmp == 0xffffffff ) || (
tmp == 0 ) )
256 memset ( pci, 0,
sizeof ( *pci ) );
300 for ( i = 0 ; i < driver->
id_count ; i++ ) {
301 id = &driver->
ids[i];
327 DBGC ( pci,
PCI_FMT " (%04x:%04x) has driver \"%s\"\n",
329 DBGC ( pci,
PCI_FMT " has mem %lx io %lx irq %d\n",
371 pci =
malloc (
sizeof ( *pci ) );
383 DBGC ( pci,
PCI_FMT " (%04x:%04x class %06x) has no " #define PCI_FUNC(busdevfn)
#define PCI_HEADER_TYPE_BRIDGE
PCI-to-PCI bridge header.
uint32_t start
Starting bus:dev.fn address.
unsigned long membase
Memory base.
uint8_t irq
Interrupt number.
#define PCI_BUS(busdevfn)
static struct root_driver pci_root_driver
PCI bus root device driver.
struct arbelprm_rc_send_wqe rc
uint32_t low
Low 16 bits of address.
struct pci_class_id class
PCI class ID.
struct pci_driver * driver
Driver for this device.
int pci_find_driver(struct pci_device *pci)
Find driver for PCI device.
static unsigned int unsigned int reg
void(* remove)(struct pci_device *pci)
Remove device.
uint32_t class
Device class.
#define PCI_LATENCY_TIMER
PCI latency timer.
#define list_add(new, head)
Add a new entry to the head of a list.
unsigned long ioaddr
I/O address.
unsigned int id_count
Number of entries in PCI ID table.
struct pci_device_id * ids
PCI ID table.
unsigned long ioaddr
I/O address.
int pci_write_config_word(struct pci_device *pci, unsigned int where, uint16_t value)
Write 16-bit word to PCI configuration space.
#define PCI_INTERRUPT_LINE
PCI interrupt line.
static void pci_set_driver(struct pci_device *pci, struct pci_driver *driver, struct pci_device_id *id)
Set PCI driver.
#define PCI_HEADER_TYPE_MASK
Header type mask.
int pci_can_probe(void)
Check if PCI bus probing is allowed.
#define ENOENT
No such file or directory.
unsigned long class
Device class.
unsigned long long uint64_t
#define PCI_BASE_ADDRESS_0
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
#define PCI_COMMAND
PCI command.
#define PCI_BASE_ADDRESS_5
struct device dev
Device chain.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
unsigned int vendor
Vendor ID.
struct device * parent
Bus device.
struct device dev
Generic device.
#define PCI_HEADER_TYPE
PCI header type.
#define PCI_COMMAND_MASTER
Bus master.
#define list_del(list)
Delete an entry from a list.
#define PCI_BASE_ADDRESS_IO_MASK
I/O BAR mask.
uint16_t busdevfn
PCI bus:dev.fn address.
#define ENOMEM
Not enough space.
#define PCI_COMMAND_IO
I/O space.
struct root_device pci_root_device __root_device
PCI bus root device.
int pci_find_next(struct pci_device *pci, uint32_t *busdevfn)
Find next device on PCI bus.
uint16_t device
Device ID.
#define BUS_TYPE_PCI
PCI bus type.
static void pci_read_bases(struct pci_device *pci)
Read membase and ioaddr for a PCI device.
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
#define PCI_FIRST_FUNC(busdevfn)
static int pcibus_probe(struct root_device *rootdev)
Probe PCI root bus.
A PCI bus:dev.fn address range.
uint16_t count
Number of entries.
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
unsigned int location
Location.
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
uint8_t id
Request identifier.
uint32_t high
High 32 bits of address.
static __always_inline void struct pci_range * range
#define PCI_BUSDEVFN(segment, bus, slot, func)
#define PCI_BASE_ADDRESS_MEM_MASK
Memory BAR mask.
uint8_t hdrtype
Header type.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
#define PCI_BASE_ADDRESS_MEM_TYPE_64
64-bit memory
int pci_write_config_byte(struct pci_device *pci, unsigned int where, uint8_t value)
Write byte to PCI configuration space.
#define PCI_FMT
PCI device debug message format.
#define PCI_SLOT(busdevfn)
struct list_head siblings
Devices on the same bus.
#define PCI_BASE_ADDRESS_MEM_TYPE_MASK
Memory type mask.
int pci_read_config(struct pci_device *pci)
Read PCI device configuration.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
#define ENODEV
No such device.
void pci_remove(struct pci_device *pci)
Remove a PCI device.
#define PCI_VENDOR_ID
PCI vendor ID.
REQUIRE_OBJECT(config_pci)
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
A PCI device ID list entry.
int(* probe)(struct root_device *rootdev)
Add root device.
void * malloc(size_t size)
Allocate memory.
unsigned int count
Number of bus:dev.fn addresses within this range.
#define PCI_BASE_ADDRESS_SPACE_IO
I/O BAR.
uint16_t vendor
Vendor ID.
void pci_discover(uint32_t busdevfn, struct pci_range *range)
Find next PCI bus:dev.fn address range in system.
uint32_t busdevfn
Segment, bus, device, and function (bus:dev.fn) number.
#define INIT_LIST_HEAD(list)
Initialise a list head.
unsigned int bus_type
Bus type.
static void pcibus_remove(struct root_device *rootdev)
Remove PCI root bus.
int(* probe)(struct pci_device *pci)
Probe device.
unsigned int device
Device ID.
struct list_head children
Devices attached to this device.
#define PCI_ARGS(pci)
PCI device debug message arguments.
struct pci_device_id * id
Driver device ID.
uint32_t end
Ending offset.
#define PCI_REVISION
PCI revision.
struct device_description desc
Device description.
REQUIRING_SYMBOL(pcibus_probe)
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
#define PCI_COMMAND_MEM
Memory space.
#define PCI_SUBORDINATE
Subordinate bus number.
static void pci_init(struct pci_device *pci, unsigned int busdevfn)
Initialise PCI device.
static unsigned long pci_bar(struct pci_device *pci, unsigned int reg)
Read PCI BAR.
#define PCI_SEG(busdevfn)
#define NULL
NULL pointer (VOID *)
int pci_probe(struct pci_device *pci)
Probe a PCI device.
#define PCI_HEADER_TYPE_MULTI
Multi-function device.
#define PCI_ANY_ID
Match-anything ID.
#define PCI_DRIVERS
PCI driver table.
void * memset(void *dest, int character, size_t len) __nonnull
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.