2008-12-31 16:21:08 +00:00
|
|
|
typedef struct pci_config_t pci_config_t;
|
|
|
|
|
|
|
|
|
|
struct pci_config_t {
|
|
|
|
|
char path[256];
|
2009-01-07 15:43:10 +00:00
|
|
|
uint32_t dev; /* bus, dev, fn */
|
2009-01-07 15:50:03 +00:00
|
|
|
uint32_t assigned[7];
|
2008-12-31 16:21:08 +00:00
|
|
|
uint32_t sizes[7];
|
2009-01-07 15:45:26 +00:00
|
|
|
int irq_pin;
|
|
|
|
|
int irq_line;
|
2008-12-31 16:21:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef struct pci_dev_t pci_dev_t;
|
|
|
|
|
struct pci_dev_t {
|
|
|
|
|
uint16_t vendor;
|
|
|
|
|
uint16_t product;
|
|
|
|
|
const char *type;
|
|
|
|
|
const char *name;
|
|
|
|
|
const char *model;
|
|
|
|
|
const char *compat;
|
|
|
|
|
int acells;
|
|
|
|
|
int scells;
|
|
|
|
|
int icells;
|
|
|
|
|
int (*config_cb)(const pci_config_t *config);
|
|
|
|
|
const void *private;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern int ide_config_cb2(const pci_config_t *config);
|
|
|
|
|
extern int eth_config_cb(const pci_config_t *config);
|
|
|
|
|
extern int macio_config_cb(const pci_config_t *config);
|
|
|
|
|
extern int vga_config_cb(const pci_config_t *config);
|
|
|
|
|
|
2009-01-05 20:14:07 +00:00
|
|
|
static inline int pci_compat_len(const pci_dev_t *dev)
|
2008-12-31 16:21:08 +00:00
|
|
|
{
|
|
|
|
|
int len, ret;
|
|
|
|
|
const char *path = dev->compat;
|
|
|
|
|
ret = 0;
|
|
|
|
|
while ((len = strlen(path)) != 0) {
|
|
|
|
|
ret += len + 1;
|
|
|
|
|
path += len + 1;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extern const pci_dev_t *pci_find_device(uint8_t class, uint8_t subclass,
|
|
|
|
|
uint8_t iface, uint16_t vendor,
|
|
|
|
|
uint16_t product);
|