On 19/08/13 13:07, Tomasz Nowicki wrote:
W dniu 06.08.2013 13:22, Graeme Gregory pisze:
Tables crossing pages is currently causing issues on armv7 devices, for now get mab to fixup addresses so we do not cross a page boundary with a table.
Is it really armv7 issue? Based on code it applied to armv8 as well. The patch seems to be even better... :)
Well I think technically we could remap ACPI to 64K pages on armv8.
Graeme
Tomasz
Signed-off-by: Graeme Gregory graeme.gregory@linaro.org
tools/mab/mab.c | 32 ++++++++++++++++++++++++++++++-- tools/mab/mab.h | 3 +++ 2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/tools/mab/mab.c b/tools/mab/mab.c index 74ed0e9..c9c8c7c 100644 --- a/tools/mab/mab.c +++ b/tools/mab/mab.c @@ -237,8 +237,25 @@ void set_checksum(unsigned char *start, int len, uint8_t *cksum) int add_table(unsigned char *blob, char *table_name, int offset, int reqd) { struct table *p;
int new_offset;
p = find_table(table_name);
new_offset = offset + p->file_size;
/*
* Handle crossing of page boundaries to prevent problems
* on armv7 with small page sizes
*/
if ((new_offset / PAGE_SIZE) != (offset / PAGE_SIZE)) {
offset += (PAGE_SIZE - (offset % PAGE_SIZE));
/*
* If this is the first page crossing remove the
* blob header from calculations
*/
if ((offset / PAGE_SIZE) == 1)
offset -= BLOB_HEADER_SIZE;
}
if (p) { write_table(blob, p, offset); } else {
@@ -519,8 +536,19 @@ int main(int argc, char *argv[])
/* build up the contents of the blob, table by table */ blob_size = 0;
- LIST_FOREACH(np, &thead, tables)
- blob_size += np->file_size;
- LIST_FOREACH(np, &thead, tables) {
int new_size, adjustment = 0;
new_size = blob_size + np->file_size;
if ((new_size / PAGE_SIZE) != (blob_size / PAGE_SIZE)) {
adjustment = PAGE_SIZE - (blob_size % PAGE_SIZE);
if (!(blob_size / PAGE_SIZE))
adjustment -= BLOB_HEADER_SIZE;
}
blob_size += np->file_size + adjustment;
- } blob = (unsigned char *)malloc(blob_size + BLOB_HEADER_SIZE); memset(blob, 0, blob_size + BLOB_HEADER_SIZE);
diff --git a/tools/mab/mab.h b/tools/mab/mab.h index 366caef..37cd850 100644 --- a/tools/mab/mab.h +++ b/tools/mab/mab.h @@ -89,4 +89,7 @@ void fixup_facp(unsigned char *blob, int *offset, unsigned long paddr); void fixup_rsdp(unsigned char *blob, unsigned long paddr); void fixup_xsdt(unsigned char *blob, int *offset, unsigned long paddr);
+/* Currently a hack to avoid issues on 4k pages on armv7 */ +#define PAGE_SIZE 0x1000
- #endif