src/{device,include}: Use PNP_IDX_EN instead of magic number

Change-Id: I68590605e261ecaace9f3cea28cfa6ec3b913a8a
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44835
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
Elyes HAOUAS 2020-08-26 19:52:40 +02:00 committed by Felix Held
parent 475978875d
commit 79a3de16a1
2 changed files with 7 additions and 5 deletions

View File

@ -5,6 +5,7 @@
#include <arch/io.h> #include <arch/io.h>
#include <device/device.h> #include <device/device.h>
#include <device/pnp.h> #include <device/pnp.h>
#include <device/pnp_def.h>
/* PNP config mode wrappers */ /* PNP config mode wrappers */
@ -56,7 +57,7 @@ void pnp_set_enable(struct device *dev, int enable)
{ {
u8 tmp, bitpos; u8 tmp, bitpos;
tmp = pnp_read_config(dev, 0x30); tmp = pnp_read_config(dev, PNP_IDX_EN);
/* Handle virtual devices, which share the same LDN register. */ /* Handle virtual devices, which share the same LDN register. */
bitpos = (dev->path.pnp.device >> 8) & 0x7; bitpos = (dev->path.pnp.device >> 8) & 0x7;
@ -66,14 +67,14 @@ void pnp_set_enable(struct device *dev, int enable)
else else
tmp &= ~(1 << bitpos); tmp &= ~(1 << bitpos);
pnp_write_config(dev, 0x30, tmp); pnp_write_config(dev, PNP_IDX_EN, tmp);
} }
int pnp_read_enable(struct device *dev) int pnp_read_enable(struct device *dev)
{ {
u8 tmp, bitpos; u8 tmp, bitpos;
tmp = pnp_read_config(dev, 0x30); tmp = pnp_read_config(dev, PNP_IDX_EN);
/* Handle virtual devices, which share the same LDN register. */ /* Handle virtual devices, which share the same LDN register. */
bitpos = (dev->path.pnp.device >> 8) & 0x7; bitpos = (dev->path.pnp.device >> 8) & 0x7;

View File

@ -6,6 +6,7 @@
#include <stdint.h> #include <stdint.h>
#include <arch/io.h> #include <arch/io.h>
#include <device/pnp.h> #include <device/pnp.h>
#include <device/pnp_def.h>
#include <device/pnp_type.h> #include <device/pnp_type.h>
#if ENV_PNP_SIMPLE_DEVICE #if ENV_PNP_SIMPLE_DEVICE
@ -32,13 +33,13 @@ void pnp_set_logical_device(pnp_devfn_t dev)
static __always_inline static __always_inline
void pnp_set_enable(pnp_devfn_t dev, int enable) void pnp_set_enable(pnp_devfn_t dev, int enable)
{ {
pnp_write_config(dev, 0x30, enable?0x1:0x0); pnp_write_config(dev, PNP_IDX_EN, enable?0x1:0x0);
} }
static __always_inline static __always_inline
int pnp_read_enable(pnp_devfn_t dev) int pnp_read_enable(pnp_devfn_t dev)
{ {
return !!pnp_read_config(dev, 0x30); return !!pnp_read_config(dev, PNP_IDX_EN);
} }
static __always_inline static __always_inline