summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2020-09-30 23:09:29 +0000
committerDuncan Laurie <dlaurie@chromium.org>2020-10-21 22:23:55 +0000
commit095bbf969d47a06388be65e944352f1936c4e1f2 (patch)
tree7f08c105da21c436cd51199908729766df663fd5
parentcf5d58328fe004d967466be42de62d6bab4c3133 (diff)
acpigen: Add option for reserved bits in Field
Add an option for unused/reserved bits in a Field definition, allowing for declarations that do not start at bit 0: Field (UART, AnyAcc, NoLock, Preserve) { , 7, /* RESERVED */ BITF, /* Used bit */ } These just use byte 0 instead of a name. Change-Id: I86b54685dbdebacb0834173857c9341ea9fa9a46 Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46254 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/acpi/acpigen.c14
-rw-r--r--src/include/acpi/acpigen.h5
2 files changed, 18 insertions, 1 deletions
diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c
index 5b45ebd3a8..a3beb1054f 100644
--- a/src/acpi/acpigen.c
+++ b/src/acpi/acpigen.c
@@ -505,6 +505,12 @@ static void acpigen_write_field_name(const char *name, uint32_t size)
acpigen_write_field_length(size);
}
+static void acpigen_write_field_reserved(uint32_t size)
+{
+ acpigen_emit_byte(0);
+ acpigen_write_field_length(size);
+}
+
/*
* Generate ACPI AML code for Field
* Arg0: region name
@@ -515,6 +521,7 @@ static void acpigen_write_field_name(const char *name, uint32_t size)
* struct fieldlist l[] = {
* FIELDLIST_OFFSET(0x84),
* FIELDLIST_NAMESTR("PMCS", 2),
+ * FIELDLIST_RESERVED(6),
* };
* acpigen_write_field("UART", l, ARRAY_SIZE(l), FIELD_ANYACC | FIELD_NOLOCK |
* FIELD_PRESERVE);
@@ -522,7 +529,8 @@ static void acpigen_write_field_name(const char *name, uint32_t size)
* Field (UART, AnyAcc, NoLock, Preserve)
* {
* Offset (0x84),
- * PMCS, 2
+ * PMCS, 2,
+ * , 6,
* }
*/
void acpigen_write_field(const char *name, const struct fieldlist *l, size_t count,
@@ -546,6 +554,10 @@ void acpigen_write_field(const char *name, const struct fieldlist *l, size_t cou
acpigen_write_field_name(l[i].name, l[i].bits);
current_bit_pos += l[i].bits;
break;
+ case RESERVED:
+ acpigen_write_field_reserved(l[i].bits);
+ current_bit_pos += l[i].bits;
+ break;
case OFFSET:
acpigen_write_field_offset(l[i].bits, current_bit_pos);
current_bit_pos = l[i].bits;
diff --git a/src/include/acpi/acpigen.h b/src/include/acpi/acpigen.h
index c30f8449b6..10e328b8b8 100644
--- a/src/include/acpi/acpigen.h
+++ b/src/include/acpi/acpigen.h
@@ -158,6 +158,10 @@ enum {
.name = X, \
.bits = Y, \
}
+#define FIELDLIST_RESERVED(X) { .type = RESERVED, \
+ .name = "", \
+ .bits = X, \
+ }
#define FIELD_ANYACC 0
#define FIELD_BYTEACC 1
@@ -174,6 +178,7 @@ enum {
enum field_type {
OFFSET,
NAME_STRING,
+ RESERVED,
FIELD_TYPE_MAX,
};