From 62c0276f94ca7a02f802df2611c8c567fbcfa809 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Mon, 28 Dec 2015 23:04:47 +1100 Subject: device/pnp: Ability to set vendor specific logical device config According to the PNP ISA v1.0a spec, config registers in the range of 0xf0 up to 0xfe are vendor defined and may be used for any purpose. Config register 0xff is reserved and is defined as such. Currently, only vendor specific registers 0xf0, 0xf1, 0xf4, and 0xfa are able to be set using the PNP_MSCx bit flag masks. This patch adds support for all 15 vendor specific config registers, and updates the existing superio pnp_info to use them where appropriate. Change-Id: Id43b85f74e3192b17dbd7e54c4c6136a2e59ad55 Signed-off-by: Damien Zammit Reviewed-on: https://review.coreboot.org/12808 Tested-by: build bot (Jenkins) Reviewed-by: Alexandru Gagniuc --- src/device/pnp_device.c | 59 +++++++++++++++++++++++++++++++++++++-- src/include/device/pnp.h | 37 +++++++++++++++--------- src/include/device/pnp_def.h | 14 +++++++++- src/superio/ite/it8772f/superio.c | 2 +- 4 files changed, 95 insertions(+), 17 deletions(-) diff --git a/src/device/pnp_device.c b/src/device/pnp_device.c index 7971aec5ba..a04469b4b8 100644 --- a/src/device/pnp_device.c +++ b/src/device/pnp_device.c @@ -296,13 +296,68 @@ static void get_resources(device_t dev, struct pnp_info *info) resource->size = 1; resource->flags |= IORESOURCE_IRQ; } + if (info->flags & PNP_MSC2) { + resource = new_resource(dev, PNP_IDX_MSC2); + resource->size = 1; + resource->flags |= IORESOURCE_IRQ; + } + if (info->flags & PNP_MSC3) { + resource = new_resource(dev, PNP_IDX_MSC3); + resource->size = 1; + resource->flags |= IORESOURCE_IRQ; + } if (info->flags & PNP_MSC4) { resource = new_resource(dev, PNP_IDX_MSC4); resource->size = 1; resource->flags |= IORESOURCE_IRQ; } - if (info->flags & PNP_MSC10) { - resource = new_resource(dev, PNP_IDX_MSC10); + if (info->flags & PNP_MSC5) { + resource = new_resource(dev, PNP_IDX_MSC5); + resource->size = 1; + resource->flags |= IORESOURCE_IRQ; + } + if (info->flags & PNP_MSC6) { + resource = new_resource(dev, PNP_IDX_MSC6); + resource->size = 1; + resource->flags |= IORESOURCE_IRQ; + } + if (info->flags & PNP_MSC7) { + resource = new_resource(dev, PNP_IDX_MSC7); + resource->size = 1; + resource->flags |= IORESOURCE_IRQ; + } + if (info->flags & PNP_MSC8) { + resource = new_resource(dev, PNP_IDX_MSC8); + resource->size = 1; + resource->flags |= IORESOURCE_IRQ; + } + if (info->flags & PNP_MSC9) { + resource = new_resource(dev, PNP_IDX_MSC9); + resource->size = 1; + resource->flags |= IORESOURCE_IRQ; + } + if (info->flags & PNP_MSCA) { + resource = new_resource(dev, PNP_IDX_MSCA); + resource->size = 1; + resource->flags |= IORESOURCE_IRQ; + } + if (info->flags & PNP_MSCB) { + resource = new_resource(dev, PNP_IDX_MSCB); + resource->size = 1; + resource->flags |= IORESOURCE_IRQ; + } + if (info->flags & PNP_MSCC) { + resource = new_resource(dev, PNP_IDX_MSCC); + resource->size = 1; + resource->flags |= IORESOURCE_IRQ; + } + if (info->flags & PNP_MSCD) { + resource = new_resource(dev, PNP_IDX_MSCD); + resource->size = 1; + resource->flags |= IORESOURCE_IRQ; + } + if (info->flags & PNP_MSCE) { + resource = new_resource(dev, PNP_IDX_MSCE); resource->size = 1; resource->flags |= IORESOURCE_IRQ; } diff --git a/src/include/device/pnp.h b/src/include/device/pnp.h index 29df77de20..cfed7c708d 100644 --- a/src/include/device/pnp.h +++ b/src/include/device/pnp.h @@ -38,19 +38,30 @@ struct pnp_info { struct device_operations *ops; unsigned int function; /* Must be at least 16 bits (virtual LDNs)! */ unsigned int flags; -#define PNP_IO0 0x001 -#define PNP_IO1 0x002 -#define PNP_IO2 0x004 -#define PNP_IO3 0x008 -#define PNP_IRQ0 0x010 -#define PNP_IRQ1 0x020 -#define PNP_DRQ0 0x040 -#define PNP_DRQ1 0x080 -#define PNP_EN 0x100 -#define PNP_MSC0 0x200 -#define PNP_MSC1 0x400 -#define PNP_MSC4 0x800 -#define PNP_MSC10 0x1000 +#define PNP_IO0 0x000001 +#define PNP_IO1 0x000002 +#define PNP_IO2 0x000004 +#define PNP_IO3 0x000008 +#define PNP_IRQ0 0x000010 +#define PNP_IRQ1 0x000020 +#define PNP_DRQ0 0x000040 +#define PNP_DRQ1 0x000080 +#define PNP_EN 0x000100 +#define PNP_MSC0 0x000200 +#define PNP_MSC1 0x000400 +#define PNP_MSC2 0x000800 +#define PNP_MSC3 0x001000 +#define PNP_MSC4 0x002000 +#define PNP_MSC5 0x004000 +#define PNP_MSC6 0x008000 +#define PNP_MSC7 0x010000 +#define PNP_MSC8 0x020000 +#define PNP_MSC9 0x040000 +#define PNP_MSCA 0x080000 +#define PNP_MSCB 0x100000 +#define PNP_MSCC 0x200000 +#define PNP_MSCD 0x400000 +#define PNP_MSCE 0x800000 struct io_info io0, io1, io2, io3; }; struct resource *pnp_get_resource(device_t dev, unsigned index); diff --git a/src/include/device/pnp_def.h b/src/include/device/pnp_def.h index bbc39fd13d..7701d842f2 100644 --- a/src/include/device/pnp_def.h +++ b/src/include/device/pnp_def.h @@ -12,7 +12,19 @@ #define PNP_IDX_DRQ1 0x75 #define PNP_IDX_MSC0 0xf0 #define PNP_IDX_MSC1 0xf1 +#define PNP_IDX_MSC2 0xf2 +#define PNP_IDX_MSC3 0xf3 #define PNP_IDX_MSC4 0xf4 -#define PNP_IDX_MSC10 0xfa +#define PNP_IDX_MSC5 0xf5 +#define PNP_IDX_MSC6 0xf6 +#define PNP_IDX_MSC7 0xf7 +#define PNP_IDX_MSC8 0xf8 +#define PNP_IDX_MSC9 0xf9 +#define PNP_IDX_MSCA 0xfa +#define PNP_IDX_MSCB 0xfb +#define PNP_IDX_MSCC 0xfc +#define PNP_IDX_MSCD 0xfd +#define PNP_IDX_MSCE 0xfe +#define PNP_IDX_RSVD 0xff #endif /* DEVICE_PNP_DEF_H */ diff --git a/src/superio/ite/it8772f/superio.c b/src/superio/ite/it8772f/superio.c index 6c6a503886..7079b1a829 100644 --- a/src/superio/ite/it8772f/superio.c +++ b/src/superio/ite/it8772f/superio.c @@ -222,7 +222,7 @@ static struct pnp_info pnp_dev_info[] = { { &ops, IT8772F_SP1, PNP_IO0 | PNP_IRQ0, {0x0ff8, 0}, }, /* Environmental Controller */ { &ops, IT8772F_EC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | - PNP_MSC4 | PNP_MSC10, + PNP_MSC4 | PNP_MSCA, {0x0ff8, 0}, {0x0ffc, 4}, }, /* KBC Keyboard */ { &ops, IT8772F_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, -- cgit v1.2.3