Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33033
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
[WIP] ssdtgen for PNP devices
Automatically create ACPI code for PNP devices.
TODO: Add HID to devicetree.
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A src/superio/common/chip.h A src/superio/common/ssdt.c A src/superio/common/ssdt.h 3 files changed, 386 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/1
diff --git a/src/superio/common/chip.h b/src/superio/common/chip.h new file mode 100644 index 0000000..2d75c0f --- /dev/null +++ b/src/superio/common/chip.h @@ -0,0 +1,26 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 9elements Agency GmbH patrick.rudolph@9elements.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __SUPERIO_COMMON_CHIP_H__ +#define __SUPERIO_COMMON_CHIP_H__ + +struct common_superio_ldn_config { + const char *acpi_name; + const char *dos_device_name; + const char *acpi_hid; +}; + +#endif /* __SUPERIO_COMMON_CHIP_H__ */ diff --git a/src/superio/common/ssdt.c b/src/superio/common/ssdt.c new file mode 100644 index 0000000..0e2c59f --- /dev/null +++ b/src/superio/common/ssdt.c @@ -0,0 +1,334 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 9elements Agency GmbH patrick.rudolph@9elements.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <superio/common/chip.h> +#include <superio/common/ssdt.h> + +#include <device/device.h> +#include <device/pnp.h> +#include <arch/acpigen.h> +#include <device/pnp_def.h> +#include <console/console.h> + +#define NUM_IO 4 +#define NUM_IRQ 2 + +struct superio_dev { + const char *acpi_hid; + u16 io_base[NUM_IO]; + u8 irq[NUM_IRQ]; +}; + +static const struct superio_dev superio_devs[] = { + {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, + {"PNP0303", {60, 64, }, {1, }}, + {"PNP0F03", {60, 64, }, {12, }}, + {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, + {"PNP0400", {0x378, }, {7, }}, +}; + +static const u8 io_idx[NUM_IO] = {PNP_IDX_IO0, PNP_IDX_IO1, PNP_IDX_IO2, + PNP_IDX_IO3}; +static const u8 irq_idx[NUM_IRQ] = {PNP_IDX_IRQ0, PNP_IDX_IRQ1}; + + +static void superio_base_fill_ssdt_generator(struct device *dev) +{ + const char *scope = acpi_device_scope(dev); + const char *name = acpi_device_name(dev); + + if (!scope || !name) { + printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); + return; + } + + /* Device */ + acpigen_write_scope(scope); + acpigen_write_device(name); + + printk(BIOS_DEBUG, "%s.%s: %s\n", scope, name, dev_path(dev)); + + acpigen_write_name_string("_HID", "PNP0C02"); + acpigen_write_name_string("_DDN", dev_name(dev)); + + /* OperationRegion("IOID", SYSTEMIO, port, 2) */ + struct opregion opreg = OPREGION("IOID", SYSTEMIO, + dev->path.pnp.port, 2); + acpigen_write_opregion(&opreg); + + struct fieldlist l[] = { + FIELDLIST_OFFSET(0), + FIELDLIST_NAMESTR("INDX", 8), + FIELDLIST_NAMESTR("DATA", 8), + }; + + /* Field (IOID, AnyAcc, NoLock, Preserve) + * { + * Offset (0), + * INDX, 8, + * DATA, 8, + * } */ + acpigen_write_field(opreg.name, l, ARRAY_SIZE(l), FIELD_BYTEACC | + FIELD_NOLOCK | FIELD_PRESERVE); + + struct fieldlist i[] = { + FIELDLIST_OFFSET(0x07), + FIELDLIST_NAMESTR("LDN", 8), + FIELDLIST_OFFSET(0x21), + FIELDLIST_NAMESTR("SCF1", 8), + FIELDLIST_NAMESTR("SCF2", 8), + FIELDLIST_NAMESTR("SCF3", 8), + FIELDLIST_NAMESTR("SCF4", 8), + FIELDLIST_NAMESTR("SCF5", 8), + FIELDLIST_NAMESTR("SCF6", 8), + FIELDLIST_NAMESTR("SCF7", 8), + FIELDLIST_OFFSET(0x29), + FIELDLIST_NAMESTR("CKCF", 8), + FIELDLIST_OFFSET(0x2F), + FIELDLIST_NAMESTR("SCFF", 8), + FIELDLIST_NAMESTR("ACTR", 8), + FIELDLIST_OFFSET(0x60), + FIELDLIST_NAMESTR("IOAH", 8), + FIELDLIST_NAMESTR("IOAL", 8), + FIELDLIST_NAMESTR("IOH2", 8), + FIELDLIST_NAMESTR("IOL2", 8), + FIELDLIST_OFFSET(0x70), + FIELDLIST_NAMESTR("INTR", 4), + FIELDLIST_NAMESTR("INTT", 4), + FIELDLIST_OFFSET (0x74), + FIELDLIST_NAMESTR("DMCH", 8), + FIELDLIST_OFFSET(0xE0), + FIELDLIST_NAMESTR("RGE0", 8), + FIELDLIST_NAMESTR("RGE1", 8), + FIELDLIST_NAMESTR("RGE2", 8), + FIELDLIST_NAMESTR("RGE3", 8), + FIELDLIST_NAMESTR("RGE4", 8), + FIELDLIST_NAMESTR("RGE5", 8), + FIELDLIST_NAMESTR("RGE6", 8), + FIELDLIST_NAMESTR("RGE7", 8), + FIELDLIST_NAMESTR("RGE8", 8), + FIELDLIST_NAMESTR("RGE9", 8), + FIELDLIST_NAMESTR("RGEA", 8), + FIELDLIST_OFFSET(0xF0), + FIELDLIST_NAMESTR("OPT0", 8), + FIELDLIST_NAMESTR("OPT1", 8), + FIELDLIST_NAMESTR("OPT2", 8), + FIELDLIST_NAMESTR("OPT3", 8), + FIELDLIST_NAMESTR("OPT4", 8), + FIELDLIST_NAMESTR("OPT5", 8), + FIELDLIST_NAMESTR("OPT6", 8), + FIELDLIST_NAMESTR("OPT7", 8), + FIELDLIST_NAMESTR("OPT8", 8), + FIELDLIST_NAMESTR("OPT9", 8), + }; + + acpigen_write_indexfield("INDX", "DATA", i, ARRAY_SIZE(i), + FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); + + acpigen_pop_len(); /* Device */ + acpigen_pop_len(); /* Scope */ +} + +static const char *superio_guess_hid(struct device *dev) +{ + for (size_t i = 0; i < ARRAY_SIZE(io_idx); i++) { + struct resource *res = probe_resource(dev, io_idx[i]); + if (!res || !res->base) + continue; + + for (size_t j = 0; j < ARRAY_SIZE(superio_devs); j++) { + for (size_t k = 0; k < NUM_IO; k++) { + if (!superio_devs[j].io_base[k]) + continue; + if (superio_devs[j].io_base[k] == res->base) + return superio_devs[j].acpi_hid; + } + } + } + for (size_t i = 0; i < ARRAY_SIZE(irq_idx); i++) { + struct resource *res = probe_resource(dev, irq_idx[i]); + if (!res || !res->size) + continue; + for (size_t j = 0; j < ARRAY_SIZE(superio_devs); j++) { + for (size_t k = 0; k < NUM_IRQ; k++) { + if (!superio_devs[j].irq[k]) + continue; + if (superio_devs[j].irq[k] == res->base) + return superio_devs[j].acpi_hid; + } + } + } + return NULL; +} + +static int ldn_resource_cnt(struct device *dev) +{ + int cnt = 0; + for (size_t i = 0; i < ARRAY_SIZE(io_idx); i++) { + struct resource *res = probe_resource(dev, io_idx[i]); + if (!res || !res->base) + continue; + cnt++; + } + for (size_t i = 0; i < NUM_IRQ; i++) { + struct resource *res = probe_resource(dev, irq_idx[i]); + if (!res || !res->size) + continue; + cnt++; + } + return cnt; +} + +/* Add IO and IRQ resources for _CRS or _PRS */ +static void ldn_gen_resources(struct device *dev) +{ + for (size_t i = 0; i < ARRAY_SIZE(io_idx); i++) { + struct resource *res = probe_resource(dev, io_idx[i]); + if (!res || !res->base) + continue; + resource_t base = res->base; + resource_t size = res->size; + while (size > 0) { + resource_t sz = size > 255 ? 255 : size; + acpigen_write_io16(base, base, 0, sz, 1); + size -= sz; + base += sz; + } + } + for (size_t i = 0; i < NUM_IRQ; i++) { + struct resource *res = probe_resource(dev, irq_idx[i]); + if (!res || !res->size) + continue; + acpigen_write_irq(res->base); + } +} + +/* Add resource base and size for additional SuperIO code */ +static void ldn_gen_resources_use(struct device *dev) +{ + char name[5]; + for (size_t i = 0; i < ARRAY_SIZE(io_idx); i++) { + struct resource *res = probe_resource(dev, io_idx[i]); + if (!res || !res->base || !res->size) + continue; + + snprintf(name, sizeof(name), "IO%XB", i); + name[4] = '\0'; + acpigen_write_name_integer(name, res->base); + + snprintf(name, sizeof(name), "IO%XS", i); + name[4] = '\0'; + acpigen_write_name_integer(name, res->size); + } +} + +static const char *ldn_acpi_name(const struct device *dev) +{ + u8 ldn = dev->path.pnp.device & 0xff; + u8 vldn = (dev->path.pnp.device >> 8) & 0x7; + static char name[5]; + + if (!vldn) + snprintf(name, sizeof(name), "LD%02X", ldn); + else + snprintf(name, sizeof(name), "VLD%X", vldn); + + name[4] = '\0'; + + return name; +} + + +void superio_common_fill_ssdt_generator(struct device *dev) +{ + struct common_superio_ldn_config *config = dev->chip_info; + const char *scope = acpi_device_path(dev); + const char *name = ldn_acpi_name(dev); + const char *hid = NULL; + const u8 ldn = dev->path.pnp.device & 0xff; + const u8 vldn = (dev->path.pnp.device >> 8) & 0x7; + bool has_resources; + + if (!scope || !name) { + printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); + return; + } + if (vldn) { + printk(BIOS_DEBUG, "%s: Ignoring virtual LDN\n", dev_path(dev)); + return; + } + + if (ldn == 0) + superio_base_fill_ssdt_generator(dev); + + printk(BIOS_DEBUG, "%s.%s: %s\n", scope, name, dev_path(dev)); + + /* Scope */ + acpigen_write_scope(scope); + + /* Device */ + acpigen_write_device(name); + + if (config && config->dos_device_name) + acpigen_write_name_string("_DDN", config->dos_device_name); + + acpigen_write_name_byte("_UID", 0); + acpigen_write_name_byte("LDN", ldn); + + acpigen_write_STA(dev->enabled ? 0xf : 0); + + if (!dev->enabled) { + acpigen_pop_len(); /* Device */ + acpigen_pop_len(); /* Scope */ + return; + } + + has_resources = ldn_resource_cnt(dev); + + /* Resources - _CRS */ + if (has_resources) { + acpigen_write_name("_CRS"); + acpigen_write_resourcetemplate_header(); + ldn_gen_resources(dev); + acpigen_write_resourcetemplate_footer(); + + /* Resources - _PRS */ + acpigen_write_name("_PRS"); + acpigen_write_resourcetemplate_header(); + ldn_gen_resources(dev); + acpigen_write_resourcetemplate_footer(); + + /* Resources base and size for 3rd party ACPI code */ + ldn_gen_resources_use(dev); + } + + if (config && config->acpi_hid) { + hid = config->acpi_hid; + } else { + printk(BIOS_WARNING, "%s: No HID set in devicetree\n", + dev_path(dev)); + + hid = superio_guess_hid(dev); + } + + if (hid) + acpigen_write_name_string("_HID", hid); + else + acpigen_write_name_string("_HID", "PNP0C02"); + + acpigen_pop_len(); /* Device */ + acpigen_pop_len(); /* Scope */ +} diff --git a/src/superio/common/ssdt.h b/src/superio/common/ssdt.h new file mode 100644 index 0000000..4d4e4b1 --- /dev/null +++ b/src/superio/common/ssdt.h @@ -0,0 +1,26 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 9elements Agency GmbH patrick.rudolph@9elements.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __SUPERIO_COMMON_SSDT_H__ +#define __SUPERIO_COMMON_SSDT_H__ + +#include <device/device.h> + +void superio_common_fill_ssdt_generator(struct device *dev); +const char *superio_common_acpi_name(const struct device *dev); +void superio_set_base_dev_ops(struct device *dev); + +#endif /* __SUPERIO_COMMON_SSDT_H__ */
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 1:
(9 comments)
https://review.coreboot.org/#/c/33033/1/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/1/src/superio/common/ssdt.c@36 PS1, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/1/src/superio/common/ssdt.c@37 PS1, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/1/src/superio/common/ssdt.c@38 PS1, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/1/src/superio/common/ssdt.c@39 PS1, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/1/src/superio/common/ssdt.c@40 PS1, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/1/src/superio/common/ssdt.c@54 PS1, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/1/src/superio/common/ssdt.c@111 PS1, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/1/src/superio/common/ssdt.c@139 PS1, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/1/src/superio/common/ssdt.c@266 PS1, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 2:
(9 comments)
https://review.coreboot.org/#/c/33033/2/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/2/src/superio/common/ssdt.c@36 PS2, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/2/src/superio/common/ssdt.c@37 PS2, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/2/src/superio/common/ssdt.c@38 PS2, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/2/src/superio/common/ssdt.c@39 PS2, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/2/src/superio/common/ssdt.c@40 PS2, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/2/src/superio/common/ssdt.c@54 PS2, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/2/src/superio/common/ssdt.c@111 PS2, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/2/src/superio/common/ssdt.c@139 PS2, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/2/src/superio/common/ssdt.c@266 PS2, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 3:
(9 comments)
https://review.coreboot.org/#/c/33033/3/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/3/src/superio/common/ssdt.c@36 PS3, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/3/src/superio/common/ssdt.c@37 PS3, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/3/src/superio/common/ssdt.c@38 PS3, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/3/src/superio/common/ssdt.c@39 PS3, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/3/src/superio/common/ssdt.c@40 PS3, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/3/src/superio/common/ssdt.c@54 PS3, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/3/src/superio/common/ssdt.c@111 PS3, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/3/src/superio/common/ssdt.c@139 PS3, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/3/src/superio/common/ssdt.c@266 PS3, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 4:
(9 comments)
https://review.coreboot.org/#/c/33033/4/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/4/src/superio/common/ssdt.c@36 PS4, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/4/src/superio/common/ssdt.c@37 PS4, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/4/src/superio/common/ssdt.c@38 PS4, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/4/src/superio/common/ssdt.c@39 PS4, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/4/src/superio/common/ssdt.c@40 PS4, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/4/src/superio/common/ssdt.c@54 PS4, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/4/src/superio/common/ssdt.c@111 PS4, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/4/src/superio/common/ssdt.c@139 PS4, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/4/src/superio/common/ssdt.c@266 PS4, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
Christian Walter has uploaded a new patch set (#5) to the change originally created by Patrick Rudolph. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
[WIP] ssdtgen for PNP devices
Automatically create ACPI code for PNP devices.
TODO: Add HID to devicetree.
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A src/superio/common/chip.h A src/superio/common/ssdt.c A src/superio/common/ssdt.h 3 files changed, 386 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/5
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 5:
(9 comments)
https://review.coreboot.org/#/c/33033/5/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/5/src/superio/common/ssdt.c@36 PS5, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/5/src/superio/common/ssdt.c@37 PS5, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/5/src/superio/common/ssdt.c@38 PS5, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/5/src/superio/common/ssdt.c@39 PS5, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/5/src/superio/common/ssdt.c@40 PS5, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/5/src/superio/common/ssdt.c@54 PS5, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/5/src/superio/common/ssdt.c@111 PS5, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/5/src/superio/common/ssdt.c@139 PS5, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/5/src/superio/common/ssdt.c@266 PS5, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 6:
(9 comments)
https://review.coreboot.org/#/c/33033/6/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/6/src/superio/common/ssdt.c@36 PS6, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/6/src/superio/common/ssdt.c@37 PS6, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/6/src/superio/common/ssdt.c@38 PS6, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/6/src/superio/common/ssdt.c@39 PS6, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/6/src/superio/common/ssdt.c@40 PS6, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/6/src/superio/common/ssdt.c@54 PS6, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/6/src/superio/common/ssdt.c@111 PS6, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/6/src/superio/common/ssdt.c@139 PS6, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/6/src/superio/common/ssdt.c@266 PS6, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 7:
(9 comments)
https://review.coreboot.org/#/c/33033/7/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/7/src/superio/common/ssdt.c@36 PS7, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/7/src/superio/common/ssdt.c@37 PS7, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/7/src/superio/common/ssdt.c@38 PS7, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/7/src/superio/common/ssdt.c@39 PS7, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/7/src/superio/common/ssdt.c@40 PS7, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/7/src/superio/common/ssdt.c@54 PS7, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/7/src/superio/common/ssdt.c@111 PS7, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/7/src/superio/common/ssdt.c@139 PS7, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/7/src/superio/common/ssdt.c@266 PS7, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 8:
(9 comments)
https://review.coreboot.org/#/c/33033/8/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/8/src/superio/common/ssdt.c@36 PS8, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/8/src/superio/common/ssdt.c@37 PS8, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/8/src/superio/common/ssdt.c@38 PS8, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/8/src/superio/common/ssdt.c@39 PS8, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/8/src/superio/common/ssdt.c@40 PS8, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/8/src/superio/common/ssdt.c@54 PS8, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/8/src/superio/common/ssdt.c@111 PS8, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/8/src/superio/common/ssdt.c@139 PS8, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/8/src/superio/common/ssdt.c@266 PS8, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 9:
(9 comments)
https://review.coreboot.org/#/c/33033/9/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/9/src/superio/common/ssdt.c@36 PS9, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/9/src/superio/common/ssdt.c@37 PS9, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/9/src/superio/common/ssdt.c@38 PS9, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/9/src/superio/common/ssdt.c@39 PS9, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/9/src/superio/common/ssdt.c@40 PS9, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/9/src/superio/common/ssdt.c@54 PS9, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/9/src/superio/common/ssdt.c@111 PS9, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/9/src/superio/common/ssdt.c@139 PS9, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/9/src/superio/common/ssdt.c@266 PS9, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 10:
(9 comments)
https://review.coreboot.org/#/c/33033/10/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/10/src/superio/common/ssdt.c@36 PS10, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/10/src/superio/common/ssdt.c@37 PS10, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/10/src/superio/common/ssdt.c@38 PS10, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/10/src/superio/common/ssdt.c@39 PS10, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/10/src/superio/common/ssdt.c@40 PS10, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/10/src/superio/common/ssdt.c@54 PS10, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/10/src/superio/common/ssdt.c@111 PS10, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/10/src/superio/common/ssdt.c@139 PS10, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/10/src/superio/common/ssdt.c@266 PS10, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 11:
(9 comments)
https://review.coreboot.org/#/c/33033/11/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/11/src/superio/common/ssdt.c@36 PS11, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/11/src/superio/common/ssdt.c@37 PS11, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/11/src/superio/common/ssdt.c@38 PS11, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/11/src/superio/common/ssdt.c@39 PS11, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/11/src/superio/common/ssdt.c@40 PS11, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/11/src/superio/common/ssdt.c@54 PS11, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/11/src/superio/common/ssdt.c@111 PS11, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/11/src/superio/common/ssdt.c@139 PS11, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/11/src/superio/common/ssdt.c@266 PS11, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 12:
(9 comments)
https://review.coreboot.org/#/c/33033/12/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/12/src/superio/common/ssdt.c@36 PS12, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/12/src/superio/common/ssdt.c@37 PS12, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/12/src/superio/common/ssdt.c@38 PS12, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/12/src/superio/common/ssdt.c@39 PS12, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/12/src/superio/common/ssdt.c@40 PS12, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/12/src/superio/common/ssdt.c@54 PS12, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/12/src/superio/common/ssdt.c@111 PS12, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/12/src/superio/common/ssdt.c@139 PS12, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/12/src/superio/common/ssdt.c@266 PS12, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 13:
(9 comments)
https://review.coreboot.org/#/c/33033/13/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/13/src/superio/common/ssdt.c@36 PS13, Line 36: {"PNP0700", {0x3f0, 0x3f2, 0x3f7}, {6, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/13/src/superio/common/ssdt.c@37 PS13, Line 37: {"PNP0303", {60, 64, }, {1, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/13/src/superio/common/ssdt.c@38 PS13, Line 38: {"PNP0F03", {60, 64, }, {12, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/13/src/superio/common/ssdt.c@39 PS13, Line 39: {"PNP0501", {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3}}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/13/src/superio/common/ssdt.c@40 PS13, Line 40: {"PNP0400", {0x378, }, {7, }}, space required after that close brace '}'
https://review.coreboot.org/#/c/33033/13/src/superio/common/ssdt.c@54 PS13, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
https://review.coreboot.org/#/c/33033/13/src/superio/common/ssdt.c@111 PS13, Line 111: FIELDLIST_OFFSET (0x74), space prohibited between function name and open parenthesis '('
https://review.coreboot.org/#/c/33033/13/src/superio/common/ssdt.c@139 PS13, Line 139: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
https://review.coreboot.org/#/c/33033/13/src/superio/common/ssdt.c@266 PS13, Line 266: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); line over 80 characters
Christian Walter has uploaded a new patch set (#14) to the change originally created by Patrick Rudolph. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
[WIP] ssdtgen for PNP devices
Automatically create ACPI code for PNP devices.
TODO: Add HID to devicetree.
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A src/superio/common/chip.h A src/superio/common/ssdt.c A src/superio/common/ssdt.h 3 files changed, 388 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/14
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 14:
(1 comment)
https://review.coreboot.org/#/c/33033/14/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/#/c/33033/14/src/superio/common/ssdt.c@140 PS14, Line 140: FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); line over 80 characters
Christian Walter has uploaded a new patch set (#15) to the change originally created by Patrick Rudolph. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
[WIP] ssdtgen for PNP devices
Automatically create ACPI code for PNP devices.
TODO: Add HID to devicetree.
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A src/superio/common/chip.h A src/superio/common/ssdt.c A src/superio/common/ssdt.h 3 files changed, 389 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/15
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 16:
(5 comments)
https://review.coreboot.org/c/coreboot/+/33033/16/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/c/coreboot/+/33033/16/src/superio/common/ssdt.c@... PS16, Line 17: include <superio/common/chip.h> : #include <superio/common/ssdt.h> : : #include <device/device.h> : #include <device/pnp.h> : #include <arch/acpigen.h> : #include <device/pnp_def.h> : #include <console/console.h> to sort
https://review.coreboot.org/c/coreboot/+/33033/16/src/superio/common/ssdt.c@... PS16, Line 25: missing include <types.h>
https://review.coreboot.org/c/coreboot/+/33033/16/src/superio/common/ssdt.c@... PS16, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", : dev_path(dev)); on one line ?
https://review.coreboot.org/c/coreboot/+/33033/16/src/superio/common/ssdt.c@... PS16, Line 69: struct opregion opreg = OPREGION("IOID", SYSTEMIO, : dev->path.pnp.port, 2); one line
https://review.coreboot.org/c/coreboot/+/33033/16/src/superio/common/ssdt.c@... PS16, Line 324: printk(BIOS_WARNING, "%s: No HID set in devicetree\n", : dev_path(dev)); one line
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 17:
is this patch ready for review? the title still says [WIP], but the patch is marked as ready for review
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: [WIP] ssdtgen for PNP devices ......................................................................
Patch Set 17:
Patch Set 17:
is this patch ready for review? the title still says [WIP], but the patch is marked as ready for review
It's both. I'm not sure if that's the way to go. 1) I though about patching sconfig to add ACPI HID identifiers to LDNs in the devicetree.cb, but we only care about "known" io ports, thus we can map "known" io ports to ACPI HID anywhere.
2) The current code places all LDNs under the parent, most times the PCI LPC bridge. I'd prefer to have all LDNs under a new "chip", the superio chip (that isn't a LDN). It would make the ACPI code generation easier, as it would never be disabled (as LDN0 can be), it would generate basic functions to access LDNs, acquire mutexes,...
3)to access the superio configuration it needs to know the port knocking sequence, but it's currently hardcoded and not stored in any LDN (struct device *).
Hello Felix Held, Christian Walter, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33033
to look at the new patch set (#18).
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
superio/common: Add ssdtgen for generic SuperIOs
Add a generic SuperIO ACPI generator, dropping the need to include additional code in DSDT for SuperIO.
It generates a device HID based on the decoded I/O range.
Tested on Supermicro X11SSH-TF using AST2400. The ssdt contains no errors and all devices are present.
Possible TODOs: * Add "enter config" and "exit config" bytes * Generate support methods to enter and exit config mode * Generate support methods to query, change or disable current resource settings on specific LDNs
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A Documentation/superio/common/ssdt.md M Documentation/superio/index.md A src/superio/common/chip.h A src/superio/common/generic.c A src/superio/common/ssdt.c A src/superio/common/ssdt.h 6 files changed, 496 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/18
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 18:
(3 comments)
https://review.coreboot.org/c/coreboot/+/33033/18/src/superio/common/generic... File src/superio/common/generic.c:
https://review.coreboot.org/c/coreboot/+/33033/18/src/superio/common/generic... PS18, Line 45: const char *scope = acpi_device_scope(dev); code indent should use tabs where possible
https://review.coreboot.org/c/coreboot/+/33033/18/src/superio/common/generic... PS18, Line 45: const char *scope = acpi_device_scope(dev); please, no spaces at the start of a line
https://review.coreboot.org/c/coreboot/+/33033/18/src/superio/common/generic... PS18, Line 133: acpigen_write_indexfield("INDX", "DATA", i, ARRAY_SIZE(i), FIELD_BYTEACC | FIELD_NOLOCK | line over 96 characters
Hello Felix Held, Christian Walter, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33033
to look at the new patch set (#19).
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
superio/common: Add ssdtgen for generic SuperIOs
Add a generic SuperIO ACPI generator, dropping the need to include additional code in DSDT for SuperIO.
It generates a device HID based on the decoded I/O range.
Tested on Supermicro X11SSH-TF using AST2400. The ssdt contains no errors and all devices are present.
Possible TODOs: * Add "enter config" and "exit config" bytes * Generate support methods to enter and exit config mode * Generate support methods to query, change or disable current resource settings on specific LDNs
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A Documentation/superio/common/ssdt.md M Documentation/superio/index.md A src/superio/common/chip.h A src/superio/common/generic.c A src/superio/common/ssdt.c A src/superio/common/ssdt.h 6 files changed, 496 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/19
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 19:
(1 comment)
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/ssdt.c@... PS19, Line 115: res->base) Needs to be (1 << res->base) I think.
Christoph Pomaska has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 19:
This commit breaks building with the IPMI_KCS option (tested on a modified config for Supermicro X10SLM+-F)
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 19:
Patch Set 19:
This commit breaks building with the IPMI_KCS option (tested on a modified config for Supermicro X10SLM+-F)
Works on x11ssh-tf with IPMI_KCS. Try to clean your build environment.
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 19:
(4 comments)
haven't really reviewed the actual acpi code generation yet, but i already have some comments for the rest
https://review.coreboot.org/c/coreboot/+/33033/19/Documentation/superio/comm... File Documentation/superio/common/ssdt.md:
https://review.coreboot.org/c/coreboot/+/33033/19/Documentation/superio/comm... PS19, Line 3: This page describes the common SSDT ACPI generator that can be found in maybe add here that it is for SIOs?
https://review.coreboot.org/c/coreboot/+/33033/19/Documentation/superio/comm... PS19, Line 29: mixed spaces and tabs here; please use one of those consistently
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/generic... File src/superio/common/generic.c:
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/generic... PS19, Line 29: res->flags |= IORESOURCE_STORED; the resource gets marked as stored, but isn't stored here. is this to this device being a dummy device or does this interfere with the actual SIO config space index device?
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/generic... PS19, Line 167: * coreboot's generic allocator doesn't expect them behind PnP devices. is it a good idea to make this device a pnp device and not a generic device that has to contain pnp devices? Just had a look and the chip_operations that would be for the whole SIO chip doesn't provide acpi table generation hook functionality, so I saw the reason for this workaround, but I still dislike this workaround. Would this be the only case where it might be useful to generate acpi code for chips additionally to devices?
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 19:
(2 comments)
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/generic... File src/superio/common/generic.c:
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/generic... PS19, Line 29: res->flags |= IORESOURCE_STORED;
the resource gets marked as stored, but isn't stored here. […]
it marks the SuperIO config port as used and then prints it in report_resource_stored(). As the SIO always decodes that range there's no need to touch the SIO config space.
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/generic... PS19, Line 167: * coreboot's generic allocator doesn't expect them behind PnP devices.
is it a good idea to make this device a pnp device and not a generic device that has to contain pnp […]
The reason why it is an pnp device is simple: it allows to store the config port in devicetree and it can be read using dev->path.pnp.port. The dev->path.pnp.port then will be used to generate the OperationRegion at the right offset in the ssdtgen on top.
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 19:
(2 comments)
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/generic... File src/superio/common/generic.c:
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/generic... PS19, Line 29: res->flags |= IORESOURCE_STORED;
it marks the SuperIO config port as used and then prints it in report_resource_stored(). […]
ok
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/generic... PS19, Line 167: * coreboot's generic allocator doesn't expect them behind PnP devices.
The reason why it is an pnp device is simple: it allows to store the config port in devicetree and i […]
ok, that makes sense
Hello Felix Held, Christian Walter, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33033
to look at the new patch set (#20).
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
superio/common: Add ssdtgen for generic SuperIOs
Add a generic SuperIO ACPI generator, dropping the need to include additional code in DSDT for SuperIO.
It generates a device HID based on the decoded I/O range.
Tested on Supermicro X11SSH-TF using AST2400. The ssdt contains no errors and all devices are present.
Possible TODOs: * Add "enter config" and "exit config" bytes * Generate support methods to enter and exit config mode * Generate support methods to query, change or disable current resource settings on specific LDNs
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A Documentation/superio/common/ssdt.md M Documentation/superio/index.md M src/arch/x86/include/arch/acpi.h A src/superio/common/chip.h A src/superio/common/generic.c A src/superio/common/ssdt.c A src/superio/common/ssdt.h 7 files changed, 541 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/20
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 20:
(1 comment)
https://review.coreboot.org/c/coreboot/+/33033/20/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/c/coreboot/+/33033/20/src/superio/common/ssdt.c@... PS20, Line 177: for (size_t i = 0; i< ARRAY_SIZE(lookup); i++) { spaces required around that '<' (ctx:VxW)
Hello Felix Held, Christian Walter, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33033
to look at the new patch set (#21).
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
superio/common: Add ssdtgen for generic SuperIOs
Add a generic SuperIO ACPI generator, dropping the need to include additional code in DSDT for SuperIO.
It generates a device HID based on the decoded I/O range.
Tested on Supermicro X11SSH-TF using AST2400. The ssdt contains no errors and all devices are present.
Possible TODOs: * Add "enter config" and "exit config" bytes * Generate support methods to enter and exit config mode * Generate support methods to query, change or disable current resource settings on specific LDNs
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A Documentation/superio/common/ssdt.md M Documentation/superio/index.md M src/arch/x86/include/arch/acpi.h A src/superio/common/chip.h A src/superio/common/generic.c A src/superio/common/ssdt.c A src/superio/common/ssdt.h 7 files changed, 541 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/21
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 21:
(1 comment)
https://review.coreboot.org/c/coreboot/+/33033/21/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/c/coreboot/+/33033/21/src/superio/common/ssdt.c@... PS21, Line 155: superio_common_get_dev_hid This won't link if your board has multiple SIO's and therefore multiple definitions of this function. Would extending pnp_info be an option?
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 21:
(3 comments)
I'll drop my devicetree entry structure related concerns for now; would be good to have some sort of comment on that line in the documentation. The .0 in the devicetree entry for the SIO chip itself and not its LDNs doesn't make sense, but is probably a current limitation of the devcetree format. Would be worth a thought if it would be useful to add a pnp device format to the devicetree without the .LDN for devices with no LDNs that could also be used for the TPM or IPMI devices.
https://review.coreboot.org/c/coreboot/+/33033/21/Documentation/superio/comm... File Documentation/superio/common/ssdt.md:
https://review.coreboot.org/c/coreboot/+/33033/21/Documentation/superio/comm... PS21, Line 24: device pnp 2e.0 on maybe add a "just for the base device, not for the LDNs" here as a comment
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/generic... File src/superio/common/generic.c:
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/generic... PS19, Line 29: res->flags |= IORESOURCE_STORED;
ok
Done
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/generic... PS19, Line 167: * coreboot's generic allocator doesn't expect them behind PnP devices.
ok, that makes sense
Done
Hello Felix Held, Christian Walter, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33033
to look at the new patch set (#22).
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
superio/common: Add ssdtgen for generic SuperIOs
Add a generic SuperIO ACPI generator, dropping the need to include additional code in DSDT for SuperIO.
It generates a device HID based on the decoded I/O range.
Tested on Supermicro X11SSH-TF using AST2400. The ssdt contains no errors and all devices are present.
Possible TODOs: * Add "enter config" and "exit config" bytes * Generate support methods to enter and exit config mode * Generate support methods to query, change or disable current resource settings on specific LDNs
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A Documentation/superio/common/ssdt.md M Documentation/superio/index.md M src/arch/x86/include/arch/acpi.h A src/superio/common/chip.h A src/superio/common/generic.c A src/superio/common/ssdt.c A src/superio/common/ssdt.h 7 files changed, 542 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/22
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 22:
(1 comment)
https://review.coreboot.org/c/coreboot/+/33033/21/Documentation/superio/comm... File Documentation/superio/common/ssdt.md:
https://review.coreboot.org/c/coreboot/+/33033/21/Documentation/superio/comm... PS21, Line 24: device pnp 2e.0 on
maybe add a "just for the base device, not for the LDNs" here as a comment
Done
Hello Felix Held, Christian Walter, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33033
to look at the new patch set (#23).
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
superio/common: Add ssdtgen for generic SuperIOs
Add a generic SuperIO ACPI generator, dropping the need to include additional code in DSDT for SuperIO.
It generates a device HID based on the decoded I/O range.
Tested on Supermicro X11SSH-TF using AST2400. The SSDT contains no errors and all devices are present.
Possible TODOs: * Add "enter config" and "exit config" bytes * Generate support methods to enter and exit config mode * Generate support methods to query, change or disable current resource settings on specific LDNs
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A Documentation/superio/common/ssdt.md M Documentation/superio/index.md M src/arch/x86/include/arch/acpi.h A src/superio/common/chip.h A src/superio/common/generic.c A src/superio/common/ssdt.c A src/superio/common/ssdt.h 7 files changed, 534 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/23
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 23:
(1 comment)
https://review.coreboot.org/c/coreboot/+/33033/21/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/c/coreboot/+/33033/21/src/superio/common/ssdt.c@... PS21, Line 155: superio_common_get_dev_hid
This won't link if your board has multiple SIO's and therefore multiple definitions of this function […]
Implemented device specific HID methods and removed the _weak imeplementation.
Hello Felix Held, Christian Walter, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33033
to look at the new patch set (#24).
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
superio/common: Add ssdtgen for generic SuperIOs
Add a generic SuperIO ACPI generator, dropping the need to include additional code in DSDT for SuperIO.
It generates a device HID based on the decoded I/O range.
Tested on Supermicro X11SSH-TF using AST2400. The SSDT contains no errors and all devices are present.
Possible TODOs: * Add "enter config" and "exit config" bytes * Generate support methods to enter and exit config mode * Generate support methods to query, change or disable current resource settings on specific LDNs
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A Documentation/superio/common/ssdt.md M Documentation/superio/index.md M src/arch/x86/include/arch/acpi.h A src/superio/common/chip.h A src/superio/common/generic.c A src/superio/common/ssdt.c A src/superio/common/ssdt.h 7 files changed, 534 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/24
Hello Felix Held, Christian Walter, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33033
to look at the new patch set (#25).
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
superio/common: Add ssdtgen for generic SuperIOs
Add a generic SuperIO ACPI generator, dropping the need to include additional code in DSDT for SuperIO.
It generates a device HID based on the decoded I/O range.
Tested on Supermicro X11SSH-TF using AST2400. The SSDT contains no errors and all devices are present.
Possible TODOs: * Add "enter config" and "exit config" bytes * Generate support methods to enter and exit config mode * Generate support methods to query, change or disable current resource settings on specific LDNs
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A Documentation/superio/common/ssdt.md M Documentation/superio/index.md M src/arch/x86/include/arch/acpi.h A src/superio/common/chip.h A src/superio/common/generic.c A src/superio/common/ssdt.c A src/superio/common/ssdt.h 7 files changed, 534 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/25
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 25:
(7 comments)
finally i got around to have a closer look at the patch...
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... File src/superio/common/generic.c:
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... PS25, Line 100: FIELDLIST_NAMESTR("IOAL", 8), IOH1, IOL1 missing?
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... PS25, Line 105: FIELDLIST_NAMESTR("INTT", 4), second irq missing
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 101: while (size > 0) { hmm, for a 256 byte big resource this will generate a 255 and a 1 byte acpi io resource. the resource size for the acpi io region is in bytes and not in bytes-1, right?
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 103: 0 AddressAlignment == 0 means fixed, right?
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 110: > shouldn't this be a >= here?
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 147: snprintf(name, sizeof(name), "VLD%X", vldn); for the vldn the base ldn also needs to be known; only the enable bit position (the virtual part of the ldn) isn't sufficient. or is the assumtion that vldn 0 always exists when other ldns exist as well?
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 226: ldn_gen_resources_use(dev); this doesn't need a name, header and footer?
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 25:
(7 comments)
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... File src/superio/common/generic.c:
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... PS25, Line 100: FIELDLIST_NAMESTR("IOAL", 8),
IOH1, IOL1 missing?
It's usually called IOA*
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... PS25, Line 105: FIELDLIST_NAMESTR("INTT", 4),
second irq missing
Ack
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 101: while (size > 0) {
hmm, for a 256 byte big resource this will generate a 255 and a 1 byte acpi io resource. […]
it is in bytes
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 103: 0
AddressAlignment == 0 means fixed, right?
I guess 1 would be correct
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 110: >
shouldn't this be a >= here?
Ack
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 147: snprintf(name, sizeof(name), "VLD%X", vldn);
for the vldn the base ldn also needs to be known; only the enable bit position (the virtual part of […]
it makes no assumptions. Will add LDN, too.
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 226: ldn_gen_resources_use(dev);
this doesn't need a name, header and footer?
it just outputs the integers "IOxB"/"IOxS" for every resource in the LDN scope. It doesn't generate an acpi resource object.
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 25:
(1 comment)
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... File src/superio/common/generic.c:
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... PS25, Line 100: FIELDLIST_NAMESTR("IOAL", 8),
It's usually called IOA*
I thought those were the names used for IO0H/IO0L. Aren't those 0-indexed? I'd expect to have IO[0123][HL] (4 IO resources; not sure if 3 or 4 was the maximum I've seen in real devices that are from this century) here and since the first ones seem to have another name used (is that by spec or by convention? I'd guess the latter), I'd still expect the IO[123][HL] fields in addition to the IOA[HL] fields
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 25:
(1 comment)
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... File src/superio/common/generic.c:
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... PS25, Line 97: FIELDLIST_NAMESTR("ACTR", 8), would it be useful to have this as 8 individual bits and not as one 8 bit value for enabling/disabling the virtual LDNs?
Hello Felix Held, Christian Walter, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33033
to look at the new patch set (#26).
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
superio/common: Add ssdtgen for generic SuperIOs
Add a generic SuperIO ACPI generator, dropping the need to include additional code in DSDT for SuperIO.
It generates a device HID based on the decoded I/O range.
Tested on Supermicro X11SSH-TF using AST2400. The SSDT contains no errors and all devices are present.
Possible TODOs: * Add "enter config" and "exit config" bytes * Generate support methods to enter and exit config mode * Generate support methods to query, change or disable current resource settings on specific LDNs
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A Documentation/superio/common/ssdt.md M Documentation/superio/index.md M src/arch/x86/include/arch/acpi.h A src/superio/common/chip.h A src/superio/common/generic.c A src/superio/common/ssdt.c A src/superio/common/ssdt.h 7 files changed, 550 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/26
Hello Felix Held, Christian Walter, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33033
to look at the new patch set (#27).
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
superio/common: Add ssdtgen for generic SuperIOs
Add a generic SuperIO ACPI generator, dropping the need to include additional code in DSDT for SuperIO.
It generates a device HID based on the decoded I/O range.
Tested on Supermicro X11SSH-TF using AST2400. The SSDT contains no errors and all devices are present.
Possible TODOs: * Add "enter config" and "exit config" bytes * Generate support methods to enter and exit config mode * Generate support methods to query, change or disable current resource settings on specific LDNs
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A Documentation/superio/common/ssdt.md M Documentation/superio/index.md M src/arch/x86/include/arch/acpi.h A src/superio/common/chip.h A src/superio/common/generic.c A src/superio/common/ssdt.c A src/superio/common/ssdt.h 7 files changed, 550 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/33033/27
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 27:
(16 comments)
https://review.coreboot.org/c/coreboot/+/33033/19/Documentation/superio/comm... File Documentation/superio/common/ssdt.md:
https://review.coreboot.org/c/coreboot/+/33033/19/Documentation/superio/comm... PS19, Line 3: This page describes the common SSDT ACPI generator that can be found in
maybe add here that it is for SIOs?
Done
https://review.coreboot.org/c/coreboot/+/33033/19/Documentation/superio/comm... PS19, Line 29:
mixed spaces and tabs here; please use one of those consistently
Done
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... File src/superio/common/generic.c:
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... PS25, Line 97: FIELDLIST_NAMESTR("ACTR", 8),
would it be useful to have this as 8 individual bits and not as one 8 bit value for enabling/disabli […]
Done
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... PS25, Line 100: FIELDLIST_NAMESTR("IOAL", 8),
I thought those were the names used for IO0H/IO0L. […]
Done
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/generic... PS25, Line 105: FIELDLIST_NAMESTR("INTT", 4),
Ack
Done
https://review.coreboot.org/c/coreboot/+/33033/16/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/c/coreboot/+/33033/16/src/superio/common/ssdt.c@... PS16, Line 17: include <superio/common/chip.h> : #include <superio/common/ssdt.h> : : #include <device/device.h> : #include <device/pnp.h> : #include <arch/acpigen.h> : #include <device/pnp_def.h> : #include <console/console.h>
to sort
no
https://review.coreboot.org/c/coreboot/+/33033/16/src/superio/common/ssdt.c@... PS16, Line 25:
missing include <types. […]
Done
https://review.coreboot.org/c/coreboot/+/33033/16/src/superio/common/ssdt.c@... PS16, Line 54: printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", : dev_path(dev));
on one line ?
Done
https://review.coreboot.org/c/coreboot/+/33033/16/src/superio/common/ssdt.c@... PS16, Line 69: struct opregion opreg = OPREGION("IOID", SYSTEMIO, : dev->path.pnp.port, 2);
one line
Done
https://review.coreboot.org/c/coreboot/+/33033/16/src/superio/common/ssdt.c@... PS16, Line 324: printk(BIOS_WARNING, "%s: No HID set in devicetree\n", : dev_path(dev));
one line
Done
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/c/coreboot/+/33033/19/src/superio/common/ssdt.c@... PS19, Line 115: res->base)
Needs to be (1 << res->base) I think.
Done
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c File src/superio/common/ssdt.c:
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 101: while (size > 0) {
it is in bytes
Done
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 103: 0
I guess 1 would be correct
Done
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 110: >
Ack
Done
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 147: snprintf(name, sizeof(name), "VLD%X", vldn);
it makes no assumptions. Will add LDN, too.
Done
https://review.coreboot.org/c/coreboot/+/33033/25/src/superio/common/ssdt.c@... PS25, Line 226: ldn_gen_resources_use(dev);
it just outputs the integers "IOxB"/"IOxS" for every resource in the LDN scope. […]
Done
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 27: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
superio/common: Add ssdtgen for generic SuperIOs
Add a generic SuperIO ACPI generator, dropping the need to include additional code in DSDT for SuperIO.
It generates a device HID based on the decoded I/O range.
Tested on Supermicro X11SSH-TF using AST2400. The SSDT contains no errors and all devices are present.
Possible TODOs: * Add "enter config" and "exit config" bytes * Generate support methods to enter and exit config mode * Generate support methods to query, change or disable current resource settings on specific LDNs
Change-Id: I2716ae0580d68e5d4fcc484cb1648a2cdc1f4ca0 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/33033 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Felix Held felix-coreboot@felixheld.de --- A Documentation/superio/common/ssdt.md M Documentation/superio/index.md M src/arch/x86/include/arch/acpi.h A src/superio/common/chip.h A src/superio/common/generic.c A src/superio/common/ssdt.c A src/superio/common/ssdt.h 7 files changed, 550 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Felix Held: Looks good to me, approved
diff --git a/Documentation/superio/common/ssdt.md b/Documentation/superio/common/ssdt.md new file mode 100644 index 0000000..4353cde --- /dev/null +++ b/Documentation/superio/common/ssdt.md @@ -0,0 +1,56 @@ +# SuperIO SSTD generator + +This page describes the common SSDT ACPI generator for SuperIO chips that can +be found in coreboot. + +## Functional description + +In order to automatically generate ACPI functions you need to add +a new `chip superio/common` and `device pnp xx.0 on` to your devicetree. + +The xx denotes the hexadecimal address of the SuperIO. + +Place the regular LDN pnp devices behind those two entries. + +The code will automatically guess the function based on the decoded +I/O range and ISA IRQ number. + +## Example devicetree.cb + +This example is based on AST2400. + +```code +# Add a "container" for proper ACPI code generation +chip superio/common + device pnp 2e.0 on # just for the base device, not for the LDNs + chip superio/aspeed/ast2400 + device pnp 2e.0 off end + device pnp 2e.2 on # SUART1 + io 0x60 = 0x3f8 + irq 0x70 = 4 + end + device pnp 2e.3 on # SUART2 + io 0x60 = 0x2f8 + irq 0x70 = 3 + end + device pnp 2e.4 on # SWC + io 0x60 = 0xa00 + io 0x62 = 0xa10 + io 0x64 = 0xa20 + io 0x66 = 0xa30 + irq 0x70 = 0 + end + end + end +end +``` + +## TODO + +1) Add ACPI HIDs to every SuperIO driver +2) Don't guess ACPI HID of LDNs if it's known +3) Add "enter config" and "exit config" bytes +4) Generate support methods that allow + * Setting resource settings at runtime + * Getting resource settings at runtime + * Disabling LDNs at runtime diff --git a/Documentation/superio/index.md b/Documentation/superio/index.md index eef4d57..39965fd 100644 --- a/Documentation/superio/index.md +++ b/Documentation/superio/index.md @@ -5,3 +5,6 @@ ## Nuvoton
- [NPCD378](nuvoton/npcd378.md) + +## Common +- [SSDT generator for generic SuperIOs](common/ssdt.md) diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h index 16e4269..e3456d8 100644 --- a/src/arch/x86/include/arch/acpi.h +++ b/src/arch/x86/include/arch/acpi.h @@ -129,6 +129,14 @@ #define ACPI_ACCESS_SIZE_DWORD_ACCESS 3 #define ACPI_ACCESS_SIZE_QWORD_ACCESS 4
+/* Common ACPI HIDs */ +#define ACPI_HID_FDC "PNP0700" +#define ACPI_HID_KEYBOARD "PNP0303" +#define ACPI_HID_MOUSE "PNP0F03" +#define ACPI_HID_COM "PNP0501" +#define ACPI_HID_LPT "PNP0400" +#define ACPI_HID_PNP "PNP0C02" + /* Generic ACPI header, provided by (almost) all tables */ typedef struct acpi_table_header { char signature[4]; /* ACPI signature (4 ASCII characters) */ diff --git a/src/superio/common/chip.h b/src/superio/common/chip.h new file mode 100644 index 0000000..fd618c5 --- /dev/null +++ b/src/superio/common/chip.h @@ -0,0 +1,21 @@ +/* + * This file is part of the coreboot project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __SUPERIO_COMMON_CHIP_H__ +#define __SUPERIO_COMMON_CHIP_H__ + +struct superio_common_config { + /* FIXME: Add enter conf/exit conf codes here for SSDT generation */ +}; + +#endif /* __SUPERIO_COMMON_CHIP_H__ */ diff --git a/src/superio/common/generic.c b/src/superio/common/generic.c new file mode 100644 index 0000000..bffa9f3 --- /dev/null +++ b/src/superio/common/generic.c @@ -0,0 +1,192 @@ +/* + * This file is part of the coreboot project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <device/device.h> +#include <device/pnp.h> +#include <arch/acpigen.h> +#include <device/pnp_def.h> +#include <console/console.h> + +static void generic_set_resources(struct device *dev) +{ + struct resource *res; + + for (res = dev->resource_list; res; res = res->next) { + if (!(res->flags & IORESOURCE_ASSIGNED)) + continue; + + res->flags |= IORESOURCE_STORED; + report_resource_stored(dev, res, ""); + } +} + +static void generic_read_resources(struct device *dev) +{ + struct resource *res = new_resource(dev, 0); + res->base = dev->path.pnp.port; + res->size = 2; + res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; +} + +#if CONFIG(HAVE_ACPI_TABLES) +static void generic_ssdt(struct device *dev) +{ + const char *scope = acpi_device_scope(dev); + const char *name = acpi_device_name(dev); + + if (!scope || !name) { + printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", + dev_path(dev)); + return; + } + + /* Device */ + acpigen_write_scope(scope); + acpigen_write_device(name); + + printk(BIOS_DEBUG, "%s.%s: %s\n", scope, name, dev_path(dev)); + + acpigen_write_name_string("_HID", "PNP0C02"); + acpigen_write_name_string("_DDN", dev_name(dev)); + + /* OperationRegion("IOID", SYSTEMIO, port, 2) */ + struct opregion opreg = OPREGION("IOID", SYSTEMIO, dev->path.pnp.port, 2); + acpigen_write_opregion(&opreg); + + struct fieldlist l[] = { + FIELDLIST_OFFSET(0), + FIELDLIST_NAMESTR("INDX", 8), + FIELDLIST_NAMESTR("DATA", 8), + }; + + /* Field (IOID, AnyAcc, NoLock, Preserve) + * { + * Offset (0), + * INDX, 8, + * DATA, 8, + * } */ + acpigen_write_field(opreg.name, l, ARRAY_SIZE(l), FIELD_BYTEACC | FIELD_NOLOCK | + FIELD_PRESERVE); + + struct fieldlist i[] = { + FIELDLIST_OFFSET(0x07), + FIELDLIST_NAMESTR("LDN", 8), + FIELDLIST_OFFSET(0x21), + FIELDLIST_NAMESTR("SCF1", 8), + FIELDLIST_NAMESTR("SCF2", 8), + FIELDLIST_NAMESTR("SCF3", 8), + FIELDLIST_NAMESTR("SCF4", 8), + FIELDLIST_NAMESTR("SCF5", 8), + FIELDLIST_NAMESTR("SCF6", 8), + FIELDLIST_NAMESTR("SCF7", 8), + FIELDLIST_OFFSET(0x29), + FIELDLIST_NAMESTR("CKCF", 8), + FIELDLIST_OFFSET(0x2F), + FIELDLIST_NAMESTR("SCFF", 8), + FIELDLIST_OFFSET(0x30), + FIELDLIST_NAMESTR("ACT0", 1), + FIELDLIST_NAMESTR("ACT1", 1), + FIELDLIST_NAMESTR("ACT2", 1), + FIELDLIST_NAMESTR("ACT3", 1), + FIELDLIST_NAMESTR("ACT4", 1), + FIELDLIST_NAMESTR("ACT5", 1), + FIELDLIST_NAMESTR("ACT6", 1), + FIELDLIST_NAMESTR("ACT7", 1), + FIELDLIST_OFFSET(0x60), + FIELDLIST_NAMESTR("IOH0", 8), + FIELDLIST_NAMESTR("IOL0", 8), + FIELDLIST_NAMESTR("IOH1", 8), + FIELDLIST_NAMESTR("IOL1", 8), + FIELDLIST_NAMESTR("IOH2", 8), + FIELDLIST_NAMESTR("IOL2", 8), + FIELDLIST_NAMESTR("IOH3", 8), + FIELDLIST_NAMESTR("IOL3", 8), + FIELDLIST_OFFSET(0x70), + FIELDLIST_NAMESTR("INTR", 4), + FIELDLIST_OFFSET(0x71), + FIELDLIST_NAMESTR("INTT", 2), + FIELDLIST_OFFSET(0x72), + FIELDLIST_NAMESTR("ITR2", 4), + FIELDLIST_OFFSET(0x73), + FIELDLIST_NAMESTR("ITR2", 2), + FIELDLIST_OFFSET(0x74), + FIELDLIST_NAMESTR("DMCH", 8), + FIELDLIST_OFFSET(0xE0), + FIELDLIST_NAMESTR("RGE0", 8), + FIELDLIST_NAMESTR("RGE1", 8), + FIELDLIST_NAMESTR("RGE2", 8), + FIELDLIST_NAMESTR("RGE3", 8), + FIELDLIST_NAMESTR("RGE4", 8), + FIELDLIST_NAMESTR("RGE5", 8), + FIELDLIST_NAMESTR("RGE6", 8), + FIELDLIST_NAMESTR("RGE7", 8), + FIELDLIST_NAMESTR("RGE8", 8), + FIELDLIST_NAMESTR("RGE9", 8), + FIELDLIST_NAMESTR("RGEA", 8), + FIELDLIST_OFFSET(0xF0), + FIELDLIST_NAMESTR("OPT0", 8), + FIELDLIST_NAMESTR("OPT1", 8), + FIELDLIST_NAMESTR("OPT2", 8), + FIELDLIST_NAMESTR("OPT3", 8), + FIELDLIST_NAMESTR("OPT4", 8), + FIELDLIST_NAMESTR("OPT5", 8), + FIELDLIST_NAMESTR("OPT6", 8), + FIELDLIST_NAMESTR("OPT7", 8), + FIELDLIST_NAMESTR("OPT8", 8), + FIELDLIST_NAMESTR("OPT9", 8), + }; + + acpigen_write_indexfield("INDX", "DATA", i, ARRAY_SIZE(i), FIELD_BYTEACC | + FIELD_NOLOCK | FIELD_PRESERVE); + + acpigen_pop_len(); /* Device */ + acpigen_pop_len(); /* Scope */ +} + +static const char *generic_acpi_name(const struct device *dev) +{ + return "SIO0"; +} +#endif + +static struct device_operations ops = { + .read_resources = generic_read_resources, + .set_resources = generic_set_resources, + .enable_resources = DEVICE_NOOP, +#if CONFIG(HAVE_ACPI_TABLES) + .acpi_fill_ssdt_generator = generic_ssdt, + .acpi_name = generic_acpi_name, +#endif +}; + +static void enable_dev(struct device *dev) +{ + if (dev->path.type != DEVICE_PATH_PNP) + printk(BIOS_ERR, "%s: Unsupported device type\n", dev_path(dev)); + else if (!dev->path.pnp.port) + printk(BIOS_ERR, "%s: Base address not set\n", dev_path(dev)); + else + dev->ops = &ops; + + /* + * Need to call enable_dev() on the devices "behind" the Generic Super I/O. + * coreboot's generic allocator doesn't expect them behind PnP devices. + */ + scan_static_bus(dev); +} + +struct chip_operations superio_common_ops = { + CHIP_NAME("Generic Super I/O") + .enable_dev = enable_dev, +}; diff --git a/src/superio/common/ssdt.c b/src/superio/common/ssdt.c new file mode 100644 index 0000000..035f06a --- /dev/null +++ b/src/superio/common/ssdt.c @@ -0,0 +1,247 @@ +/* + * This file is part of the coreboot project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <superio/common/ssdt.h> + +#include <device/device.h> +#include <device/pnp.h> +#include <arch/acpigen.h> +#include <arch/acpi.h> +#include <device/pnp_def.h> +#include <console/console.h> +#include <types.h> + +struct superio_dev { + const char *acpi_hid; + u16 io_base[4]; + u8 irq[2]; +}; + +static const struct superio_dev superio_devs[] = { + {ACPI_HID_FDC, {0x3f0, 0x3f2, 0x3f7}, {6, } }, + {ACPI_HID_KEYBOARD, {60, 64, }, {1, } }, + {ACPI_HID_MOUSE, {60, 64, }, {12, } }, + {ACPI_HID_COM, {0x3f8, 0x2f8, 0x3e8, 0x2e8}, {4, 3} }, + {ACPI_HID_LPT, {0x378, }, {7, } }, +}; + +static const u8 io_idx[] = {PNP_IDX_IO0, PNP_IDX_IO1, PNP_IDX_IO2, PNP_IDX_IO3}; +static const u8 irq_idx[] = {PNP_IDX_IRQ0, PNP_IDX_IRQ1}; + +static const struct superio_dev *superio_guess_function(struct device *dev) +{ + for (size_t i = 0; i < ARRAY_SIZE(io_idx); i++) { + struct resource *res = probe_resource(dev, io_idx[i]); + if (!res || !res->base) + continue; + + for (size_t j = 0; j < ARRAY_SIZE(superio_devs); j++) { + for (size_t k = 0; k < 4; k++) { + if (!superio_devs[j].io_base[k]) + continue; + if (superio_devs[j].io_base[k] == res->base) + return &superio_devs[j]; + } + } + } + for (size_t i = 0; i < ARRAY_SIZE(irq_idx); i++) { + struct resource *res = probe_resource(dev, irq_idx[i]); + if (!res || !res->size) + continue; + for (size_t j = 0; j < ARRAY_SIZE(superio_devs); j++) { + for (size_t k = 0; k < 2; k++) { + if (!superio_devs[j].irq[k]) + continue; + if (superio_devs[j].irq[k] == res->base) + return &superio_devs[j]; + } + } + } + return NULL; +} + +/* Return true if there are resources to report */ +static bool has_resources(struct device *dev) +{ + for (size_t i = 0; i < ARRAY_SIZE(io_idx); i++) { + struct resource *res = probe_resource(dev, io_idx[i]); + if (!res || !res->base || !res->size) + continue; + return 1; + } + for (size_t i = 0; i < ARRAY_SIZE(irq_idx); i++) { + struct resource *res = probe_resource(dev, irq_idx[i]); + if (!res || !res->size || res->base > 16) + continue; + return 1; + } + return 0; +} + +/* Add IO and IRQ resources for _CRS or _PRS */ +static void ldn_gen_resources(struct device *dev) +{ + uint16_t irq = 0; + for (size_t i = 0; i < ARRAY_SIZE(io_idx); i++) { + struct resource *res = probe_resource(dev, io_idx[i]); + if (!res || !res->base) + continue; + resource_t base = res->base; + resource_t size = res->size; + while (size > 0) { + resource_t sz = size > 255 ? 255 : size; + /* TODO: Needs test with regions >= 256 bytes */ + acpigen_write_io16(base, base, 1, sz, 1); + size -= sz; + base += sz; + } + } + for (size_t i = 0; i < ARRAY_SIZE(irq_idx); i++) { + struct resource *res = probe_resource(dev, irq_idx[i]); + if (!res || !res->size || res->base >= 16) + continue; + irq |= 1 << res->base; + } + if (irq) + acpigen_write_irq(irq); + +} + +/* Add resource base and size for additional SuperIO code */ +static void ldn_gen_resources_use(struct device *dev) +{ + char name[5]; + for (size_t i = 0; i < ARRAY_SIZE(io_idx); i++) { + struct resource *res = probe_resource(dev, io_idx[i]); + if (!res || !res->base || !res->size) + continue; + + snprintf(name, sizeof(name), "IO%XB", i); + name[4] = '\0'; + acpigen_write_name_integer(name, res->base); + + snprintf(name, sizeof(name), "IO%XS", i); + name[4] = '\0'; + acpigen_write_name_integer(name, res->size); + } +} + +const char *superio_common_ldn_acpi_name(const struct device *dev) +{ + u8 ldn = dev->path.pnp.device & 0xff; + u8 vldn = (dev->path.pnp.device >> 8) & 0x7; + static char name[5]; + + snprintf(name, sizeof(name), "L%02X%01X", ldn, vldn); + + name[4] = '\0'; + + return name; +} + +static const char *name_from_hid(const char *hid) +{ + static const struct { + const char *hid; + const char *name; + } lookup[] = { + {ACPI_HID_FDC, "FDC" }, + {ACPI_HID_KEYBOARD, "PS2 Keyboard" }, + {ACPI_HID_MOUSE, "PS2 Mouse"}, + {ACPI_HID_COM, "COM port" }, + {ACPI_HID_LPT, "LPT" }, + {ACPI_HID_PNP, "Generic PNP device" }, + }; + + for (size_t i = 0; hid && i < ARRAY_SIZE(lookup); i++) { + if (strcmp(hid, lookup[i].hid) == 0) + return lookup[i].name; + } + return "Generic device"; +} + +void superio_common_fill_ssdt_generator(struct device *dev) +{ + const char *scope = acpi_device_scope(dev); + const char *name = acpi_device_name(dev); + const u8 ldn = dev->path.pnp.device & 0xff; + const u8 vldn = (dev->path.pnp.device >> 8) & 0x7; + const char *hid; + + if (!scope || !name) { + printk(BIOS_ERR, "%s: Missing ACPI path/scope\n", dev_path(dev)); + return; + } + if (vldn) { + printk(BIOS_DEBUG, "%s: Ignoring virtual LDN\n", dev_path(dev)); + return; + } + + printk(BIOS_DEBUG, "%s.%s: %s\n", scope, name, dev_path(dev)); + + /* Scope */ + acpigen_write_scope(scope); + + /* Device */ + acpigen_write_device(name); + + acpigen_write_name_byte("_UID", 0); + acpigen_write_name_byte("LDN", ldn); + acpigen_write_name_byte("VLDN", vldn); + + acpigen_write_STA(dev->enabled ? 0xf : 0); + + if (!dev->enabled) { + acpigen_pop_len(); /* Device */ + acpigen_pop_len(); /* Scope */ + return; + } + + if (has_resources(dev)) { + /* Resources - _CRS */ + acpigen_write_name("_CRS"); + acpigen_write_resourcetemplate_header(); + ldn_gen_resources(dev); + acpigen_write_resourcetemplate_footer(); + + /* Resources - _PRS */ + acpigen_write_name("_PRS"); + acpigen_write_resourcetemplate_header(); + ldn_gen_resources(dev); + acpigen_write_resourcetemplate_footer(); + + /* Resources base and size for 3rd party ACPI code */ + ldn_gen_resources_use(dev); + } + + hid = acpi_device_hid(dev); + if (!hid) { + printk(BIOS_ERR, "%s: SuperIO driver doesn't provide a _HID\n", dev_path(dev)); + /* Try to guess it... */ + const struct superio_dev *sdev = superio_guess_function(dev); + if (sdev && sdev->acpi_hid) { + hid = sdev->acpi_hid; + printk(BIOS_WARNING, "%s: Guessed _HID is '%s'\n", dev_path(dev), hid); + } else { + hid = ACPI_HID_PNP; + printk(BIOS_ERR, "%s: Failed to guessed _HID\n", dev_path(dev)); + } + } + + acpigen_write_name_string("_HID", hid); + acpigen_write_name_string("_DDN", name_from_hid(hid)); + + acpigen_pop_len(); /* Device */ + acpigen_pop_len(); /* Scope */ +} diff --git a/src/superio/common/ssdt.h b/src/superio/common/ssdt.h new file mode 100644 index 0000000..8c63742 --- /dev/null +++ b/src/superio/common/ssdt.h @@ -0,0 +1,23 @@ +/* + * This file is part of the coreboot project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __SUPERIO_COMMON_SSDT_H__ +#define __SUPERIO_COMMON_SSDT_H__ + +#include <device/device.h> + +const char *superio_common_ldn_acpi_name(const struct device *dev); +void superio_common_fill_ssdt_generator(struct device *dev); + +#endif /* __SUPERIO_COMMON_SSDT_H__ */
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33033 )
Change subject: superio/common: Add ssdtgen for generic SuperIOs ......................................................................
Patch Set 28:
(1 comment)
https://review.coreboot.org/c/coreboot/+/33033/28/src/superio/common/generic... File src/superio/common/generic.c:
https://review.coreboot.org/c/coreboot/+/33033/28/src/superio/common/generic... PS28, Line 120: FIELDLIST_NAMESTR("ITR2", 4), : FIELDLIST_OFFSET(0x73), : FIELDLIST_NAMESTR("ITR2", 2), Um, this is duplicated