Author: ruik Date: 2008-02-18 21:32:46 +0100 (Mon, 18 Feb 2008) New Revision: 3104
Modified: trunk/coreboot-v2/src/devices/pnp_device.c Log: Some SIO/PNP devices are abusing register 0x30 for multiple LDN enables, like mine W83627EHF.
This patch introduces a concept of virtual LDN. Each virtual LDN is unique, but maps to original LDN and bit position in register 0x30.
VirtualLDN = origLDN[7:0] | bitpos[10:8]
Signed-off-by: Rudolf Marek r.marek@assembler.cz Acked-by: Stefan Reinauer stepan@coresystems.de
Modified: trunk/coreboot-v2/src/devices/pnp_device.c =================================================================== --- trunk/coreboot-v2/src/devices/pnp_device.c 2008-02-15 18:16:06 UTC (rev 3103) +++ trunk/coreboot-v2/src/devices/pnp_device.c 2008-02-18 20:32:46 UTC (rev 3104) @@ -46,17 +46,32 @@
void pnp_set_logical_device(device_t dev) { - pnp_write_config(dev, 0x07, dev->path.u.pnp.device); + pnp_write_config(dev, 0x07, dev->path.u.pnp.device & 0xff); }
void pnp_set_enable(device_t dev, int enable) { - pnp_write_config(dev, 0x30, enable?0x1:0x0); + u8 tmp, bitpos; + + tmp = pnp_read_config(dev, 0x30); + /* handle the virtual devices, which share same LDN register */ + bitpos = (dev->path.u.pnp.device >> 8) & 0x7; + + if (enable) { + tmp |= (1 << bitpos); + } else { + tmp &= ~(1 << bitpos); + } + pnp_write_config(dev, 0x30, tmp); }
int pnp_read_enable(device_t dev) { - return !!pnp_read_config(dev, 0x30); + u8 tmp, bitpos; + tmp = pnp_read_config(dev, 0x30); + /* handle the virtual devices, which share same LDN register */ + bitpos = (dev->path.u.pnp.device >> 8) & 0x7; + return !!(tmp & bitpos); }
void pnp_set_iobase(device_t dev, unsigned index, unsigned iobase)