23,36 → 23,36 |
struct pci_methods; |
|
enum pci_access_type { |
/* Known access methods, remember to update access.c as well */ |
PCI_ACCESS_I386_TYPE1, /* i386 ports, type 1 (params: none) */ |
PCI_ACCESS_I386_TYPE2, /* i386 ports, type 2 (params: none) */ |
PCI_ACCESS_MAX |
/* Known access methods, remember to update access.c as well */ |
PCI_ACCESS_I386_TYPE1, /* i386 ports, type 1 (params: none) */ |
PCI_ACCESS_I386_TYPE2, /* i386 ports, type 2 (params: none) */ |
PCI_ACCESS_MAX |
}; |
|
struct pci_access { |
/* Options you can change: */ |
unsigned int method; /* Access method */ |
char *method_params[PCI_ACCESS_MAX]; /* Parameters for the methods */ |
int writeable; /* Open in read/write mode */ |
int buscentric; /* Bus-centric view of the world */ |
int numeric_ids; /* Don't resolve device IDs to names */ |
int debugging; /* Turn on debugging messages */ |
/* Options you can change: */ |
unsigned int method; /* Access method */ |
char *method_params[PCI_ACCESS_MAX]; /* Parameters for the methods */ |
int writeable; /* Open in read/write mode */ |
int buscentric; /* Bus-centric view of the world */ |
int numeric_ids; /* Don't resolve device IDs to names */ |
int debugging; /* Turn on debugging messages */ |
|
/* Functions you can override: */ |
void (*error)(char *msg, ...); /* Write error message and quit */ |
void (*warning)(char *msg, ...); /* Write a warning message */ |
void (*debug)(char *msg, ...); /* Write a debugging message */ |
/* Functions you can override: */ |
void (*error) (char *msg, ...); /* Write error message and quit */ |
void (*warning) (char *msg, ...); /* Write a warning message */ |
void (*debug) (char *msg, ...); /* Write a debugging message */ |
|
struct pci_dev *devices; /* Devices found on this bus */ |
struct pci_dev *devices; /* Devices found on this bus */ |
|
/* Fields used internally: */ |
struct pci_methods *methods; |
struct id_entry **id_hash; /* names.c */ |
struct id_bucket *current_id_bucket; |
int fd; /* proc: fd */ |
int fd_rw; /* proc: fd opened read-write */ |
struct pci_dev *cached_dev; /* proc: device the fd is for */ |
int fd_pos; /* proc: current position */ |
/* Fields used internally: */ |
struct pci_methods *methods; |
struct id_entry **id_hash; /* names.c */ |
struct id_bucket *current_id_bucket; |
int fd; /* proc: fd */ |
int fd_rw; /* proc: fd opened read-write */ |
struct pci_dev *cached_dev; /* proc: device the fd is for */ |
int fd_pos; /* proc: current position */ |
}; |
|
/* Initialize PCI access */ |
62,7 → 62,7 |
|
/* Scanning of devices */ |
void pci_scan_bus(struct pci_access *acc); |
struct pci_dev *pci_get_dev(struct pci_access *acc, int domain, int bus, int dev, int func); /* Raw access to specified device */ |
struct pci_dev *pci_get_dev(struct pci_access *acc, int domain, int bus, int dev, int func); /* Raw access to specified device */ |
void pci_free_dev(struct pci_dev *); |
|
/* |
70,41 → 70,41 |
*/ |
|
struct pci_dev { |
struct pci_dev *next; /* Next device in the chain */ |
u16 domain; /* PCI domain (host bridge) */ |
u8 bus, dev, func; /* Bus inside domain, device and function */ |
struct pci_dev *next; /* Next device in the chain */ |
u16 domain; /* PCI domain (host bridge) */ |
u8 bus, dev, func; /* Bus inside domain, device and function */ |
|
/* These fields are set by pci_fill_info() */ |
int known_fields; /* Set of info fields already known */ |
u16 vendor_id, device_id; /* Identity of the device */ |
int irq; /* IRQ number */ |
pciaddr_t base_addr[6]; /* Base addresses */ |
pciaddr_t size[6]; /* Region sizes */ |
pciaddr_t rom_base_addr; /* Expansion ROM base address */ |
pciaddr_t rom_size; /* Expansion ROM size */ |
/* These fields are set by pci_fill_info() */ |
int known_fields; /* Set of info fields already known */ |
u16 vendor_id, device_id; /* Identity of the device */ |
int irq; /* IRQ number */ |
pciaddr_t base_addr[6]; /* Base addresses */ |
pciaddr_t size[6]; /* Region sizes */ |
pciaddr_t rom_base_addr; /* Expansion ROM base address */ |
pciaddr_t rom_size; /* Expansion ROM size */ |
|
/* Fields used internally: */ |
struct pci_access *access; |
struct pci_methods *methods; |
u8 *cache; /* Cached config registers */ |
int cache_len; |
int hdrtype; /* Cached low 7 bits of header type, -1 if unknown */ |
void *aux; /* Auxillary data */ |
/* Fields used internally: */ |
struct pci_access *access; |
struct pci_methods *methods; |
u8 *cache; /* Cached config registers */ |
int cache_len; |
int hdrtype; /* Cached low 7 bits of header type, -1 if unknown */ |
void *aux; /* Auxillary data */ |
}; |
|
#define PCI_ADDR_IO_MASK (~(pciaddr_t) 0x3) |
#define PCI_ADDR_MEM_MASK (~(pciaddr_t) 0xf) |
|
u8 pci_read_byte(struct pci_dev *, int pos); /* Access to configuration space */ |
u8 pci_read_byte(struct pci_dev *, int pos); /* Access to configuration space */ |
u16 pci_read_word(struct pci_dev *, int pos); |
u32 pci_read_long(struct pci_dev *, int pos); |
int pci_read_block(struct pci_dev *, int pos, u8 *buf, int len); |
u32 pci_read_long(struct pci_dev *, int pos); |
int pci_read_block(struct pci_dev *, int pos, u8 * buf, int len); |
int pci_write_byte(struct pci_dev *, int pos, u8 data); |
int pci_write_word(struct pci_dev *, int pos, u16 data); |
int pci_write_long(struct pci_dev *, int pos, u32 data); |
int pci_write_block(struct pci_dev *, int pos, u8 *buf, int len); |
int pci_write_block(struct pci_dev *, int pos, u8 * buf, int len); |
|
int pci_fill_info(struct pci_dev *, int flags); /* Fill in device information */ |
int pci_fill_info(struct pci_dev *, int flags); /* Fill in device information */ |
|
#define PCI_FILL_IDENT 1 |
#define PCI_FILL_IRQ 2 |
113,7 → 113,7 |
#define PCI_FILL_SIZES 16 |
#define PCI_FILL_RESCAN 0x10000 |
|
void pci_setup_cache(struct pci_dev *, u8 *cache, int len); |
void pci_setup_cache(struct pci_dev *, u8 * cache, int len); |
|
/* |
* Filters |
120,8 → 120,8 |
*/ |
|
struct pci_filter { |
int domain, bus, slot, func; /* -1 = ANY */ |
int vendor, device; |
int domain, bus, slot, func; /* -1 = ANY */ |
int vendor, device; |
}; |
|
void pci_filter_init(struct pci_access *, struct pci_filter *); |
145,19 → 145,20 |
* PROGIF (classID, progif) -> programming interface |
*/ |
|
char *pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, ...); |
char *pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, |
...); |
|
int pci_load_name_list(struct pci_access *a); /* Called automatically by pci_lookup_*() when needed; returns success */ |
void pci_free_name_list(struct pci_access *a); /* Called automatically by pci_cleanup() */ |
|
enum pci_lookup_mode { |
PCI_LOOKUP_VENDOR = 1, /* Vendor name (args: vendorID) */ |
PCI_LOOKUP_DEVICE = 2, /* Device name (args: vendorID, deviceID) */ |
PCI_LOOKUP_CLASS = 4, /* Device class (args: classID) */ |
PCI_LOOKUP_SUBSYSTEM = 8, |
PCI_LOOKUP_PROGIF = 16, /* Programming interface (args: classID, prog_if) */ |
PCI_LOOKUP_NUMERIC = 0x10000, /* Want only formatted numbers; default if access->numeric_ids is set */ |
PCI_LOOKUP_NO_NUMBERS = 0x20000 /* Return NULL if not found in the database; default is to print numerically */ |
PCI_LOOKUP_VENDOR = 1, /* Vendor name (args: vendorID) */ |
PCI_LOOKUP_DEVICE = 2, /* Device name (args: vendorID, deviceID) */ |
PCI_LOOKUP_CLASS = 4, /* Device class (args: classID) */ |
PCI_LOOKUP_SUBSYSTEM = 8, |
PCI_LOOKUP_PROGIF = 16, /* Programming interface (args: classID, prog_if) */ |
PCI_LOOKUP_NUMERIC = 0x10000, /* Want only formatted numbers; default if access->numeric_ids is set */ |
PCI_LOOKUP_NO_NUMBERS = 0x20000 /* Return NULL if not found in the database; default is to print numerically */ |
}; |
|
#endif |