Subject: bug of arch/i386/i386/machdep.c?
To: None <current-users@netbsd.org>
From: Araki Ken <j00v0113@ip.media.kyoto-u.ac.jp>
List: current-users
Date: 02/07/2001 00:24:05
        Hi.

        I use NetBSD 1.5R(2001/02/03 current) on Dynabook SS3330(Celeron 333 Mem 64MB).
        
        If I start such applications as dd if=/dev/zero of=file , startx ,
        /usr/local/mozilla/mozilla ... , then following kernel messages is shown
        and then my machine is frozen.

---
pciide0:0:0: lost interrupt
        type: ata tc_bcount: 8192 tc_skip: 0
pciide0:0:0: bus-master DMA error: status=0x22
pciide0:0:0: bus-master DMA error: missing interrupt, status=0x22
wd0: transfer error, downgrading to Ultra-DMA mode 1
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 1 (using DMA data transfers)
wd0e: DMA error reading fsbn 19856 of 19856-19871 (wd0 bn 1112276; cn 1177 tn 0 sn 11), retrying
pciide0:0:0: lost interrupt
        type: ata tc_bcount: 8192 tc_skip: 0
pciide0:0:0: bus-master DMA error: status=0x22
pciide0:0:0: bus-master DMA error: missing interrupt, status=0x22
wd0: transfer error, downgrading to DMA mode 2
wd0(pciide0:0:0): using PIO mode 4, DMA mode 2 (using DMA data transfers)
wd0e: DMA error reading fsbn 19856 of 19856-19871 (wd0 bn 1112276; cn 1177 tn 0 sn 11), retrying
pciide0:0:0: lost interrupt
        type: ata tc_bcount: 8192 tc_skip: 0
pciide0:0:0: bus-master DMA error: status=0x22
pciide0:0:0: bus-master DMA error: missing interrupt, status=0x22
wd0: transfer error, downgrading to PIO mode 4
wd0(pciide0:0:0): using PIO mode 4
wd0e: DMA error reading fsbn 19856 of 19856-19871 (wd0 bn 1112276; cn 1177 tn 0 sn 11), retrying
wd0: soft error (corrected)
---

        When I used 1.5E , such problems never happended.

        Then , I check memory size of dmesg , and find differnce between 1.5E and
        1.5R like this:

        1.5E:
        total memory = 65020 KB
        avail memory = 58820 KB

        1.5R:
        total memory = 65036 KB
        avail memory = 58836 KB

        Following is the dmesg when I define DEBUG_MEMLOAD in arch/i386/i386/machdep.c
        
        addr 0x0        size 0x9fc00   type 0x1
        addr 0x9fc00    size 0x400     type 0x2
        addr 0xe8000    size 0x4000    type 0x1 (*)
        addr 0xf0000    size 0x10000   type 0x2
        addr 0x100000   size 0x3ee0000 type 0x1
        addr 0x3fe0000  size 0x10000   type 0x3
        addr 0x3ff0000  size 0x10000   type 0x2
        addr 0x100a0000 size 0x16e00   type 0x2
        addr 0x100b6e00 size 0x200     type 0x4
        addr 0x100b7000 size 0x49000   type 0x2
        addr 0xfff80000 size 0x80000   type 0x2

        I doubt if (*) is illegal. So , I tried this patch for arch/i386/i386/machdep.c:
---- 
*** machdep.c.orig      Mon Jan 22 11:01:37 2001
--- machdep.c   Tue Feb  6 23:56:43 2001
***************
*** 1860,1865 ****
--- 1860,1870 ----
                        default:
                                continue;
                        }
+                       if( bim->entry[x].addr == 0xe8000)
+                       {
+                               printf( "skipping ...\n") ;
+                               continue ;
+                       }
  
                        /*
                         * Sanity check the entry.
---- 
        
        I avoid the problem by this patch.

        In addition , the problem can also be avoided by this "fall back to former
        code" patch.
---
*** sys/arch/i386/i386/machdep.c.orig   Mon Jan 22 11:01:37 2001
--- sys/arch/i386/i386/machdep.c        Mon Jan 22 11:58:43 2001
***************
*** 1837,1842 ****
--- 1837,1843 ----
         * to us by the boot program.
         */
        bim = lookup_bootinfo(BTINFO_MEMMAP);
