diff options
| author | Michael Brown | 2005-04-14 12:10:54 +0200 |
|---|---|---|
| committer | Michael Brown | 2005-04-14 12:10:54 +0200 |
| commit | 75d864432cc41c45d46df9ea7d3afd7cccbc0148 (patch) | |
| tree | 8b98bce9c01b2f99f16d5da9f93a4e147dfe1865 /src/drivers/bus/mca.c | |
| parent | Stripped references to variables in C code. (diff) | |
| download | ipxe-75d864432cc41c45d46df9ea7d3afd7cccbc0148.tar.gz ipxe-75d864432cc41c45d46df9ea7d3afd7cccbc0148.tar.xz ipxe-75d864432cc41c45d46df9ea7d3afd7cccbc0148.zip | |
Use the magic of common symbols to allow struct dev to effectively grow at
link time to accommodate whatever bus objects are included.
Diffstat (limited to 'src/drivers/bus/mca.c')
| -rw-r--r-- | src/drivers/bus/mca.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/drivers/bus/mca.c b/src/drivers/bus/mca.c index 28b99f77a..1715c5883 100644 --- a/src/drivers/bus/mca.c +++ b/src/drivers/bus/mca.c @@ -20,6 +20,14 @@ #endif /* + * Ensure that there is sufficient space in the shared dev_bus + * structure for a struct pci_device. + * + */ +DEV_BUS( struct mca_device, mca_dev ); +static char mca_magic[0]; /* guaranteed unique symbol */ + +/* * Fill in parameters for an MCA device based on slot number * */ @@ -53,14 +61,14 @@ static int fill_mca_device ( struct mca_device *mca ) { * Obtain a struct mca * from a struct dev * * * If dev has not previously been used for an MCA device scan, blank - * out dev.mca + * out struct mca */ struct mca_device * mca_device ( struct dev *dev ) { - struct mca_device *mca = &dev->mca; + struct mca_device *mca = dev->bus; - if ( dev->devid.bus_type != MCA_BUS_TYPE ) { + if ( mca->magic != mca_magic ) { memset ( mca, 0, sizeof ( *mca ) ); - dev->devid.bus_type = MCA_BUS_TYPE; + mca->magic = mca_magic; } mca->dev = dev; return mca; @@ -97,8 +105,10 @@ int find_mca_device ( struct mca_device *mca, struct mca_driver *driver ) { id->name, driver->name, id->id ); if ( mca->dev ) { mca->dev->name = driver->name; - mca->dev->devid.vendor_id = - GENERIC_MCA_VENDOR; + mca->dev->devid.bus_type + = MCA_BUS_TYPE; + mca->dev->devid.vendor_id + = GENERIC_MCA_VENDOR; mca->dev->devid.device_id = id->id; } mca->already_tried = 1; |
