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
This commit is contained in:
Rudolf Marek 2008-02-18 20:32:46 +00:00
parent b34eea348c
commit 623df6763c
1 changed files with 18 additions and 3 deletions

View File

@ -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)