From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgDhY-0005NC-GB for qemu-devel@nongnu.org; Thu, 09 Apr 2015 10:45:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgDhV-00018I-QW for qemu-devel@nongnu.org; Thu, 09 Apr 2015 10:45:04 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:37336 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgDhV-00016W-Jc for qemu-devel@nongnu.org; Thu, 09 Apr 2015 10:45:01 -0400 References: <1428055432-12120-1-git-send-email-zhaoshenglong@huawei.com> <1428055432-12120-12-git-send-email-zhaoshenglong@huawei.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1428055432-12120-12-git-send-email-zhaoshenglong@huawei.com> Date: Thu, 09 Apr 2015 15:45:09 +0100 Message-ID: <871tjt1hu2.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v4 11/20] hw/arm/virt-acpi-build: Generate RSDP table List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Shannon Zhao Cc: peter.maydell@linaro.org, hangaohuai@huawei.com, mst@redhat.com, a.spyridakis@virtualopensystems.com, msalter@redhat.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, peter.huangpeng@huawei.com, hanjun.guo@linaro.org, imammedo@redhat.com, pbonzini@redhat.com, lersek@redhat.com, christoffer.dall@linaro.org, shannon.zhao@linaro.org Shannon Zhao writes: > From: Shannon Zhao > > RSDP points to RSDT which in turn points to other tables. > > Signed-off-by: Shannon Zhao > Signed-off-by: Shannon Zhao Reviewed-by: Alex Bennée > --- > hw/arm/virt-acpi-build.c | 35 ++++++++++++++++++++++++++++++++++- > 1 file changed, 34 insertions(+), 1 deletion(-) > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 85e84b1..dd5538b 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -176,6 +176,35 @@ static void acpi_dsdt_add_virtio(Aml *scope, const hwaddr *mmio_addrs, > } > } > > +/* RSDP */ > +static GArray * > +build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) > +{ > + 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_BUILD_APPNAME6, sizeof(rsdp->oem_id)); > + rsdp->length = cpu_to_le32(sizeof(*rsdp)); > + rsdp->revision = 0x02; > + > + /* Point to RSDT */ > + rsdp->rsdt_physical_address = cpu_to_le32(rsdt); > + /* Address to be filled by Guest linker */ > + bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE, > + ACPI_BUILD_TABLE_FILE, > + rsdp_table, &rsdp->rsdt_physical_address, > + sizeof rsdp->rsdt_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; > +} > + > /* RSDT */ > static void > build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets) > @@ -336,7 +365,7 @@ static > void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) > { > GArray *table_offsets; > - unsigned dsdt; > + unsigned dsdt, rsdt; > VirtAcpiCpuInfo cpuinfo; > GArray *tables_blob = tables->table_data; > > @@ -373,8 +402,12 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) > build_gtdt(tables_blob, tables->linker, guest_info); > > /* RSDT is pointed to by RSDP */ > + rsdt = tables_blob->len; > build_rsdt(tables_blob, tables->linker, table_offsets); > > + /* RSDP is in FSEG memory, so allocate it separately */ > + build_rsdp(tables->rsdp, tables->linker, rsdt); > + > /* Cleanup memory that's no longer used. */ > g_array_free(table_offsets, true); > } -- Alex Bennée