When allocating resources in the following cases:

- trying for a fit for a PnP configuration from a device
 - soaking up resources from a configuration that were not allocated by
   the driver

do not attempt to activate them.  Only a device driver that is aware of
the nature of the resource and its suitability can be certain that
activating a resource, particularly a memory resource, is a safe thing
to do.

This was prompted by the discovery that many systems report all physical
memory through a PNP0c02 device; activating this resource maps all
physical memory into the kernel's virtual space, either blowing out the
kernel pagetable or in the worst case causing a panic in pmap_mapdev()
if the system has too much physical memory.

Authorised by:	jkh
Reviewed by:	dfr
This commit is contained in:
msmith 2000-02-11 04:35:07 +00:00
parent c67195ab17
commit 59c87d6c95

View File

@ -141,7 +141,7 @@ isa_find_memory(device_t child,
start, size);
res[i] = bus_alloc_resource(child,
SYS_RES_MEMORY, &i,
0, ~0, 1, RF_ACTIVE);
0, ~0, 1, 0 /* !RF_ACTIVE */);
if (res[i]) {
result->ic_mem[i].ir_start = start;
result->ic_mem[i].ir_end = start + size - 1;
@ -205,7 +205,7 @@ isa_find_port(device_t child,
start, size);
res[i] = bus_alloc_resource(child,
SYS_RES_IOPORT, &i,
0, ~0, 1, RF_ACTIVE);
0, ~0, 1, 0 /* !RF_ACTIVE */);
if (res[i]) {
result->ic_port[i].ir_start = start;
result->ic_port[i].ir_end = start + size - 1;
@ -290,7 +290,7 @@ isa_find_irq(device_t child,
irq, 1);
res[i] = bus_alloc_resource(child,
SYS_RES_IRQ, &i,
0, ~0, 1, RF_ACTIVE);
0, ~0, 1, 0 /* !RF_ACTIVE */ );
if (res[i]) {
result->ic_irqmask[i] = (1 << irq);
break;
@ -349,7 +349,7 @@ isa_find_drq(device_t child,
drq, 1);
res[i] = bus_alloc_resource(child,
SYS_RES_DRQ, &i,
0, ~0, 1, RF_ACTIVE);
0, ~0, 1, 0 /* !RF_ACTIVE */);
if (res[i]) {
result->ic_drqmask[i] = (1 << drq);
break;
@ -826,7 +826,7 @@ isa_driver_added(device_t dev, driver_t *driver)
rle->type,
&rid,
0, ~0, 1,
RF_ACTIVE);
0 /* !RF_ACTIVE */);
}
}
}