summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRudolf Marek <r.marek@assembler.cz>2008-02-18 20:32:46 +0000
committerRudolf Marek <r.marek@assembler.cz>2008-02-18 20:32:46 +0000
commit623df6763cb344fdac0f94b089743a1888e62cee (patch)
treed5a5d4ffcd199ad5320d90cf43c8b69c42236fc2
parentb34eea348cb7d6d9c93d17d51a1f322114b8f15d (diff)
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> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3104 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r--src/devices/pnp_device.c21
1 files changed, 18 insertions, 3 deletions
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)