[coreboot] r3104 - trunk/coreboot-v2/src/devices

Ulf Jordan jordan at chalmers.se
Mon Feb 18 22:41:58 CET 2008


On Mon, 18 Feb 2008, svn at 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




More information about the coreboot mailing list