Re: cvs commit: src/sys/pci amdpm.c

From: Ruslan Ermilov <ru_at_freebsd.org>
Date: Sun, 18 Dec 2005 10:20:02 +0200
On Sat, Dec 17, 2005 at 08:48:36AM +0300, Artemiev Igor wrote:
> > i2c-amd8111.c and i2c-nforce2.c are indeed very similar, because they
> > both use SMBus 2.0 API.  :-)
> ...
> > See how the offset 0x2 register means completely different things.
> Yep. Sorry for this little diversion :-((
> I wrote new driver, nfpm, which completely based on linux`s i2c-
> nforce2 driver. Can you review it?
> http://stalker.bmc.brk.ru/~ai/patches/nfpm.c
> 
You took lm_sensors sources too literally, without accounting for
FreeBSD details.  In FreeBSD (dumb, but it's too late to change
that now), the slave 6-bit addresses are expected by smbus(4)
methods already shifted, (addr << 1).  My incomplete (but enough
for xmbmon to work) version is attached and appears to work,
according to the debugging output from the driver, but I eihter
don't have any recognizable sensors on either of SMBusses I have
available for testing, or something is very odd about it.  It also
supports AMD-8111 SMBus 2.0 controller.

Note that I don't call bus_set_resource() in my driver.  In my
case (nVidia nForce3 Pro150 and AMD-8111 SMBus 2.0), the I/O port
resources have already been allocated,

nfpm0 pnpinfo vendor=0x10de device=0x00d4 subvendor=0x1043 subdevice=0x80c5 class=0x0c0500 at slot=1 function=1 handle=\_SB_.PCI0.SMBS
    I/O ports:
	0x5000-0x503f
	0x5040-0x507f

so bus_set_resource() were effectively trying to add 0x5000-...
and 0x5040-... ranges again, and that causes problems for
bus_alloc_resource_any() later.

There's also an accompanying one-line patch for dev/smbus/smbus.c
that adds:

DRIVER_MODULE(smbus, nfpm, smbus_driver, smbus_devclass, 0, 0);


Cheers,
-- 
Ruslan Ermilov
ru_at_FreeBSD.org
FreeBSD committer

Received on Sun Dec 18 2005 - 07:23:04 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:49 UTC