From ce9d8640b1cf14419783d839afc0c53184c70bbf Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Wed, 19 Aug 2009 19:12:39 +0000 Subject: Add an error message if there is a zero-sized fixed resource. Fix the existing example of one. Signed-off-by: Myles Watson Acked-by: Patrick Georgi git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4557 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/devices/device.c | 6 +++++- src/devices/pci_device.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/devices/device.c b/src/devices/device.c index c0852f2fd3..58c247f212 100644 --- a/src/devices/device.c +++ b/src/devices/device.c @@ -556,8 +556,12 @@ static void constrain_resources(struct device *dev, struct constraints* limits) /* Constrain limits based on the fixed resources of this device. */ for (i = 0; i < dev->resources; i++) { res = &dev->resource[i]; - if (!res->size) + if (!res->size) { + /* It makes no sense to have 0-sized, fixed resources.*/ + printk_err("skipping %s@%lx fixed resource, size=0!\n", + dev_path(dev), res->index); continue; + } if (!(res->flags & IORESOURCE_FIXED)) continue; diff --git a/src/devices/pci_device.c b/src/devices/pci_device.c index 7c8a758116..c872b01c38 100644 --- a/src/devices/pci_device.c +++ b/src/devices/pci_device.c @@ -332,6 +332,8 @@ static void pci_get_rom_resource(struct device *dev, unsigned long index) * inited by driver_pci_onboard_ops::enable_dev() */ if ((dev->on_mainboard) && (dev->rom_address != 0)) { resource->base = dev->rom_address; + /* The resource allocator needs the size to be non-zero. */ + resource->size = 0x100; resource->flags |= IORESOURCE_MEM | IORESOURCE_READONLY | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; } -- cgit v1.2.3