Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37741 )
Change subject: device/pnp: introduce and use PNP_SKIP_FUNCTION ......................................................................
device/pnp: introduce and use PNP_SKIP_FUNCTION
-1 shouldn't be assigned to an unsigned variable, so use an otherwise unused constant here. Since 7 is the highest virtual LDN number, using 0xffff as PNP_SKIP_FUNCTION marker has no unwanted side effects.
Change-Id: I5e31e7ef9dad5fedfd5552963c298336c533a5e9 Signed-off-by: Felix Held felix-coreboot@felixheld.de --- M src/device/pnp_device.c M src/include/device/pnp.h M src/superio/smsc/smscsuperio/superio.c 3 files changed, 6 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/41/37741/1
diff --git a/src/device/pnp_device.c b/src/device/pnp_device.c index 28a45d0..1852fc1 100644 --- a/src/device/pnp_device.c +++ b/src/device/pnp_device.c @@ -370,7 +370,7 @@ /* Setup the ops and resources on the newly allocated devices. */ for (i = 0; i < functions; i++) { /* Skip logical devices this Super I/O doesn't have. */ - if (info[i].function == -1) + if (info[i].function == PNP_SKIP_FUNCTION) continue;
path.pnp.device = info[i].function; diff --git a/src/include/device/pnp.h b/src/include/device/pnp.h index a3222d2..d459fd2 100644 --- a/src/include/device/pnp.h +++ b/src/include/device/pnp.h @@ -34,6 +34,7 @@
struct pnp_info { struct device_operations *ops; /* LDN-specific ops override */ +#define PNP_SKIP_FUNCTION 0xffff u16 function; /* Must be at least 16 bits (virtual LDNs)! */ unsigned int flags; #define PNP_IO0 0x000001 diff --git a/src/superio/smsc/smscsuperio/superio.c b/src/superio/smsc/smscsuperio/superio.c index aa5af38..0e86683 100644 --- a/src/superio/smsc/smscsuperio/superio.c +++ b/src/superio/smsc/smscsuperio/superio.c @@ -280,7 +280,10 @@ */ for (j = 0; j < ARRAY_SIZE(pnp_dev_info); j++) { fn = pnp_dev_info[j].function; - pnp_dev_info[j].function = logical_device_table[i].devs[fn]; + if (logical_device_table[i].devs[fn] != -1) + pnp_dev_info[j].function = logical_device_table[i].devs[fn]; + else + pnp_dev_info[j].function = PNP_SKIP_FUNCTION; }
/* Enable the specified devices (if present on the chip). */
Felix Held has uploaded a new patch set (#2). ( https://review.coreboot.org/c/coreboot/+/37741 )
Change subject: device/pnp: introduce and use PNP_SKIP_FUNCTION ......................................................................
device/pnp: introduce and use PNP_SKIP_FUNCTION
-1 shouldn't be assigned to an unsigned variable, so use an otherwise unused constant here. Since 7 is the highest virtual LDN number, using 0xffff as PNP_SKIP_FUNCTION marker has no unwanted side effects.
Change-Id: I5e31e7ef9dad5fedfd5552963c298336c533a5e9 Signed-off-by: Felix Held felix-coreboot@felixheld.de --- M src/device/pnp_device.c M src/include/device/pnp.h M src/superio/smsc/smscsuperio/superio.c 3 files changed, 6 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/41/37741/2
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37741 )
Change subject: device/pnp: introduce and use PNP_SKIP_FUNCTION ......................................................................
Patch Set 2: Code-Review+2
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/37741 )
Change subject: device/pnp: introduce and use PNP_SKIP_FUNCTION ......................................................................
device/pnp: introduce and use PNP_SKIP_FUNCTION
-1 shouldn't be assigned to an unsigned variable, so use an otherwise unused constant here. Since 7 is the highest virtual LDN number, using 0xffff as PNP_SKIP_FUNCTION marker has no unwanted side effects.
Change-Id: I5e31e7ef9dad5fedfd5552963c298336c533a5e9 Signed-off-by: Felix Held felix-coreboot@felixheld.de Reviewed-on: https://review.coreboot.org/c/coreboot/+/37741 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Patrick Rudolph siro@das-labor.org --- M src/device/pnp_device.c M src/include/device/pnp.h M src/superio/smsc/smscsuperio/superio.c 3 files changed, 6 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Patrick Rudolph: Looks good to me, approved
diff --git a/src/device/pnp_device.c b/src/device/pnp_device.c index 28a45d0..1852fc1 100644 --- a/src/device/pnp_device.c +++ b/src/device/pnp_device.c @@ -370,7 +370,7 @@ /* Setup the ops and resources on the newly allocated devices. */ for (i = 0; i < functions; i++) { /* Skip logical devices this Super I/O doesn't have. */ - if (info[i].function == -1) + if (info[i].function == PNP_SKIP_FUNCTION) continue;
path.pnp.device = info[i].function; diff --git a/src/include/device/pnp.h b/src/include/device/pnp.h index 69a06674..fde4c9d 100644 --- a/src/include/device/pnp.h +++ b/src/include/device/pnp.h @@ -34,6 +34,7 @@
struct pnp_info { struct device_operations *ops; /* LDN-specific ops override */ +#define PNP_SKIP_FUNCTION 0xffff unsigned int function; /* Must be at least 16 bits (virtual LDNs)! */ unsigned int flags; #define PNP_IO0 0x000001 diff --git a/src/superio/smsc/smscsuperio/superio.c b/src/superio/smsc/smscsuperio/superio.c index aa5af38..0e86683 100644 --- a/src/superio/smsc/smscsuperio/superio.c +++ b/src/superio/smsc/smscsuperio/superio.c @@ -280,7 +280,10 @@ */ for (j = 0; j < ARRAY_SIZE(pnp_dev_info); j++) { fn = pnp_dev_info[j].function; - pnp_dev_info[j].function = logical_device_table[i].devs[fn]; + if (logical_device_table[i].devs[fn] != -1) + pnp_dev_info[j].function = logical_device_table[i].devs[fn]; + else + pnp_dev_info[j].function = PNP_SKIP_FUNCTION; }
/* Enable the specified devices (if present on the chip). */