From bb8d00d8f74ebb0d2358386fed90ee68cb98d9b3 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Sun, 6 Jun 2021 19:20:48 +0200 Subject: [PATCH] device/pnp: Always provide `pnp_unset_and_set_config` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `pnp_unset_and_set_config` function was only available when building with `ENV_PNP_SIMPLE_DEVICE` set. Add the complementary definition using device pointers, for the sake of completeness. Change-Id: I2a21e635f41f3f786057500fa96a2b3116e30d76 Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/55255 Tested-by: build bot (Jenkins) Reviewed-by: Máté Kukri Reviewed-by: Nico Huber Reviewed-by: Michael Niewöhner --- src/device/pnp_device.c | 9 +++++++++ src/include/device/pnp.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/device/pnp_device.c b/src/device/pnp_device.c index 259d449752..699007d9ba 100644 --- a/src/device/pnp_device.c +++ b/src/device/pnp_device.c @@ -47,6 +47,15 @@ u8 pnp_read_config(struct device *dev, u8 reg) return inb(dev->path.pnp.port + 1); } +void pnp_unset_and_set_config(struct device *dev, u8 reg, u8 unset, u8 set) +{ + outb(reg, dev->path.pnp.port); + u8 value = inb(dev->path.pnp.port + 1); + value &= ~unset; + value |= set; + outb(value, dev->path.pnp.port + 1); +} + void pnp_set_logical_device(struct device *dev) { pnp_write_config(dev, 0x07, dev->path.pnp.device & 0xff); diff --git a/src/include/device/pnp.h b/src/include/device/pnp.h index 955eac29ac..770a640963 100644 --- a/src/include/device/pnp.h +++ b/src/include/device/pnp.h @@ -13,6 +13,7 @@ /* Primitive PNP resource manipulation */ void pnp_write_config(struct device *dev, u8 reg, u8 value); u8 pnp_read_config(struct device *dev, u8 reg); +void pnp_unset_and_set_config(struct device *dev, u8 reg, u8 unset, u8 set); void pnp_set_logical_device(struct device *dev); void pnp_set_enable(struct device *dev, int enable); int pnp_read_enable(struct device *dev);