Port-amiga archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Work on PCI support :-)



Hi!

On May 30, 2011, at 1:45 PM, Frank Wille wrote:
> Unfortunately I cannot help you much with your catalog of questions in
> your previous posting.
You're already helping a lot! :-)

I've moved a bit forward, to the point where pm2fb is even trying to attach. 
Unfortunately, I've encountered a non-trivial problem with bus_space_map, or 
rather, the way it is used on amiga. 

In p5pb driver I created a bus_space_tag for a PCI memory area like this:

        sc->pci_mem_area.base = (bus_addr_t) zbusmap(
                (void *) 0xe0000000, 0x02000000);
        sc->pci_mem_area.absm = &amiga_bus_stride_1;

This is area is mapped into KVA at 0x268a000, all seems to be cool at this 
point. The tag is passed on to MI code.

During pm2fb attachment, PCI MI code tries to map memory regions using 
information acquired from BARs. Permedia 2 registers are located at PA 
0xe1000000, 128kB wide. PCI MI code (pci_mapreg_submap in pci_map.c) calls 
bus_space_map like this:

        bus_space_map(pci_mem_area, 0xe1000000, 20000 0);

Where pci_mem_area is the exact same tag I created earlier in p5pb. That's no 
good, because pci_mem_area is already pointing to 0x268a000, which is mapped PA 
0xe0000000. So, if I understand correctly, any read or write using handle 
created by this bus_space_map is hitting 0x268a000 + 0xe1000000, which leads to 
a MMU fault.

In all amiga drivers I've seen, the second argument to bus_space_map was always 
an offset (from base specified in MD bus_space_tag). 

p5pb0 at zbus0 pa 0xfffe0000 man/pro 8512/101
nextkva: 0x268a000, want pa 0xfffa0000, size 266240, avail 84221952
nextkva: 0x468a000, want pa 0xe0000000, size 33554432, avail 84221952
mapped fffa0000 -> 2649000, e0000000 -> 268a000
pci0 at p5pb0 bus 0
pm2fb0 at pci0 dev 0 function 0: PCI configuration registers:

  Common header:
    0x00: 0x3d07104c 0x02800007 0x03800001 0x00000000

    Vendor Name: Texas Instruments (0x104c)
    Device Name: TVP4020 Permedia 2 (0x3d07)
    Command register: 0x0007
      I/O space accesses: on
      Memory space accesses: on
      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: 0x0280
      Interrupt status: inactive
      Capability List support: off
      66 MHz capable: off
      User Definable Features (UDF) support: off
      Fast back-to-back capable: on
      Data parity error detected: off
      DEVSEL timing: medium (0x1)
      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: display (0x03)
    Subclass Name: miscellaneous (0x80)
    Interface: 0x00
    Revision ID: 0x01
    BIST: 0x00
    Header Type: 0x00 (0x00)
    Latency Timer: 0x00
    Cache Line Size: 0x00

  Type 0 ("normal" device) header:
    0x10: 0xe1000000 0xe0000000 0xe0800000 0x00000000
    0x20: 0x00000000 0x00000000 0x00000000 0xe4e4e4e4
    0x30: 0xffff0001 0x00000000 0x00000000 0xc0c00100

    Base address register at 0x10
      type: 32-bit nonprefetchable memory
      base: 0xe1000000, size: 0x00020000
    Base address register at 0x14
      type: 32-bit nonprefetchable memory
      base: 0xe0000000, size: 0x00800000
    Base address register at 0x18
      type: 32-bit nonprefetchable memory
      base: 0xe0800000, size: 0x00800000
    Base address register at 0x1c
      not implemented(?)
    Base address register at 0x20
      not implemented(?)
    Base address register at 0x24
      not implemented(?)
    Cardbus CIS Pointer: 0x00000000
    Subsystem vendor ID: 0xe4e4
    Subsystem ID: 0xe4e4
    Expansion ROM Base Address: 0xffff0001
    Reserved @ 0x34: 0x00000000
    Reserved @ 0x38: 0x00000000
    Maximum Latency: 0xc0
    Minimum Grant: 0xc0
    Interrupt pin: 0x01 (pin A)
    Interrupt line: 0x00

  Device-dependent header:
    0x40: 0x00000000 0x00000000 0x00000000 0x00000000
    0x50: 0x00000000 0x00000000 0x00000000 0x00000000
    0x60: 0x00000000 0x00000000 0x00000000 0x00000000
    0x70: 0x00000000 0x00000000 0x00000000 0x00000000
    0x80: 0x00000000 0x00000000 0x00000000 0x00000000
    0x90: 0x00000000 0x00000000 0x00000000 0x00000000
    0xa0: 0x00000000 0x00000000 0x00000000 0x00000000
    0xb0: 0x00000000 0x00000000 0x00000000 0x00000000
    0xc0: 0x00000000 0x00000000 0x00000000 0x00000000
    0xd0: 0x00000000 0x00000000 0x00000000 0x00000000
    0xe0: 0x00000000 0x00000000 0x00000000 0x00000000
    0xf0: 0x00000000 0x00000000 0x00000000 0x00000000

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

