apu1c led driver
Larry Baird
lab at gta.com
Tue May 6 16:28:37 UTC 2014
>> Generally rather than specifying the physical addresses as constants in
>> the device driver, the address space and/or IO port resources are
>> managed by the driver for the bus the device sits on. For something
>> like LEDs and GPIOs that aren't self-identifying devices on a bus and
>> aren't described by ACPI or other system-provided metadata, the 'hints'
>> mechanism gives you a way to provide the resource metadata
>> in /boot/loader.conf.
>>
>> The device.hints(5) manpage has some helpful info. Typically you need
>> to provide an 'at' hint to say which bus the device is on. I'm not sure
>> what's right for your LED/GPIO device; I've only ever used at=isa. For
>> your device, it looks like you also need maddr/msize hints, then
>> bus_alloc_resource_any() with an rid of 0 and a type of MEMORY should
>> get you a bus_space handle for hardware access.
>
> ISA devices can hardcode ports this way, but this is written as a PCI driver,
> so it isn't going to work. Larry, you can try changing your driver to be
> an ISA driver by changing the second arg to DRIVER_MODULE() from 'pci' to
> 'isa'. Is there a way you can probe something or check a BIOS string to
> detect this driver? If so, you should auto-create a device from an identify
> routine (then you don't need any hints). Your probe routine should fail for
> ISA devices with a PNP ID so you don't attach to random things like serial
> ports, etc.
Switching to using an identify routine simplifies things a lot. Thank
you for the hint.
Larry
--
------------------------------------------------------------------------
Larry Baird
Global Technology Associates, Inc. 1992-2012 | http://www.gta.com
Celebrating Twenty Years of Software Innovation | Orlando, FL
Email: lab at gta.com | TEL 407-380-0220
More information about the freebsd-hackers
mailing list