Subject: problem w/ nvidia-sata on amd64
To: None <current-users@netbsd.org>
From: Kurt Schreiner <ks@ub.uni-mainz.de>
List: current-users
Date: 08/09/2007 17:25:03
Hi,

I decided to upgrade my Sun Ultra40 from 4.99.1 to -current of today.
Booting a GENERIC-based (drives for hardware not available taken out)
kernel failed unable to map sata registers.
Replacing sys/dev/pci/viaide.c with rev 1.34 so removing SATA native
registers support added in rev 1.35 yields a booting kernel.

With some debug printf's added I see the following:

viaide1 at pci0 dev 7 function 0
viaide1: NVIDIA nForce4 Serial ATA Controller (rev. 0xf3)
PCI configuration registers:
  Common header:
    0x00: 0x005510de 0x00b00005 0x010185f3 0x00000000

    Vendor Name: NVIDIA (0x10de)
    Device Name: nForce4 Serial ATA 2 (0x0055)
    Command register: 0x0005
      I/O space accesses: on
      Memory space accesses: off
      Bus mastering: on
      Special cycles: off
      MWI transactions: off
      Palette snooping: off
      Parity error checking: off
      Address/data stepping: off
      System error (SERR): off
      Fast back-to-back transactions: off
      Interrupt disable: off
    Status register: 0x00b0
      Capability List support: on
      66 MHz capable: on
      User Definable Features (UDF) support: off
      Fast back-to-back capable: on
      Data parity error detected: off
      DEVSEL timing: fast (0x0)
      Slave signaled Target Abort: off
      Master received Target Abort: off
      Master received Master Abort: off
      Asserted System Error (SERR): off
      Parity error detected: off
    Class Name: mass storage (0x01)
    Subclass Name: IDE (0x01)
    Interface: 0x85
    Revision ID: 0xf3
    BIST: 0x00
    Header Type: 0x00 (0x00)
    Latency Timer: 0x00
    Cache Line Size: 0x00

  Type 0 ("normal" device) header:
    0x10: 0x00001c41 0x00001c35 0x00001c39 0x00001c31
    0x20: 0x00001c11 0xb0003000 0x00000000 0x534a108e
    0x30: 0x00000000 0x00000044 0x00000000 0x0103010b

    Base address register at 0x10
      type: 32-bit i/o
      base: 0x00001c40, size: 0x00000008
    Base address register at 0x14
      type: 32-bit i/o
      base: 0x00001c34, size: 0x00000004
    Base address register at 0x18
      type: 32-bit i/o
      base: 0x00001c38, size: 0x00000008
    Base address register at 0x1c
      type: 32-bit i/o
      base: 0x00001c30, size: 0x00000004
    Base address register at 0x20
      type: 32-bit i/o
      base: 0x00001c10, size: 0x00000010
    Base address register at 0x24
      type: 32-bit nonprefetchable memory
      base: 0xb0003000, size: 0x00001000
    Cardbus CIS Pointer: 0x00000000
    Subsystem vendor ID: 0x108e
    Subsystem ID: 0x534a
    Expansion ROM Base Address: 0x00000000
    Capability list pointer: 0x44
    Reserved @ 0x38: 0x00000000
    Maximum Latency: 0x01
    Minimum Grant: 0x03
    Interrupt pin: 0x01 (pin A)
    Interrupt line: 0x0b

  Capability register at 0x44
    type: 0x01 (Power Management, rev. 1.0)

  Device-dependent header:
    0x40: 0x534a108e 0x00020001 0x00000000 0x00000000
    0x50: 0x15000013 0x00000000 0x00000000 0x00000000
    0x60: 0x00000000 0x00000c51 0x42060f08 0x00000000
    0x70: 0x40c4782c 0x00001001 0x00001001 0x00200020
    0x80: 0xc0000000 0x00032c2c 0x36660000 0x00032c2c
    0x90: 0x36660000 0x00000000 0x10060006 0x01010000
    0xa0: 0x7c000150 0x00000000 0x00000000 0x02aabb23
    0xb0: 0x0084cc05 0x00000000 0x00000000 0x00000000
    0xc0: 0x00000000 0x00000000 0x000a000a 0xa8020008
    0xd0: 0x5602000a 0x00000042 0x00000000 0x87e00000
    0xe0: 0xbc02000a 0x00000042 0x00000000 0xe7e00000
    0xf0: 0x00000000 0x00000000 0xffffff02 0x07300604

    Don't know how to pretty-print device-dependent header.

*** via_sata_chip_map: 32bit at 0x24=0xb0003000
*** via_sata_chip_map: maptype=0x0
+++ pci_mapreg_map: PCI_FLAGS_MEM_ENABLED: flags=0x1
*** via_sata_chip_map: PCI_MAPREG_TYPE_MEM failed
*** via_sata_chip_map: maptype=0x0, flags=0x1
viaide1: bus-master DMA support present
viaide1: primary channel wired to native-PCI mode
LSI1: Picked IRQ 23 with weight 0
viaide1: using ioapic0 pin 23 (irq 11) for native-PCI interrupt
atabus2 at viaide1 channel 0
viaide1: secondary channel wired to native-PCI mode
atabus3 at viaide1 channel 1
viaide2 at pci0 dev 8 function 0
viaide2: NVIDIA nForce4 Serial ATA Controller (rev. 0xf3)
*** via_sata_chip_map: 32bit at 0x24=0xb0004000
*** via_sata_chip_map: maptype=0x0
*** via_sata_chip_map: maptype=0x0, flags=0x3
viaide2: bus-master DMA support present
viaide2: primary channel wired to native-PCI mode
LTID: Picked IRQ 20 with weight 1
viaide2: using ioapic0 pin 20 (irq 10) for native-PCI interrupt
atabus4 at viaide2 channel 0
viaide2: secondary channel wired to native-PCI mode
atabus5 at viaide2 channel 1

This says: in via_sata_chip_map maptype=0x0, ie, MEM or ROM, but
pci_mapreg_map fails because pa->pa_flags=0x1 = PCI_FLAGS_IO_ENABLED
but _not_ PCI_FLAGS_MEM_ENABLED (=0x02)

viaide{2,3,4} are ok, main diffence from pci register dump:
	Memory space accesses: on

So where's the culprit? Hardware initialized wrong by the BIOS (newest
version installed yesterday) or maybe a problem with the driver?
(Solaris 10 and ubuntu 6.06 have no problems finding the disks...)
I can provide more info if needed, try patches etcpp...

Kurt