Message ID | 1314179290-31526-2-git-send-email-trenn@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
? ??2011-08-24 ? 11:48 +0200?Thomas Renninger ??? > Currently it's only possible to feed acpica with virtual > address for table overriding. > This patch introduces a function which allows the OS to > pass physical addresses for table overriding. > > This is necessary to allow early table overridings of > arbitrary ACPI tables. > > An extra flag like ACPI_TABLE_ORIGIN_OVERRIDE is not used, > because physical address overriding is rather transparent > (the same way acpica expects to get tables from reserved > memory BIOS regions which is the normal way). > > Signed-off-by: Thomas Renninger <trenn@suse.de> > CC: devel@acpica.org > CC: linux-acpi@vger.kernel.org > CC: lenb@kernel.org > --- This patch works fine to me on Acer TravelMate 8572. Tested-by: Lee, Chun-Yi <jlee@suse.com> Thank's Joey Lee > drivers/acpi/acpica/tbinstal.c | 15 +++++++++++++++ > drivers/acpi/acpica/tbutils.c | 18 +++++++++++++++++- > drivers/acpi/osl.c | 11 +++++++++++ > include/acpi/acpiosxf.h | 4 ++++ > 4 files changed, 47 insertions(+), 1 deletions(-) > > diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c > index 62365f6..b9b9d2a 100644 > --- a/drivers/acpi/acpica/tbinstal.c > +++ b/drivers/acpi/acpica/tbinstal.c > @@ -242,6 +242,21 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) > table_desc->pointer = override_table; > table_desc->length = override_table->length; > table_desc->flags = ACPI_TABLE_ORIGIN_OVERRIDE; > + } else { > + acpi_physical_address address = 0; > + u32 table_len = 0; > + status = acpi_os_phys_table_override(table_desc->pointer, > + &address, &table_len); > + if (ACPI_SUCCESS(status) && table_len && address) { > + ACPI_INFO((AE_INFO, "%4.4s @ 0x%p " > + "Phys table override, replaced with:", > + table_desc->pointer->signature, > + ACPI_CAST_PTR(void, table_desc->address))); > + table_desc->address = address; > + table_desc->pointer = acpi_os_map_memory(address, > + table_len); > + table_desc->length = table_len; > + } > } > > /* Add the table to the global root table list */ > diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c > index 0f2d395..df85afe 100644 > --- a/drivers/acpi/acpica/tbutils.c > +++ b/drivers/acpi/acpica/tbutils.c > @@ -499,8 +499,24 @@ acpi_tb_install_table(acpi_physical_address address, > table_to_install = override_table; > flags = ACPI_TABLE_ORIGIN_OVERRIDE; > } else { > - table_to_install = mapped_table; > + u32 table_len = 0; > + acpi_physical_address tmp_addr = 0; > + > + status = acpi_os_phys_table_override(mapped_table, > + &tmp_addr, &table_len); > + if (ACPI_SUCCESS(status) && table_len && tmp_addr) { > + ACPI_INFO((AE_INFO, "%4.4s @ 0x%p " > + "Phys table override, replaced with:", > + mapped_table->signature, > + ACPI_CAST_PTR(void, address))); > + acpi_os_unmap_memory(mapped_table, > + sizeof(struct acpi_table_header)); > + mapped_table = acpi_os_map_memory(address, > + sizeof(struct acpi_table_header)); > + address = tmp_addr; > + } > flags = ACPI_TABLE_ORIGIN_MAPPED; > + table_to_install = mapped_table; > } > > /* Initialize the table entry */ > diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c > index fa32f58..49b5fa6 100644 > --- a/drivers/acpi/osl.c > +++ b/drivers/acpi/osl.c > @@ -522,6 +522,17 @@ acpi_os_table_override(struct acpi_table_header * existing_table, > return AE_OK; > } > > +acpi_status > +acpi_os_phys_table_override(struct acpi_table_header *existing_table, > + acpi_physical_address *address, u32 *table_length) > +{ > + if (!existing_table) > + return AE_BAD_PARAMETER; > + > + table_length = 0; > + return AE_OK; > +} > + > static irqreturn_t acpi_irq(int irq, void *dev_id) > { > u32 handled; > diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h > index 4543b6f..0bef969 100644 > --- a/include/acpi/acpiosxf.h > +++ b/include/acpi/acpiosxf.h > @@ -95,6 +95,10 @@ acpi_status > acpi_os_table_override(struct acpi_table_header *existing_table, > struct acpi_table_header **new_table); > > +acpi_status > +acpi_os_phys_table_override(struct acpi_table_header *existing_table, > + acpi_physical_address *address, u32 *table_length); > + > /* > * Spinlock primitives > */ > -- > 1.7.3.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 2011-08-24 at 17:48 +0800, Thomas Renninger wrote: > Currently it's only possible to feed acpica with virtual > address for table overriding. > This patch introduces a function which allows the OS to > pass physical addresses for table overriding. > > This is necessary to allow early table overridings of > arbitrary ACPI tables. > > An extra flag like ACPI_TABLE_ORIGIN_OVERRIDE is not used, > because physical address overriding is rather transparent > (the same way acpica expects to get tables from reserved > memory BIOS regions which is the normal way). > > Signed-off-by: Thomas Renninger <trenn@suse.de> > CC: devel@acpica.org > CC: linux-acpi@vger.kernel.org > CC: lenb@kernel.org > --- > drivers/acpi/acpica/tbinstal.c | 15 +++++++++++++++ > drivers/acpi/acpica/tbutils.c | 18 +++++++++++++++++- > drivers/acpi/osl.c | 11 +++++++++++ > include/acpi/acpiosxf.h | 4 ++++ > 4 files changed, 47 insertions(+), 1 deletions(-) > > diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c > index 62365f6..b9b9d2a 100644 > --- a/drivers/acpi/acpica/tbinstal.c > +++ b/drivers/acpi/acpica/tbinstal.c > @@ -242,6 +242,21 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) > table_desc->pointer = override_table; > table_desc->length = override_table->length; > table_desc->flags = ACPI_TABLE_ORIGIN_OVERRIDE; > + } else { > + acpi_physical_address address = 0; > + u32 table_len = 0; > + status = acpi_os_phys_table_override(table_desc->pointer, > + &address, &table_len); > + if (ACPI_SUCCESS(status) && table_len && address) { > + ACPI_INFO((AE_INFO, "%4.4s @ 0x%p " > + "Phys table override, replaced with:", > + table_desc->pointer->signature, > + ACPI_CAST_PTR(void, table_desc->address))); > + table_desc->address = address; > + table_desc->pointer = acpi_os_map_memory(address, > + table_len); > + table_desc->length = table_len; > + } > } > > /* Add the table to the global root table list */ > diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c > index 0f2d395..df85afe 100644 > --- a/drivers/acpi/acpica/tbutils.c > +++ b/drivers/acpi/acpica/tbutils.c > @@ -499,8 +499,24 @@ acpi_tb_install_table(acpi_physical_address address, > table_to_install = override_table; > flags = ACPI_TABLE_ORIGIN_OVERRIDE; > } else { > - table_to_install = mapped_table; > + u32 table_len = 0; > + acpi_physical_address tmp_addr = 0; > + > + status = acpi_os_phys_table_override(mapped_table, > + &tmp_addr, &table_len); > + if (ACPI_SUCCESS(status) && table_len && tmp_addr) { > + ACPI_INFO((AE_INFO, "%4.4s @ 0x%p " > + "Phys table override, replaced with:", > + mapped_table->signature, > + ACPI_CAST_PTR(void, address))); > + acpi_os_unmap_memory(mapped_table, > + sizeof(struct acpi_table_header)); > + mapped_table = acpi_os_map_memory(address, > + sizeof(struct acpi_table_header)); > + address = tmp_addr; > + } > flags = ACPI_TABLE_ORIGIN_MAPPED; > + table_to_install = mapped_table; > } > > /* Initialize the table entry */ > diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c > index fa32f58..49b5fa6 100644 > --- a/drivers/acpi/osl.c > +++ b/drivers/acpi/osl.c > @@ -522,6 +522,17 @@ acpi_os_table_override(struct acpi_table_header * existing_table, > return AE_OK; > } > > +acpi_status > +acpi_os_phys_table_override(struct acpi_table_header *existing_table, > + acpi_physical_address *address, u32 *table_length) > +{ > + if (!existing_table) > + return AE_BAD_PARAMETER; > + > + table_length = 0; > + return AE_OK; > +} > + > static irqreturn_t acpi_irq(int irq, void *dev_id) > { > u32 handled; > diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h > index 4543b6f..0bef969 100644 > --- a/include/acpi/acpiosxf.h > +++ b/include/acpi/acpiosxf.h > @@ -95,6 +95,10 @@ acpi_status > acpi_os_table_override(struct acpi_table_header *existing_table, > struct acpi_table_header **new_table); > > +acpi_status > +acpi_os_phys_table_override(struct acpi_table_header *existing_table, > + acpi_physical_address *address, u32 *table_length); You add a new interface. Can we just extend the existing interface: acpi_os_table_override? Thanks, Lin Ming > + > /* > * Spinlock primitives > */ > -- > 1.7.3.4 > > _______________________________________________ > Devel mailing list > Devel@acpica.org > http://lists.acpica.org/listinfo/devel -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wednesday, August 31, 2011 04:43:42 AM Lin Ming wrote: > On Wed, 2011-08-24 at 17:48 +0800, Thomas Renninger wrote: ... > You add a new interface. Yes, is this a bigger problem? > Can we just extend the existing interface: acpi_os_table_override? Not sure how to do that without OS/ACPICA API changes. The virtual address handling is nasty. You have to differ early mappings (early_ioremap) and later mappings (io/memremap). Re-mapping later is not possible because the physical address is lost with the current overriding interface. The physical address usage is transparent and from what I can see the only way to provide proper table overriding. If it's ok to add more paramters to acpi_os_table_override and either pass the virtual (as before) or the physical address, this would work: acpi_os_table_override(struct acpi_table_header *existing_table, struct acpi_table_header **new_table, acpi_physical_address *address, u32 *table_length); This would be an interface change which looked even worse to me, than adding a new function. Thomas -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index 62365f6..b9b9d2a 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c @@ -242,6 +242,21 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) table_desc->pointer = override_table; table_desc->length = override_table->length; table_desc->flags = ACPI_TABLE_ORIGIN_OVERRIDE; + } else { + acpi_physical_address address = 0; + u32 table_len = 0; + status = acpi_os_phys_table_override(table_desc->pointer, + &address, &table_len); + if (ACPI_SUCCESS(status) && table_len && address) { + ACPI_INFO((AE_INFO, "%4.4s @ 0x%p " + "Phys table override, replaced with:", + table_desc->pointer->signature, + ACPI_CAST_PTR(void, table_desc->address))); + table_desc->address = address; + table_desc->pointer = acpi_os_map_memory(address, + table_len); + table_desc->length = table_len; + } } /* Add the table to the global root table list */ diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 0f2d395..df85afe 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c @@ -499,8 +499,24 @@ acpi_tb_install_table(acpi_physical_address address, table_to_install = override_table; flags = ACPI_TABLE_ORIGIN_OVERRIDE; } else { - table_to_install = mapped_table; + u32 table_len = 0; + acpi_physical_address tmp_addr = 0; + + status = acpi_os_phys_table_override(mapped_table, + &tmp_addr, &table_len); + if (ACPI_SUCCESS(status) && table_len && tmp_addr) { + ACPI_INFO((AE_INFO, "%4.4s @ 0x%p " + "Phys table override, replaced with:", + mapped_table->signature, + ACPI_CAST_PTR(void, address))); + acpi_os_unmap_memory(mapped_table, + sizeof(struct acpi_table_header)); + mapped_table = acpi_os_map_memory(address, + sizeof(struct acpi_table_header)); + address = tmp_addr; + } flags = ACPI_TABLE_ORIGIN_MAPPED; + table_to_install = mapped_table; } /* Initialize the table entry */ diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index fa32f58..49b5fa6 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -522,6 +522,17 @@ acpi_os_table_override(struct acpi_table_header * existing_table, return AE_OK; } +acpi_status +acpi_os_phys_table_override(struct acpi_table_header *existing_table, + acpi_physical_address *address, u32 *table_length) +{ + if (!existing_table) + return AE_BAD_PARAMETER; + + table_length = 0; + return AE_OK; +} + static irqreturn_t acpi_irq(int irq, void *dev_id) { u32 handled; diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 4543b6f..0bef969 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -95,6 +95,10 @@ acpi_status acpi_os_table_override(struct acpi_table_header *existing_table, struct acpi_table_header **new_table); +acpi_status +acpi_os_phys_table_override(struct acpi_table_header *existing_table, + acpi_physical_address *address, u32 *table_length); + /* * Spinlock primitives */
Currently it's only possible to feed acpica with virtual address for table overriding. This patch introduces a function which allows the OS to pass physical addresses for table overriding. This is necessary to allow early table overridings of arbitrary ACPI tables. An extra flag like ACPI_TABLE_ORIGIN_OVERRIDE is not used, because physical address overriding is rather transparent (the same way acpica expects to get tables from reserved memory BIOS regions which is the normal way). Signed-off-by: Thomas Renninger <trenn@suse.de> CC: devel@acpica.org CC: linux-acpi@vger.kernel.org CC: lenb@kernel.org --- drivers/acpi/acpica/tbinstal.c | 15 +++++++++++++++ drivers/acpi/acpica/tbutils.c | 18 +++++++++++++++++- drivers/acpi/osl.c | 11 +++++++++++ include/acpi/acpiosxf.h | 4 ++++ 4 files changed, 47 insertions(+), 1 deletions(-)