Patch for PNP BIOS hang

Ed Maste emaste at phaedrus.sandvine.ca
Mon Jan 3 06:57:26 PST 2005


A colleague of mine reported on a hang during boot on a SuperMicro board
(with ACPI off):

http://lists.freebsd.org/pipermail/freebsd-current/2004-March/023045.html

with some more analysis:

http://lists.freebsd.org/pipermail/freebsd-current/2004-July/030827.html

as it turns out it doesn't actually always hang, it usually takes 30-45
minutes to boot.  The problem comes from the PNP0c01 entry in the PNP
BIOS, and specifically the entry:

PNP0c01: adding fixed memory32 range 0xfff80000-0xffffffff, size=0x80000

In isa/isa_common.c:isa_find_memory() there's a for loop that looks for
space for the memory block:

                for (start = config->ic_mem[i].ir_start,
                             end = config->ic_mem[i].ir_end,
                             align = config->ic_mem[i].ir_align;
                     start + size - 1 <= end;
                     start += align) {

For some reason the attempt to use the given memory region fails.  After
adding align to start, start + size - 1 wraps and the <= end test remains
true.

The following patch gets this board booting for me:

--- isa_common.c@@/main/sandvine_bsd_5_main/0   2005-01-02 15:39:24.000000000 -0500
+++ isa_common.c        2005-01-02 23:59:06.000000000 -0500
@@ -149,7 +149,7 @@
                for (start = config->ic_mem[i].ir_start,
                             end = config->ic_mem[i].ir_end,
                             align = config->ic_mem[i].ir_align;
-                    start + size - 1 <= end;
+                    start + size - 1 <= end && start + size > start;
                     start += align) {
                        bus_set_resource(child, SYS_RES_MEMORY, i,
                                         start, size);



More information about the freebsd-stable mailing list