Texas Instruments TVP4020 Permedia 2 (miscellaneous display, revision 0x01) at 
? dev 0 function 0 (intrswiz 0, intrpin 0x1, i/o off, mem on, no quirks): Texas 
Instruments TVP4020 Permedia 2
doing bus_space_map in PCI MI: tag 0xfbdda0c (tag->base: 268a000) base e1000000 
maxsize 20000 busflags 0
pm2fb0: 8 MB aperture at 0xe0000000
uvm_fault(0x1abc40, 0xe368a000, 0x1) -> 0xe
  type 8, code [mmu,,ssw]: 1051000
trap type 8, code = 1051000, v = e368a018
pid = 0, lid = 1, pc = 0000FC62, ps = 2708, sfc = 1, dfc = 1
Registers:
             0        1        2        3        4        5        6        7
dreg: 00000000 0EAC2700 00000008 E0000000 0FBEB230 0FBEADA0 0FBEADCC 00000000
areg: E368A000 00000018 0FBEAC30 0FBEAC30 0FBEAC50 000D44D0 002217DC 1DFFFFFC

Kernel stack (0022165C):
22165C: 000FD47C 00221788 00000080 0018BA30 00000008 01051000 E368A018 0000000E
22167C: 002216F8 000FD8FE 00000008 01051000 E368A018 00221788 00000008 E368A018
22169C: 01051000 00000000 00000000 00000000 0019E310 0019DB80 00221788 0021E000
2216BC: 00000000 00000000 001AF4D0 00000001 00000000 00000000 00000000 00000001
2216DC: 00000000 00000000 00000008 00000000 00000000 00000000 00000000 00221770
2216FC: 000FDC78 00000008 01051000 E368A018 00221788 0019DB80 00000000 00000000
22171C: 00000008 E0000000 0FBEB230 0FBEADA0 0FBEADCC 0FBEAC30 0FBEAC30 0FBEAC50
22173C: 000D44D0 00000001 00000000 00000000 00000000 00000000 00000000 00000000
22175C: 00000008 00000000 00000000 00000000 00000000 002217DC 00002060 00221788
22177C: 00000008 01051000 E368A018 00000000 0EAC2700 00000008 E0000000 0FBEB230
22179C: 0FBEADA0 0FBEADCC 00000000 E368A000 00000018 0FBEAC30 0FBEAC30 0FBEAC50
2217BC: 000D44D0 002217DC 1DFFFFFC 00000000 27080000 FC624008 E368A018 01051000
2217DC: 002217F0 000AE0FA E368A000 00000018 000AE0DA 0022193C 000AEEB0 0FBEAC30
2217FC: 0FBDDE1C 0FBDDE00 002219E4 FFFFFFE3 02800007 00199BC4 0015FB74 00000000
22181C: 0FBEB230 54657861 7320496E 73747275 6D656E74 73205456 50343032 30205065
22183C: 726D6564 69612032 000A9D82 54657861 7320496E 73747275 6D656E74 73205456
panic: MMU fault
Stopped in pid 0.1 (system) at  netbsd:cpu_Debugger+0x6:        unlk    a6

--
Best regards,
Radosław Kujawa



Home | Main Index | Thread Index | Old Index