On Mon, 18 Feb 2008, svn@coreboot.org wrote:
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);
Hmm, shouldn't the last line test the bit at *position* bitpos:
+ return !!(tmp & (1 << bitpos));
/ulf