acpigen: Use implicit length patching in acpigen_write_resourcetemplate_footer
Change-Id: Ic177720b074fed13a17454dcb6765ac298365624 Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/7366 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
parent
663be6e9f2
commit
9acc1e8dfc
|
@ -382,13 +382,13 @@ int acpigen_write_empty_PTC(void)
|
||||||
/* ControlRegister */
|
/* ControlRegister */
|
||||||
rlen = acpigen_write_resourcetemplate_header();
|
rlen = acpigen_write_resourcetemplate_header();
|
||||||
rlen += acpigen_write_register(&addr);
|
rlen += acpigen_write_register(&addr);
|
||||||
len += acpigen_write_resourcetemplate_footer(rlen);
|
len += acpigen_write_resourcetemplate_footer();
|
||||||
len += rlen;
|
len += rlen;
|
||||||
|
|
||||||
/* StatusRegister */
|
/* StatusRegister */
|
||||||
rlen = acpigen_write_resourcetemplate_header();
|
rlen = acpigen_write_resourcetemplate_header();
|
||||||
rlen += acpigen_write_register(&addr);
|
rlen += acpigen_write_register(&addr);
|
||||||
len += acpigen_write_resourcetemplate_footer(rlen);
|
len += acpigen_write_resourcetemplate_footer();
|
||||||
len += rlen;
|
len += rlen;
|
||||||
|
|
||||||
acpigen_patch_len(len - 1);
|
acpigen_patch_len(len - 1);
|
||||||
|
@ -535,7 +535,7 @@ int acpigen_write_CST_package_entry(acpi_cstate_t *cstate)
|
||||||
acpigen_write_register(&cstate->resource);
|
acpigen_write_register(&cstate->resource);
|
||||||
end = acpigen_get_current();
|
end = acpigen_get_current();
|
||||||
len += end - start;
|
len += end - start;
|
||||||
len += acpigen_write_resourcetemplate_footer(len);
|
len += acpigen_write_resourcetemplate_footer();
|
||||||
len += len0;
|
len += len0;
|
||||||
len += acpigen_write_dword(cstate->ctype);
|
len += acpigen_write_dword(cstate->ctype);
|
||||||
len += acpigen_write_dword(cstate->latency);
|
len += acpigen_write_dword(cstate->latency);
|
||||||
|
@ -713,20 +713,24 @@ int acpigen_write_resourcetemplate_header(void)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int acpigen_write_resourcetemplate_footer(int len)
|
int acpigen_write_resourcetemplate_footer(void)
|
||||||
{
|
{
|
||||||
char *p = len_stack[--ltop];
|
char *p = len_stack[--ltop];
|
||||||
|
int len;
|
||||||
/*
|
/*
|
||||||
* end tag (acpi 4.0 Section 6.4.2.8)
|
* end tag (acpi 4.0 Section 6.4.2.8)
|
||||||
* 0x79 <checksum>
|
* 0x79 <checksum>
|
||||||
* 0x00 is treated as a good checksum according to the spec
|
* 0x00 is treated as a good checksum according to the spec
|
||||||
* and is what iasl generates.
|
* and is what iasl generates.
|
||||||
*/
|
*/
|
||||||
len += acpigen_emit_byte(0x79);
|
acpigen_emit_byte(0x79);
|
||||||
len += acpigen_emit_byte(0x00);
|
acpigen_emit_byte(0x00);
|
||||||
|
|
||||||
|
len = gencurrent - p;
|
||||||
|
|
||||||
/* patch len word */
|
/* patch len word */
|
||||||
p[0] = (len-6) & 0xff;
|
p[0] = len & 0xff;
|
||||||
p[1] = ((len-6) >> 8) & 0xff;
|
p[1] = (len >> 8) & 0xff;
|
||||||
/* patch len field */
|
/* patch len field */
|
||||||
acpigen_patch_len(len-1);
|
acpigen_patch_len(len-1);
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -773,7 +777,7 @@ int acpigen_write_mainboard_resource_template(void)
|
||||||
|
|
||||||
end = acpigen_get_current();
|
end = acpigen_get_current();
|
||||||
len += end-start;
|
len += end-start;
|
||||||
len += acpigen_write_resourcetemplate_footer(len);
|
len += acpigen_write_resourcetemplate_footer();
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ int acpigen_write_mem32fixed(int readwrite, u32 base, u32 size);
|
||||||
int acpigen_write_io16(u16 min, u16 max, u8 align, u8 len, u8 decode16);
|
int acpigen_write_io16(u16 min, u16 max, u8 align, u8 len, u8 decode16);
|
||||||
int acpigen_write_register(acpi_addr_t *addr);
|
int acpigen_write_register(acpi_addr_t *addr);
|
||||||
int acpigen_write_resourcetemplate_header(void);
|
int acpigen_write_resourcetemplate_header(void);
|
||||||
int acpigen_write_resourcetemplate_footer(int len);
|
int acpigen_write_resourcetemplate_footer(void);
|
||||||
int acpigen_write_mainboard_resource_template(void);
|
int acpigen_write_mainboard_resource_template(void);
|
||||||
int acpigen_write_mainboard_resources(const char *scope, const char *name);
|
int acpigen_write_mainboard_resources(const char *scope, const char *name);
|
||||||
int acpigen_write_irq(u16 mask);
|
int acpigen_write_irq(u16 mask);
|
||||||
|
|
|
@ -93,8 +93,6 @@ void
|
||||||
drivers_lenovo_serial_ports_ssdt_generate(const char *scope,
|
drivers_lenovo_serial_ports_ssdt_generate(const char *scope,
|
||||||
int have_dock_serial)
|
int have_dock_serial)
|
||||||
{
|
{
|
||||||
int reslen;
|
|
||||||
|
|
||||||
acpigen_write_scope(scope);
|
acpigen_write_scope(scope);
|
||||||
|
|
||||||
if (drivers_lenovo_is_wacom_present()) {
|
if (drivers_lenovo_is_wacom_present()) {
|
||||||
|
@ -105,11 +103,11 @@ drivers_lenovo_serial_ports_ssdt_generate(const char *scope,
|
||||||
|
|
||||||
acpigen_write_name("_CRS");
|
acpigen_write_name("_CRS");
|
||||||
|
|
||||||
reslen = acpigen_write_resourcetemplate_header();
|
acpigen_write_resourcetemplate_header();
|
||||||
reslen += acpigen_write_io16(0x200, 0x200, 1, 8, 1);
|
acpigen_write_io16(0x200, 0x200, 1, 8, 1);
|
||||||
reslen += acpigen_write_irq((1 << 5));
|
acpigen_write_irq((1 << 5));
|
||||||
|
|
||||||
acpigen_write_resourcetemplate_footer(reslen);
|
acpigen_write_resourcetemplate_footer();
|
||||||
|
|
||||||
acpigen_write_method("_STA", 0);
|
acpigen_write_method("_STA", 0);
|
||||||
/* return */
|
/* return */
|
||||||
|
@ -131,11 +129,11 @@ drivers_lenovo_serial_ports_ssdt_generate(const char *scope,
|
||||||
|
|
||||||
acpigen_write_name("_CRS");
|
acpigen_write_name("_CRS");
|
||||||
|
|
||||||
reslen = acpigen_write_resourcetemplate_header();
|
acpigen_write_resourcetemplate_header();
|
||||||
reslen += acpigen_write_io16(0x3f8, 0x3f8, 1, 8, 1);
|
acpigen_write_io16(0x3f8, 0x3f8, 1, 8, 1);
|
||||||
reslen += acpigen_write_irq(1 << 4);
|
acpigen_write_irq(1 << 4);
|
||||||
|
|
||||||
acpigen_write_resourcetemplate_footer(reslen);
|
acpigen_write_resourcetemplate_footer();
|
||||||
|
|
||||||
/* method op */
|
/* method op */
|
||||||
acpigen_write_method("_STA", 0);
|
acpigen_write_method("_STA", 0);
|
||||||
|
|
Loading…
Reference in New Issue