[023] rsdp : rsdp.aml (36 bytes @ 0x00000000) [reloc: 0x0000000042010000]
This is certainly wrong, I suspect somewhere in here you missed a BLOB_HEADER_SIZE.
I guess all these addresses might be out by 8 bytes?
Graeme
On 13/08/13 00:10, al.stone@linaro.org wrote:
From: Al Stone ahs3@redhat.com
Signed-off-by: Al Stone al.stone@linaro.org
tools/mab/mab.c | 24 ++++++++++++++++++------ tools/mab/mab.h | 3 ++- 2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/tools/mab/mab.c b/tools/mab/mab.c index 3107088..0480f95 100644 --- a/tools/mab/mab.c +++ b/tools/mab/mab.c @@ -121,6 +121,7 @@ struct table *build_table_entry(char *dir, char *buf) tmp->file_size = -1; /* need to build .aml file first */ tmp->offset = -1;
}tmp->paddr = -1;
return tmp; @@ -295,17 +296,20 @@ void fixup_rsdp(unsigned char *blob, uint64_t paddr) rsdpp->offset + RSDT_ADDR_OFFSET); ltmp = (uint64_t *)(blob + BLOB_HEADER_SIZE + rsdpp->offset + XSDT_ADDR_OFFSET);
- rsdpp->paddr = rsdpp->offset + paddr - BLOB_HEADER_SIZE;
p = find_table("xsdt");
- if (p)
- if (p) { *ltmp = p->offset + paddr;
- else
p->paddr = p->offset + paddr - BLOB_HEADER_SIZE;
- } else *ltmp = (uint64_t)0;
p = find_table("rsdt");
- if (p)
- if (p) { *stmp = p->offset + paddr;
- else
p->paddr = p->offset + paddr - BLOB_HEADER_SIZE;
- } else *stmp = (uint64_t)0;
/* always reset the checksum, even if it is seldom used */ @@ -330,6 +334,7 @@ void fixup_facp(unsigned char *blob, int *offset, uint64_t paddr) uint8_t *pcksum; facpp = find_table("facp");
- facpp->paddr = facpp->offset + paddr - BLOB_HEADER_SIZE;
/* add in the DSDT and X_DSDT addresses */ stmp = (uint32_t *)(blob + BLOB_HEADER_SIZE + @@ -340,6 +345,7 @@ void fixup_facp(unsigned char *blob, int *offset, uint64_t paddr) if (p) { *stmp = (uint32_t)p->offset + paddr; *ltmp = (uint64_t)p->offset + paddr;
} else { *stmp = (uint32_t)0; *ltmp = (uint64_t)0;p->paddr = p->offset + paddr - BLOB_HEADER_SIZE;
@@ -355,6 +361,7 @@ void fixup_facp(unsigned char *blob, int *offset, uint64_t paddr) if (p) { *stmp = (uint32_t)p->offset + paddr; *ltmp = (uint64_t)p->offset + paddr;
} else { *stmp = (uint32_t)0; *ltmp = (uint64_t)0;p->paddr = p->offset + paddr - BLOB_HEADER_SIZE;
@@ -382,14 +389,17 @@ void fixup_xsdt(unsigned char **blob, int *offset, uint64_t paddr) int allowed; xsdtp = find_table("xsdt");
- xsdtp->paddr = xsdtp->offset + paddr - BLOB_HEADER_SIZE; tmp = (uint64_t *)(*blob + BLOB_HEADER_SIZE + xsdtp->offset + FACP_ADDR_OFFSET); allowed = (xsdtp->file_size - XSDT_HEADER_SIZE) / sizeof(uint64_t);
/* first table must be FACP (aka FADT) */ p = find_table("facp");
- if (p)
- if (p) { *tmp = p->offset + paddr;
p->paddr = p->offset + paddr - BLOB_HEADER_SIZE;
- } else { *tmp = (uint64_t)0; return;
@@ -407,6 +417,7 @@ void fixup_xsdt(unsigned char **blob, int *offset, uint64_t paddr) *offset, NOT_REQUIRED); *offset += delta; *tmp++ = p->offset + paddr;
p->paddr = p->offset + paddr - BLOB_HEADER_SIZE; allowed--; if (allowed < 1) break;
@@ -594,9 +605,10 @@ int main(int argc, char *argv[]) printf("%s %s\n", PROGNAME, VERSION); ii = 0; LIST_FOREACH(np, &thead, tables) {
printf("[%03d] %4s : %s (%d bytes @ 0x%08x)\n", ii,
printf("[%03d] %4s : %s (%d bytes @ 0x%08x)", ii, np->signature, basename(np->aml_name), np->file_size, np->offset);
} }printf(" [reloc: 0x%016llx]\n", np->paddr); ii++;
diff --git a/tools/mab/mab.h b/tools/mab/mab.h index 3db3d11..99ef9e7 100644 --- a/tools/mab/mab.h +++ b/tools/mab/mab.h @@ -27,7 +27,7 @@ #define SIG_LENGTH 4 /* VERSION a.b.c = <public release>.<functionality changes>.<bug fixes> */ -const char VERSION[] = { "0.28.4" }; +const char VERSION[] = { "0.29.1" }; const char PROGNAME[] = { "mab" }; char *known_sigs[] = { @@ -70,6 +70,7 @@ struct table { char *aml_name; /* corresponding AML name */ int file_size; /* aka table size */ int offset; /* location in the blob */
- uint64_t paddr; /* physical address */ LIST_ENTRY(table) tables; };