+ #if 0
        if (bim != NULL && bim->num > 0) {
  #if DEBUG_MEMLOAD
                printf("BIOS MEMORY MAP (%d ENTRIES):\n", bim->num);
***************
*** 1933,1939 ****
                        mem_cluster_cnt++;
                }
        }
! 
        /*
         * If the loop above didn't find any valid segment, fall back to
         * former code.
--- 1934,1940 ----
                        mem_cluster_cnt++;
                }
        }
! #endif
        /*
         * If the loop above didn't find any valid segment, fall back to
         * former code.
---

        But I have so poor knowledge of PC that I don't know why these patches works
        and why address 0xe8000 size 0x400 type BIM_Memory memory cause the problem.

        Anybody gives me hints of the reason or explains how to fix fundamentally ?

        If this problem has already fixed , sorry.

-- 
kiken
j00v0113@ip.media.kyoto-u.ac.jp

--- dmesg of normal 1.5R
NetBSD 1.5R (KEN) #25: Wed Feb  7 00:06:01 JST 2001
    ken@ms-r09:/usr/src/sys/arch/i386/compile/KEN
cpu0: Intel Celeron (Mendocino) (686-class), 333.28 MHz
cpu0: I-cache 16K 32b/line 4-way, D-cache 16K 32b/line 2/4-way
cpu0: L2 cache 128K 32b/line 4-way
cpu0: features 183f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR>
cpu0: features 183f9ff<PGE,MCA,CMOV,FGPAT,PSE36,MMX,FXSR>
total memory = 65036 KB
avail memory = 58836 KB
using 838 buffers containing 3352 KB of memory
BIOS32 rev. 0 found at 0xfc395
mainbus0 (root)
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled
pchb0 at pci0 dev 0 function 0
pchb0: vendor 0x8086 product 0x7192 (rev. 0x03)
vga0 at pci0 dev 4 function 0: vendor 0x10c8 product 0x0005 (rev. 0x12)
wsdisplay0 at vga0: console (80x25, vt100 emulation)
pcib0 at pci0 dev 5 function 0
pcib0: vendor 0x8086 product 0x7110 (rev. 0x02)
pciide0 at pci0 dev 5 function 1: Intel 82371AB IDE controller (PIIX4) (rev. 0x01)
pciide0: bus-master DMA support present
pciide0: primary channel wired to compatibility mode
wd0 at pciide0 channel 0 drive 0: <TOSHIBA MK4309MAT>
wd0: drive supports 16-sector PIO transfers, LBA addressing
wd0: 4126 MB, 8944 cyl, 15 head, 63 sec, 512 bytes/sect x 8452080 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
pciide0: primary channel interrupting at irq 14
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (Ultra/33) (using DMA data transfers)
pciide0: secondary channel wired to compatibility mode
pciide0: disabling secondary channel (no drives)
vendor 0x8086 product 0x7112 (USB serial bus, revision 0x01) at pci0 dev 5 function 2 not configured
vendor 0x8086 product 0x7113 (miscellaneous bridge, revision 0x02) at pci0 dev 5 function 3 not configured
vendor 0x1179 product 0x0701 (miscellaneous communications, revision 0x23) at pci0 dev 9 function 0 not configured
vendor 0x1179 product 0x060f (CardBus bridge, revision 0x05) at pci0 dev 11 function 0 not configured
vendor 0x1179 product 0x060f (CardBus bridge, revision 0x05) at pci0 dev 11 function 1 not configured
esm0 at pci0 dev 12 function 0: vendor 0x125d product 0x1978 (rev. 0x10)
esm0: interrupting at irq 11
esm0: Asahi Kasei AK4540 codec; no 3D stereo
audio0 at esm0: full duplex, mmap, independent
isa0 at pcib0
pckbc0 at isa0 port 0x60-0x64
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
opms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
pcppi0 at isa0 port 0x61
sysbeep0 at pcppi0
npx0 at isa0 port 0xf0-0xff: using exception 16
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
pcic0 at isa0 port 0x3e0-0x3e1 iomem 0xd0000-0xdffff
pcic0: controller 0 (Intel 82365SL Revision 1) has sockets A and B
pcic0: controller 1 (Intel 82365SL Revision 1) has no sockets
pcmcia0 at pcic0 controller 0 socket 0
pcmcia1 at pcic0 controller 0 socket 1
apm0 at mainbus0: Power Management spec V1.2
biomask e7fd netmask e7fd ttymask f7ff
pcic0: controller 0 detecting irqs with mask 0xdeb8:..3..4..5..7..10..15
pcic0: polling for socket events
boot device: wd0
root on wd0a dumps on wd0b

--- dmesg of machdep.c patched 1.5R
NetBSD 1.5R (KEN) #24: Tue Feb  6 23:38:46 JST 2001
    ken@ms-r09:/usr/src/sys/arch/i386/compile/KEN
cpu0: Intel Celeron (Mendocino) (686-class), 333.29 MHz
cpu0: I-cache 16K 32b/line 4-way, D-cache 16K 32b/line 2/4-way
cpu0: L2 cache 128K 32b/line 4-way
cpu0: features 183f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR>
cpu0: features 183f9ff<PGE,MCA,CMOV,FGPAT,PSE36,MMX,FXSR>
total memory = 65020 KB
avail memory = 58820 KB
using 838 buffers containing 3352 KB of memory
BIOS32 rev. 0 found at 0xfc395
mainbus0 (root)
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled
pchb0 at pci0 dev 0 function 0
pchb0: vendor 0x8086 product 0x7192 (rev. 0x03)
vga0 at pci0 dev 4 function 0: vendor 0x10c8 product 0x0005 (rev. 0x12)
wsdisplay0 at vga0: console (80x25, vt100 emulation)
pcib0 at pci0 dev 5 function 0
pcib0: vendor 0x8086 product 0x7110 (rev. 0x02)
pciide0 at pci0 dev 5 function 1: Intel 82371AB IDE controller (PIIX4) (rev. 0x01)
pciide0: bus-master DMA support present
pciide0: primary channel wired to compatibility mode
wd0 at pciide0 channel 0 drive 0: <TOSHIBA MK4309MAT>
wd0: drive supports 16-sector PIO transfers, LBA addressing
wd0: 4126 MB, 8944 cyl, 15 head, 63 sec, 512 bytes/sect x 8452080 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
pciide0: primary channel interrupting at irq 14
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (Ultra/33) (using DMA data transfers)
pciide0: secondary channel wired to compatibility mode
pciide0: disabling secondary channel (no drives)
vendor 0x8086 product 0x7112 (USB serial bus, revision 0x01) at pci0 dev 5 function 2 not configured
vendor 0x8086 product 0x7113 (miscellaneous bridge, revision 0x02) at pci0 dev 5 function 3 not configured
vendor 0x1179 product 0x0701 (miscellaneous communications, revision 0x23) at pci0 dev 9 function 0 not configured
vendor 0x1179 product 0x060f (CardBus bridge, revision 0x05) at pci0 dev 11 function 0 not configured
vendor 0x1179 product 0x060f (CardBus bridge, revision 0x05) at pci0 dev 11 function 1 not configured
esm0 at pci0 dev 12 function 0: vendor 0x125d product 0x1978 (rev. 0x10)
esm0: interrupting at irq 11
esm0: esm_read_codec() RW_DONE timed out.
esm0: will perform cold reset.
esm0: Asahi Kasei AK4540 codec; no 3D stereo
audio0 at esm0: full duplex, mmap, independent
isa0 at pcib0
pckbc0 at isa0 port 0x60-0x64
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
opms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
pcppi0 at isa0 port 0x61
sysbeep0 at pcppi0
npx0 at isa0 port 0xf0-0xff: using exception 16
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
pcic0 at isa0 port 0x3e0-0x3e1 iomem 0xd0000-0xdffff
pcic0: controller 0 (Intel 82365SL Revision 1) has sockets A and B
pcic0: controller 1 (Intel 82365SL Revision 1) has no sockets
pcmcia0 at pcic0 controller 0 socket 0
pcmcia1 at pcic0 controller 0 socket 1
apm0 at mainbus0: Power Management spec V1.2
biomask e7fd netmask e7fd ttymask f7ff
pcic0: controller 0 detecting irqs with mask 0xdeb8:..3..4..5..7..10..15
pcic0: polling for socket events
boot device: wd0
root on wd0a dumps on wd0b