summaryrefslogtreecommitdiff
path: root/com32/include/sys/pci.h
diff options
context:
space:
mode:
Diffstat (limited to 'com32/include/sys/pci.h')
-rw-r--r--com32/include/sys/pci.h103
1 files changed, 53 insertions, 50 deletions
diff --git a/com32/include/sys/pci.h b/com32/include/sys/pci.h
index b6556ff0..2c6b5158 100644
--- a/com32/include/sys/pci.h
+++ b/com32/include/sys/pci.h
@@ -17,57 +17,58 @@
typedef uint32_t pciaddr_t;
enum {
- ENOPCIIDS = 100,
- ENOMODULESPCIMAP
+ ENOPCIIDS = 100,
+ ENOMODULESPCIMAP
};
/* a structure for extended pci information */
/* XXX: use pointers for these? */
struct pci_dev_info {
- char vendor_name[PCI_VENDOR_NAME_SIZE];
- char product_name[PCI_PRODUCT_NAME_SIZE];
- char linux_kernel_module[LINUX_KERNEL_MODULE_SIZE][MAX_KERNEL_MODULES_PER_PCI_DEVICE];
- int linux_kernel_module_count;
- char class_name[PCI_CLASS_NAME_SIZE]; /* The most precise class name */
- char category_name[PCI_CLASS_NAME_SIZE]; /*The general category*/
- uint8_t irq;
- uint8_t latency;
+ char vendor_name[PCI_VENDOR_NAME_SIZE];
+ char product_name[PCI_PRODUCT_NAME_SIZE];
+ char linux_kernel_module[LINUX_KERNEL_MODULE_SIZE]
+ [MAX_KERNEL_MODULES_PER_PCI_DEVICE];
+ int linux_kernel_module_count;
+ char class_name[PCI_CLASS_NAME_SIZE]; /* The most precise class name */
+ char category_name[PCI_CLASS_NAME_SIZE]; /*The general category */
+ uint8_t irq;
+ uint8_t latency;
};
/* PCI device (really, function) */
struct pci_device {
- union {
- struct {
- uint16_t vendor;
- uint16_t product;
- uint16_t sub_vendor;
- uint16_t sub_product;
- uint8_t revision;
- uint8_t class[3];
+ union {
+ struct {
+ uint16_t vendor;
+ uint16_t product;
+ uint16_t sub_vendor;
+ uint16_t sub_product;
+ uint8_t revision;
+ uint8_t class[3];
+ };
+ struct {
+ uint32_t vid_did;
+ uint32_t svid_sdid;
+ uint32_t rid_class;
+ };
};
- struct {
- uint32_t vid_did;
- uint32_t svid_sdid;
- uint32_t rid_class;
- };
- };
- struct pci_dev_info *dev_info;
- struct pci_device *next;
+ struct pci_dev_info *dev_info;
+ struct pci_device *next;
};
/* PCI device ("slot") structure */
struct pci_slot {
- struct pci_device *func[MAX_PCI_FUNC];
+ struct pci_device *func[MAX_PCI_FUNC];
};
/* PCI bus structure */
struct pci_bus {
- struct pci_slot *slot[MAX_PCI_DEVICES];
+ struct pci_slot *slot[MAX_PCI_DEVICES];
};
/* PCI domain structure */
struct pci_domain {
- struct pci_bus *bus[MAX_PCI_BUSES];
+ struct pci_bus *bus[MAX_PCI_BUSES];
};
/* Iterate over a PCI domain */
@@ -91,43 +92,43 @@ struct pci_domain {
func[__pci_func]))
struct match {
- struct match *next;
- uint32_t did;
- uint32_t did_mask;
- uint32_t sid;
- uint32_t sid_mask;
- uint8_t rid_min, rid_max;
- char *filename;
+ struct match *next;
+ uint32_t did;
+ uint32_t did_mask;
+ uint32_t sid;
+ uint32_t sid_mask;
+ uint8_t rid_min, rid_max;
+ char *filename;
};
static inline pciaddr_t pci_mkaddr(uint32_t bus, uint32_t dev,
uint32_t func, uint32_t reg)
{
- return 0x80000000 | ((bus & 0xff) << 16) | ((dev & 0x1f) << 11) |
- ((func & 0x07) << 8) | (reg & 0xff);
+ return 0x80000000 | ((bus & 0xff) << 16) | ((dev & 0x1f) << 11) |
+ ((func & 0x07) << 8) | (reg & 0xff);
}
static inline int pci_bus(pciaddr_t addr)
{
- return (addr >> 16) & 0xff;
+ return (addr >> 16) & 0xff;
}
static inline int pci_dev(pciaddr_t addr)
{
- return (addr >> 11) & 0x1f;
+ return (addr >> 11) & 0x1f;
}
static inline int pci_func(pciaddr_t addr)
{
- return (addr >> 8) & 0x07;
+ return (addr >> 8) & 0x07;
}
enum pci_config_type {
- PCI_CFG_NONE = -1, /* badness */
- PCI_CFG_AUTO = 0, /* autodetect */
- PCI_CFG_TYPE1 = 1,
- PCI_CFG_TYPE2 = 2,
- PCI_CFG_BIOS = 3,
+ PCI_CFG_NONE = -1, /* badness */
+ PCI_CFG_AUTO = 0, /* autodetect */
+ PCI_CFG_TYPE1 = 1,
+ PCI_CFG_TYPE2 = 2,
+ PCI_CFG_BIOS = 3,
};
enum pci_config_type pci_set_config_type(enum pci_config_type);
@@ -141,10 +142,12 @@ void pci_writel(uint32_t, pciaddr_t);
struct pci_domain *pci_scan(void);
void free_pci_domain(struct pci_domain *domain);
-struct match * find_pci_device(const struct pci_domain *pci_domain,
- struct match *list);
+struct match *find_pci_device(const struct pci_domain *pci_domain,
+ struct match *list);
int get_name_from_pci_ids(struct pci_domain *pci_domain, char *pciids_path);
-int get_module_name_from_pcimap(struct pci_domain *pci_domain, char *modules_pcimap_path);
-int get_class_name_from_pci_ids(struct pci_domain *pci_domain, char *pciids_path);
+int get_module_name_from_pcimap(struct pci_domain *pci_domain,
+ char *modules_pcimap_path);
+int get_class_name_from_pci_ids(struct pci_domain *pci_domain,
+ char *pciids_path);
void gather_additional_pci_config(struct pci_domain *domain);
#endif /* _SYS_PCI_H */