Message ID | 1422091280-14532-4-git-send-email-zhaoshenglong@huawei.com |
---|---|
State | New |
Headers | show |
On Sat, 24 Jan 2015 17:21:12 +0800 Shannon Zhao <zhaoshenglong@huawei.com> wrote: > RSDP points to XSDT which in turn points to other tables. > > Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> > --- > hw/arm/virt-acpi-build.c | 22 ++++++++++++++++++++++ > 1 files changed, 22 insertions(+), 0 deletions(-) > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 4eed0a3..9c3971a 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -86,6 +86,28 @@ static inline void acpi_add_table(GArray *table_offsets, GArray *table_data) > static GArray * > build_rsdp(GArray *rsdp_table, GArray *linker, uint64_t xsdt) > { > + AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp); > + > + bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16, > + true /* fseg memory */); > + > + memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); > + memcpy(rsdp->oem_id, ACPI_VIRT_QEMU_STR_6, sizeof(rsdp->oem_id)); > + rsdp->length = cpu_to_le32(sizeof(*rsdp)); > + rsdp->revision = 0x02; > + > + /* Point to XSDT */ > + rsdp->xsdt_physical_address = cpu_to_le64(xsdt); RSDP should be created after XSDT so XSDT pointer would be correct, perhaps it's wrong patch ordering > + /* Address to be filled by Guest linker */ > + bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE, > + ACPI_BUILD_TABLE_FILE, > + rsdp_table, &rsdp->xsdt_physical_address, > + sizeof rsdp->xsdt_physical_address); > + rsdp->checksum = 0; > + /* Checksum to be filled by Guest linker */ > + bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, > + rsdp, rsdp, sizeof *rsdp, &rsdp->checksum); > + > return rsdp_table; > } >
On 2015/1/26 18:22, Igor Mammedov wrote: > On Sat, 24 Jan 2015 17:21:12 +0800 > Shannon Zhao <zhaoshenglong@huawei.com> wrote: > >> > RSDP points to XSDT which in turn points to other tables. >> > >> > Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> >> > --- >> > hw/arm/virt-acpi-build.c | 22 ++++++++++++++++++++++ >> > 1 files changed, 22 insertions(+), 0 deletions(-) >> > >> > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c >> > index 4eed0a3..9c3971a 100644 >> > --- a/hw/arm/virt-acpi-build.c >> > +++ b/hw/arm/virt-acpi-build.c >> > @@ -86,6 +86,28 @@ static inline void acpi_add_table(GArray *table_offsets, GArray *table_data) >> > static GArray * >> > build_rsdp(GArray *rsdp_table, GArray *linker, uint64_t xsdt) >> > { >> > + AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp); >> > + >> > + bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16, >> > + true /* fseg memory */); >> > + >> > + memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); >> > + memcpy(rsdp->oem_id, ACPI_VIRT_QEMU_STR_6, sizeof(rsdp->oem_id)); >> > + rsdp->length = cpu_to_le32(sizeof(*rsdp)); >> > + rsdp->revision = 0x02; >> > + >> > + /* Point to XSDT */ >> > + rsdp->xsdt_physical_address = cpu_to_le64(xsdt); > RSDP should be created after XSDT so XSDT pointer would be correct, > perhaps it's wrong patch ordering > Thanks for pointing this out. Will fix it. Thanks, Shannon
On 2015/1/26 18:22, Igor Mammedov wrote: > On Sat, 24 Jan 2015 17:21:12 +0800 > Shannon Zhao <zhaoshenglong@huawei.com> wrote: > >> > RSDP points to XSDT which in turn points to other tables. >> > >> > Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> >> > --- >> > hw/arm/virt-acpi-build.c | 22 ++++++++++++++++++++++ >> > 1 files changed, 22 insertions(+), 0 deletions(-) >> > >> > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c >> > index 4eed0a3..9c3971a 100644 >> > --- a/hw/arm/virt-acpi-build.c >> > +++ b/hw/arm/virt-acpi-build.c >> > @@ -86,6 +86,28 @@ static inline void acpi_add_table(GArray *table_offsets, GArray *table_data) >> > static GArray * >> > build_rsdp(GArray *rsdp_table, GArray *linker, uint64_t xsdt) >> > { >> > + AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp); >> > + >> > + bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16, >> > + true /* fseg memory */); >> > + >> > + memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); >> > + memcpy(rsdp->oem_id, ACPI_VIRT_QEMU_STR_6, sizeof(rsdp->oem_id)); >> > + rsdp->length = cpu_to_le32(sizeof(*rsdp)); >> > + rsdp->revision = 0x02; >> > + >> > + /* Point to XSDT */ >> > + rsdp->xsdt_physical_address = cpu_to_le64(xsdt); > RSDP should be created after XSDT so XSDT pointer would be correct, > perhaps it's wrong patch ordering > Hi, About this I think the patch order is not wrong because at the moment we don't enable ACPI. So this code shouldn't execute. When all tables are generated OK, we could enable CONFIG_ACPI. Thanks, Shannon
On Tue, 27 Jan 2015 17:36:29 +0800 Shannon Zhao <zhaoshenglong@huawei.com> wrote: > On 2015/1/26 18:22, Igor Mammedov wrote: > > On Sat, 24 Jan 2015 17:21:12 +0800 > > Shannon Zhao <zhaoshenglong@huawei.com> wrote: > > > >> > RSDP points to XSDT which in turn points to other tables. > >> > > >> > Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> > >> > --- > >> > hw/arm/virt-acpi-build.c | 22 ++++++++++++++++++++++ > >> > 1 files changed, 22 insertions(+), 0 deletions(-) > >> > > >> > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > >> > index 4eed0a3..9c3971a 100644 > >> > --- a/hw/arm/virt-acpi-build.c > >> > +++ b/hw/arm/virt-acpi-build.c > >> > @@ -86,6 +86,28 @@ static inline void acpi_add_table(GArray *table_offsets, GArray *table_data) > >> > static GArray * > >> > build_rsdp(GArray *rsdp_table, GArray *linker, uint64_t xsdt) > >> > { > >> > + AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp); > >> > + > >> > + bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16, > >> > + true /* fseg memory */); > >> > + > >> > + memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); > >> > + memcpy(rsdp->oem_id, ACPI_VIRT_QEMU_STR_6, sizeof(rsdp->oem_id)); > >> > + rsdp->length = cpu_to_le32(sizeof(*rsdp)); > >> > + rsdp->revision = 0x02; > >> > + > >> > + /* Point to XSDT */ > >> > + rsdp->xsdt_physical_address = cpu_to_le64(xsdt); > > RSDP should be created after XSDT so XSDT pointer would be correct, > > perhaps it's wrong patch ordering > > > Hi, > > About this I think the patch order is not wrong because at the moment we don't enable ACPI. Yes would work, but it still more clear when tables are created in order in which they are used not backwards. > So this code shouldn't execute. When all tables are generated OK, we could enable CONFIG_ACPI. > > > Thanks, > Shannon > >
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 4eed0a3..9c3971a 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -86,6 +86,28 @@ static inline void acpi_add_table(GArray *table_offsets, GArray *table_data) static GArray * build_rsdp(GArray *rsdp_table, GArray *linker, uint64_t xsdt) { + AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp); + + bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16, + true /* fseg memory */); + + memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); + memcpy(rsdp->oem_id, ACPI_VIRT_QEMU_STR_6, sizeof(rsdp->oem_id)); + rsdp->length = cpu_to_le32(sizeof(*rsdp)); + rsdp->revision = 0x02; + + /* Point to XSDT */ + rsdp->xsdt_physical_address = cpu_to_le64(xsdt); + /* Address to be filled by Guest linker */ + bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE, + ACPI_BUILD_TABLE_FILE, + rsdp_table, &rsdp->xsdt_physical_address, + sizeof rsdp->xsdt_physical_address); + rsdp->checksum = 0; + /* Checksum to be filled by Guest linker */ + bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, + rsdp, rsdp, sizeof *rsdp, &rsdp->checksum); + return rsdp_table; }
RSDP points to XSDT which in turn points to other tables. Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> --- hw/arm/virt-acpi-build.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)