diff options
author | Eric Biederman <ebiederm@xmission.com> | 2004-10-21 10:44:08 +0000 |
---|---|---|
committer | Eric Biederman <ebiederm@xmission.com> | 2004-10-21 10:44:08 +0000 |
commit | dbec2d4090e40d1d8e1fd06e8d4180d3fa685d4d (patch) | |
tree | e813d3f9dea80d35cbc29d6bf35995fec0a06ab9 /src/devices/pnp_device.c | |
parent | f3aa4707d3bef9f529a70a204dbc648968cf7c20 (diff) |
- Bump the LinuxBIOS major version
- Rename chip_config chip_operations throughout the tree
- Fix Config.lb on most of the Opteron Ports
- Fix the amd 8000 chipset support for setting the subsystem vendor and device ids
- Add detection of devices that are on the motherboard (i.e. In Config.lb)
- Baby step in getting the resource limit handling correct, Ignore fixed resources
- Only call enable_childrens_resources on devices we know will have children
For some busses like i2c it is non-sense and we don't want it.
- Set the resource limits for pnp devices resources.
- Improve the resource size detection for pnp devices.
- Added a configuration register to amd8111_ide.c so we can enable/disable individual ide channels
- Added a header file to hold the prototype of isa_dma_init
- Fixed most of the superio chips so the should work now, the via superio pci device is the exception.
- The code compiles and runs so it is time for me to go to bed.
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1698 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/devices/pnp_device.c')
-rw-r--r-- | src/devices/pnp_device.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/devices/pnp_device.c b/src/devices/pnp_device.c index 70286ad7ac..cde571f561 100644 --- a/src/devices/pnp_device.c +++ b/src/devices/pnp_device.c @@ -132,7 +132,7 @@ struct device_operations pnp_ops = { static void pnp_get_ioresource(device_t dev, unsigned index, struct io_info *info) { struct resource *resource; - uint32_t size; + unsigned moving, gran, step; resource = new_resource(dev, index); @@ -140,11 +140,32 @@ static void pnp_get_ioresource(device_t dev, unsigned index, struct io_info *inf resource->limit = 0xffff; resource->flags |= IORESOURCE_IO; + /* Get the resource size */ + moving = info->mask; + gran = 15; + step = 1 << gran; + /* Find the first bit that moves */ + while((moving & step) == 0) { + gran--; + step >>= 1; + } + /* Now find the first bit that does not move */ + while((moving & step) != 0) { + gran--; + step >>= 1; + } + /* Of the moving bits the last bit in the first group, + * tells us the size of this resource. + */ + if ((moving & step) == 0) { + gran++; + step <<= 1; + } /* Set the resource size and alignment */ - size = (0xffff & info->mask); - resource->size = (~(size | 0xfffff800) + 1); - resource->align = log2(resource->size); - resource->gran = resource->align; + resource->gran = gran; + resource->align = gran; + resource->limit = info->mask | (step - 1); + resource->size = 1 << gran; } static void get_resources(device_t dev, struct pnp_info *info) |