From b78c1972feed4c57eebba8f94de86a91e32c3fa7 Mon Sep 17 00:00:00 2001 From: Eric Biederman Date: Thu, 14 Oct 2004 20:54:17 +0000 Subject: - First pass through with with device tree enhancement merge. Most of the mechanisms should be in place but don't expect anything to quite work yet. git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1662 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/include/device/device.h | 4 ++-- src/include/device/path.h | 14 +++++++++++--- src/include/device/pci.h | 19 +++++++++++++++++-- src/include/device/pci_ids.h | 1 + src/include/device/pnp.h | 12 +++++++----- src/include/device/pnp_def.h | 2 ++ 6 files changed, 40 insertions(+), 12 deletions(-) (limited to 'src/include/device') diff --git a/src/include/device/device.h b/src/include/device/device.h index 439fc606a3..6dade9ed99 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -42,8 +42,8 @@ struct device { device_t next; /* chain of all devices */ struct device_path path; - unsigned short vendor; - unsigned short device; + unsigned vendor; + unsigned device; unsigned int class; /* 3 bytes: (base,sub,prog-if) */ unsigned int hdr_type; /* PCI header type */ unsigned int enabled : 1; /* set if we should enable the device */ diff --git a/src/include/device/path.h b/src/include/device/path.h index 20d76d1bbe..cd6be6ac03 100644 --- a/src/include/device/path.h +++ b/src/include/device/path.h @@ -4,9 +4,11 @@ enum device_path_type { DEVICE_PATH_NONE = 0, DEVICE_PATH_ROOT, + DEVICE_PATH_DEFAULT_CPU, DEVICE_PATH_PCI, DEVICE_PATH_PNP, DEVICE_PATH_I2C, + DEVICE_PATH_APIC, }; struct pci_path @@ -26,12 +28,18 @@ struct i2c_path unsigned device; }; +struct apic_path +{ + unsigned apic_id; +}; + struct device_path { enum device_path_type type; union { - struct pci_path pci; - struct pnp_path pnp; - struct i2c_path i2c; + struct pci_path pci; + struct pnp_path pnp; + struct i2c_path i2c; + struct apic_path apic; } u; }; diff --git a/src/include/device/pci.h b/src/include/device/pci.h index ef18cb40ee..13414a7df6 100644 --- a/src/include/device/pci.h +++ b/src/include/device/pci.h @@ -21,13 +21,18 @@ #include +/* Common pci operations without a standard interface */ +struct pci_operations { + void (*set_subsystem)(device_t dev, unsigned vendor, unsigned device); +}; + struct pci_driver { struct device_operations *ops; unsigned short vendor; unsigned short device; }; -#define __pci_driver __attribute__ ((unused,__section__(".rodata.pci_driver"))) +#define __pci_driver __attribute__ ((used,__section__(".rodata.pci_driver"))) /** start of compile time generated pci driver array */ extern struct pci_driver pci_drivers[]; /** end of compile time generated pci driver array */ @@ -37,7 +42,6 @@ extern struct pci_driver epci_drivers[]; struct device_operations default_pci_ops_dev; struct device_operations default_pci_ops_bus; - void pci_dev_read_resources(device_t dev); void pci_bus_read_resources(device_t dev); void pci_dev_set_resources(device_t dev); @@ -45,8 +49,19 @@ void pci_dev_enable_resources(device_t dev); void pci_bus_enable_resources(device_t dev); unsigned int pci_scan_bridge(device_t bus, unsigned int max); unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max); +struct resource *pci_get_resource(struct device *dev, unsigned long index); #define PCI_IO_BRIDGE_ALIGN 4096 #define PCI_MEM_BRIDGE_ALIGN (1024*1024) +static inline struct pci_operations *ops_pci(device_t dev) +{ + struct pci_operations *pops; + pops = 0; + if (dev && dev->ops) { + pops = dev->ops->ops_pci; + } + return pops; +} + #endif /* PCI_H */ diff --git a/src/include/device/pci_ids.h b/src/include/device/pci_ids.h index df27c83d83..d840b3879a 100644 --- a/src/include/device/pci_ids.h +++ b/src/include/device/pci_ids.h @@ -1757,6 +1757,7 @@ #define PCI_DEVICE_ID_INTEL_82801DB_7 0x24c7 #define PCI_DEVICE_ID_INTEL_82801DB_11 0x24cb #define PCI_DEVICE_ID_INTEL_82801DB_13 0x24cd +#define PCI_DEVICE_ID_INTEL_82801EB_0 0x24d0 #define PCI_DEVICE_ID_INTEL_80310 0x530d #define PCI_DEVICE_ID_INTEL_82810_MC1 0x7120 #define PCI_DEVICE_ID_INTEL_82810_IG1 0x7121 diff --git a/src/include/device/pnp.h b/src/include/device/pnp.h index 508fac68ed..89c0a730f5 100644 --- a/src/include/device/pnp.h +++ b/src/include/device/pnp.h @@ -36,11 +36,13 @@ struct pnp_info { unsigned flags; #define PNP_IO0 0x01 #define PNP_IO1 0x02 -#define PNP_IRQ0 0x04 -#define PNP_IRQ1 0x08 -#define PNP_DRQ0 0x10 -#define PNP_DRQ1 0x20 - struct io_info io0, io1; +#define PNP_IO2 0x04 +#define PNP_IO3 0x08 +#define PNP_IRQ0 0x10 +#define PNP_IRQ1 0x20 +#define PNP_DRQ0 0x40 +#define PNP_DRQ1 0x80 + struct io_info io0, io1, io2, io3; }; struct resource *pnp_get_resource(device_t dev, unsigned index); void pnp_enumerate(struct chip *chip, unsigned functions, diff --git a/src/include/device/pnp_def.h b/src/include/device/pnp_def.h index b077837d02..b17fde6478 100644 --- a/src/include/device/pnp_def.h +++ b/src/include/device/pnp_def.h @@ -3,6 +3,8 @@ #define PNP_IDX_IO0 0x60 #define PNP_IDX_IO1 0x62 +#define PNP_IDX_IO2 0x64 +#define PNP_IDX_IO3 0x66 #define PNP_IDX_IRQ0 0x70 #define PNP_IDX_IRQ1 0x72 #define PNP_IDX_DRQ0 0x74 -- cgit v1.2.3