Subject: Re: com_cardbus.c
To: Johan Danielsson <joda@pdc.kth.se>
From: Chris G. Demetriou <cgd@netbsd.org>
List: current-users
Date: 04/17/2000 08:39:47
joda@pdc.kth.se (Johan Danielsson) writes:
> Yes, but isn't this exactly how matching devices is supposed to work?
> Any other driver that think it has a better chance of handling a
> device can easily take command (by returning > 1).

uh, no.  you're not supposed to return non-zero unless you "know" (as
certainly as you can determine) that you can drive the device.

there's little you can do about false matches when a device indicates
that it behaves a certain way, but then is buggy.

however, in this case, you were assuming all devices will work that
way, without anything to back that assumption up.

your new match based on the CIS seems like it's a better idea.


> I would say that
> it's a 99% chance that a communications/serial device is infact 16x50
> compatible.

I have at least one counterexample, for PCI (not CardBus), that's
16x50-compatible sure but which might easily have problems passing
your BAR check.  (the first thing obviously isn't a CIS region, since
it's a PCI card...  it's the region used to access the PLX 9050 bridge
on the card.)

i've seen weirder ones, too, but i don't think i saved their dmesg
outputs.  8-)


cgd
-- 
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.
--
vendor 0x131f product 0x1000 (serial communications, interface 0x02, revision 0x02) at pci0 dev 11 function 0: PCI configuration registers:
  Common header:
    0x00: 0x1000131f 0x02800000 0x07000202 0x00000008

    Vendor ID: 0x131f
    Device ID: 0x1000
    Command register: 0x0000
      I/O space accesses: off
      Memory space accesses: off
      Bus mastering: off
      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
    Status register: 0x0280
      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: communications (0x07)
    Subclass Name: serial (0x00)
    Interface: 0x02
    Revision ID: 0x02
    BIST: 0x00
    Header Type: 0x00 (0x00)
    Latency Timer: 0x00
    Cache Line Size: 0x08

  Type 0 header:
    0x10: 0xfdfffc00 0x00000000 0x0000ecc9 0x00000000
    0x20: 0x00000000 0x00000000 0x00000000 0x00000000
    0x30: 0x00000000 0x00000000 0x00000000 0x0000010b

    Mapping register at 0x10: 32-bit noncacheable memory
      base address: 0xfdfffc00, size: 0x00000080
    Mapping register at 0x14: not implemented(?)
    Mapping register at 0x18: i/o
      base address: 0x0000ecc8, size: 0x00000008
    Mapping register at 0x1c: not implemented(?)
    Mapping register at 0x20: not implemented(?)
    Mapping register at 0x24: not implemented(?)
    Cardbus CIS Pointer: 0x00000000
    Subsystem vendor ID: 0x0000
    Subsystem ID: 0x0000
    Expansion ROM Base Address: 0x00000000
    Reserved @ 0x34: 0x00000000
    Reserved @ 0x38: 0x00000000
    Maximum Latency: 0x00
    Minimum Grant: 0x00
    Interrupt pin: 0x01 (pin A)
    Interrupt line: 0x0b

  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.

vendor 0x131f product 0x1000 (serial communications, interface 0x02, revision 0x02) at pci0 dev 11 function 0 not configured