@@ -229,24 +229,8 @@ void build_extop_package(GArray *package, uint8_t op)
void build_append_value(GArray *table, uint32_t value, int size)
{
- uint8_t prefix;
int i;
- switch (size) {
- case 1:
- prefix = 0x0A; /* BytePrefix */
- break;
- case 2:
- prefix = 0x0B; /* WordPrefix */
- break;
- case 4:
- prefix = 0x0C; /* DWordPrefix */
- break;
- default:
- assert(0);
- return;
- }
- build_append_byte(table, prefix);
for (i = 0; i < size; ++i) {
build_append_byte(table, value & 0xFF);
value = value >> 8;
@@ -260,10 +244,13 @@ void build_append_int(GArray *table, uint32_t value)
} else if (value == 0x01) {
build_append_byte(table, 0x01); /* OneOp */
} else if (value <= 0xFF) {
+ build_append_byte(table, 0x0A); /* BytePrefix */
build_append_value(table, value, 1);
} else if (value <= 0xFFFF) {
+ build_append_byte(table, 0x0B); /* WordPrefix */
build_append_value(table, value, 2);
} else {
+ build_append_byte(table, 0x0C); /* DWordPrefix */
build_append_value(table, value, 4);
}
}
it will be reused for adding a plain integer value into AML. Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- hw/acpi/acpi-build-utils.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-)