From 623df6763cb344fdac0f94b089743a1888e62cee Mon Sep 17 00:00:00 2001 From: Rudolf Marek Date: Mon, 18 Feb 2008 20:32:46 +0000 Subject: 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 Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3104 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/devices/pnp_device.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/devices') diff --git a/src/devices/pnp_device.c b/src/devices/pnp_device.c index b5d8f9716f..ee7c1018d7 100644 --- a/src/devices/pnp_device.c +++ b/src/devices/pnp_device.c @@ -46,17 +46,32 @@ uint8_t pnp_read_config(device_t dev, uint8_t reg) 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) -- cgit v1.2.3