All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: HPET force enable for Soekris net6501
@ 2014-02-14 10:23 Conrad Kostecki
  2014-02-14 17:46 ` H. Peter Anvin
  0 siblings, 1 reply; 66+ messages in thread
From: Conrad Kostecki @ 2014-02-14 10:23 UTC (permalink / raw)
  To: linux-kernel, x86; +Cc: tglx, mingo, hpa

Hello,
as the Soekris net6501 does not have any ACPI implementation, HPET won't get enabled.
This patch enables HPET on such platforms.

[    0.430149] pci 0000:00:01.0: Force enabled HPET at 0xfed00000
[    0.644838] HPET: 3 timers in total, 0 timers will be used for per-cpu timer

Original patch by Peter Neubauer, slightly modified by me.
-> http://www.mail-archive.com/soekris-tech@lists.soekris.com/msg06462.html

Cheers
Conrad

Signed-off-by: Peter Neubauer <pneubauer@bluerwhite.org>
Signed-off-by: Conrad Kostecki <ck@conrad-kostecki.de>

--- a/arch/x86/kernel/quirks.c	2014-02-14 11:13:27.703432732 +0100
+++ b/arch/x86/kernel/quirks.c	2014-02-14 11:14:32.327496474 +0100
@@ -498,6 +498,25 @@ void force_hpet_resume(void)
 }
 
 /*
+ * Soekris net6501, based on Atom E6xx series, does not have ACPI.
+ * HPET should be force enabled on such platforms.
+ */
+static void e6xx_force_enable_hpet(struct pci_dev *dev)
+{
+	if (hpet_address || force_hpet_address)
+		return;
+
+	force_hpet_address = 0xFED00000;
+	force_hpet_resume_type = NONE_FORCE_HPET_RESUME;
+	dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
+		"0x%lx\n", force_hpet_address);
+	return;
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E6XX_CU,
+			 e6xx_force_enable_hpet);
+
+/*
  * HPET MSI on some boards (ATI SB700/SB800) has side effect on
  * floppy DMA. Disable HPET MSI on such platforms.
  * See erratum #27 (Misinterpreted MSI Requests May Result in
--- a/include/linux/pci_ids.h	2014-02-14 11:13:00.575408953 +0100
+++ b/include/linux/pci_ids.h	2014-02-14 11:13:37.819442066 +0100
@@ -2854,6 +2854,7 @@
 #define PCI_DEVICE_ID_INTEL_82372FB_1	0x7601
 #define PCI_DEVICE_ID_INTEL_SCH_LPC	0x8119
 #define PCI_DEVICE_ID_INTEL_SCH_IDE	0x811a
+#define PCI_DEVICE_ID_INTEL_E6XX_CU	0x8183
 #define PCI_DEVICE_ID_INTEL_ITC_LPC	0x8186
 #define PCI_DEVICE_ID_INTEL_82454GX	0x84c4
 #define PCI_DEVICE_ID_INTEL_82450GX	0x84c5


^ permalink raw reply	[flat|nested] 66+ messages in thread
* [Devel] [PATCH 1/4] ACPI: Provide support for ACPI table adding via OS
@ 2014-02-28 17:23 Thomas Renninger
  0 siblings, 0 replies; 66+ messages in thread
From: Thomas Renninger @ 2014-02-28 17:23 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 5728 bytes --]

This is done the same way as the previous ACPI physical table override
mechanism.
How to override or add tables via initrd, please look up:
Documentation/acpi/initrd_table_override.txt

SSDTs can only be overridden, not added.

Overriding only happens if the OEM id of the table header matches the one
with the BIOS provided one.
All table types (SSDTs are an exception), must only show up once.
So either you:
   - Add a fresh new table for adding of which type (signature) none exists
     in the BIOS  -> OS ACPI table adding happens.
or
   - Add a table which already exists in BIOS, but the OEM id must match the
     one of the table of the same type (signature) that exists in BIOS already
     -> OS ACPI table overriding happens
     Typically one copies away the original ACPI table, disassembles,
     modifies (for example adding debug strings), compiles it and provides
     the table via initrd for overriding (will have the same OEM id).
     But this is not necessary, one could also come up with a selfmade
     table for overriding, by taking care that the signature and OEM id is
     the same as the one provided by BIOS

In ACPI table overriding case you see in dmesg:
   ACPI: Override [DSDT-  BXDSDT], this is unsafe: tainting kernel
   Disabling lock debugging due to kernel taint

In ACPI table adding case you see in dmesg (BGRT table got added):
   ACPI: Add [BGRT-SLIC-WKS], this is unsafe: tainting kernel
   ACPI: BGRT 000000007fffd1ba 000038 (v00 HPQOEM SLIC-WKS 01072009
         INTL 20130823)

Signed-off-by: Thomas Renninger <trenn(a)suse.de>
CC: hpa(a)zytor.com
CC: tglx(a)linutronix.de
CC: ck(a)conrad-kostecki.de
CC: linux-kernel(a)vger.kernel.org
CC: x86(a)kernel.org
CC: mingo(a)redhat.com
CC: rjw(a)rjwysocki.net
CC: devel(a)acpica.org
---
 drivers/acpi/osl.c |   91 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 90 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index fc1aa79..7f9a865 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -566,6 +566,8 @@ static const char * const table_sigs[] = {
 
 #define ACPI_OVERRIDE_TABLES 64
 static struct cpio_data __initdata acpi_initrd_files[ACPI_OVERRIDE_TABLES];
+/* Remember physical address of overriden or added tables */
+static acpi_physical_address acpi_table_overridden[ACPI_OVERRIDE_TABLES];
 
 #define MAP_CHUNK_SIZE   (NR_FIX_BTMAPS << PAGE_SHIFT)
 
@@ -715,7 +717,7 @@ acpi_os_physical_table_override(struct acpi_table_header *existing_table,
 	*address = 0;
 	return AE_OK;
 #else
-	int table_offset = 0;
+	int no, table_offset = 0;
 	struct acpi_table_header *table;
 
 	*table_length = 0;
@@ -759,6 +761,12 @@ acpi_os_physical_table_override(struct acpi_table_header *existing_table,
 		*table_length = table->length;
 		acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
 		*address = acpi_tables_addr + table_offset;
+		for (no = 0; no < ACPI_OVERRIDE_TABLES; no++) {
+			if (acpi_table_overridden[no] == 0) {
+				acpi_table_overridden[no] = *address;
+				break;
+			}
+		}
 		break;
 	} while (table_offset + ACPI_HEADER_SIZE < all_tables_size);
 
@@ -768,6 +776,87 @@ acpi_os_physical_table_override(struct acpi_table_header *existing_table,
 #endif
 }
 
+acpi_status
+acpi_os_physical_table_add(acpi_physical_address *address,
+			   u32 *table_length)
+{
+#ifndef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
+	*table_length = 0;
+	*address = 0;
+	return AE_OK;
+#else
+	int no, table_offset = 0;
+	struct acpi_table_header *table;
+
+	*table_length = 0;
+	*address = 0;
+
+	if (!acpi_tables_addr)
+		return AE_OK;
+
+	do {
+		if (table_offset + ACPI_HEADER_SIZE > all_tables_size) {
+			WARN_ON(1);
+			return AE_OK;
+		}
+
+		table = acpi_os_map_memory(acpi_tables_addr + table_offset,
+					   ACPI_HEADER_SIZE);
+
+		if (table_offset + table->length > all_tables_size) {
+			acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
+			WARN_ON(1);
+			return AE_OK;
+		}
+
+		table_offset += table->length;
+
+		/* Do not add SSDTs, only if acpi_no_auto_ssdt boot parameter
+		   got set.
+		*/
+		if (acpi_gbl_disable_ssdt_table_load == FALSE &&
+		    !memcmp("SSDT", table->signature, 4)) {
+			pr_info("Will not add SSDT [%8.8s], use acpi_no_auto_ssdt to force\n", table->oem_table_id);
+			acpi_os_unmap_memory(table,
+				     ACPI_HEADER_SIZE);
+			continue;
+		}
+
+		/* Only add tables that have not been overridden already */
+		for (no = 0; no < ACPI_OVERRIDE_TABLES; no++) {
+			if (acpi_table_overridden[no] == 0)
+				break;
+			if (acpi_table_overridden[no] ==
+			    acpi_tables_addr + table_offset - table->length)
+				break;
+		}
+		/* All tables have been added or overridden */
+		if (acpi_table_overridden[no] != 0) {
+			acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
+			continue;
+		}
+		/* Max table override/add limit reached */
+		if (no == ACPI_OVERRIDE_TABLES) {
+			acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
+			return AE_ERROR;
+		}
+
+		table_offset -= table->length;
+		*table_length = table->length;
+		*address = acpi_tables_addr + table_offset;
+		/* do not add this table again */
+		acpi_table_overridden[no] = *address;
+		pr_warn(PREFIX
+			"Add [%4.4s-%8.8s], this is unsafe: tainting kernel\n",
+			table->signature, table->oem_table_id);
+		add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE);
+		acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
+		return AE_OK;
+	} while (table_offset + ACPI_HEADER_SIZE < all_tables_size);
+	return AE_OK;
+#endif
+}
+
 static irqreturn_t acpi_irq(int irq, void *dev_id)
 {
 	u32 handled;
-- 
1.7.6.1


^ permalink raw reply related	[flat|nested] 66+ messages in thread
* Re: [Devel] [PATCH 1/4] ACPI: Provide support for ACPI table adding via OS
@ 2014-02-28 17:26 Thomas Renninger
  0 siblings, 0 replies; 66+ messages in thread
From: Thomas Renninger @ 2014-02-28 17:26 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

Latest changes are compile tested only!

If this gets serialized/merged and accepted in acpica in
some form with whatever other stuff currently added,
please drop me a mail.

I can then submit the Linux parts again to the kernel people
with the documentation adjusted as well:
Documentation/acpi/initrd_table_override.txt

Thanks,

     Thomas

^ permalink raw reply	[flat|nested] 66+ messages in thread

end of thread, other threads:[~2014-09-16  0:58 UTC | newest]

Thread overview: 66+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-14 10:23 [PATCH] x86: HPET force enable for Soekris net6501 Conrad Kostecki
2014-02-14 17:46 ` H. Peter Anvin
2014-02-14 18:06   ` AW: " Conrad Kostecki
2014-02-14 18:08     ` H. Peter Anvin
2014-02-14 18:13       ` AW: " Conrad Kostecki
2014-02-14 18:16         ` H. Peter Anvin
2014-02-14 18:21           ` Thomas Gleixner
2014-02-14 18:22             ` H. Peter Anvin
2014-02-14 18:38               ` Thomas Gleixner
2014-02-14 18:39                 ` H. Peter Anvin
2014-02-14 19:15                   ` Thomas Gleixner
2014-02-14 19:26                     ` H. Peter Anvin
2014-02-14 19:59                       ` Thomas Gleixner
2014-02-14 20:06                         ` H. Peter Anvin
2014-02-14 21:16                           ` Thomas Gleixner
2014-02-14 21:18                             ` H. Peter Anvin
2014-02-14 21:47                               ` Thomas Gleixner
2014-02-14 21:48                                 ` H. Peter Anvin
2014-02-17 16:28                             ` Thomas Renninger
2014-02-17 17:19                               ` H. Peter Anvin
2014-02-17 18:23                                 ` Thomas Renninger
2014-02-17 18:23                                   ` [Devel] " Thomas Renninger
2014-02-17 18:47                                   ` AW: AW: " H. Peter Anvin
2014-02-17 19:25                                     ` Thomas Renninger
2014-02-17 19:25                                       ` [Devel] " Thomas Renninger
2014-02-17 19:40                                       ` AW: AW: " H. Peter Anvin
2014-02-18 18:22                                         ` ACPI: Also allow ACPI table adding via initrd not only overriding Thomas Renninger
2014-02-18 18:22                                           ` [Devel] " Thomas Renninger
2014-02-18 18:22                                           ` [PATCH 1/4] ACPI: Provide support for ACPI table adding via OS Thomas Renninger
2014-02-18 18:22                                             ` [Devel] " Thomas Renninger
2014-02-18 18:27                                             ` H. Peter Anvin
2014-02-18 18:44                                               ` Thomas Renninger
2014-02-18 18:44                                                 ` [Devel] " Thomas Renninger
2014-02-18 20:51                                                 ` H. Peter Anvin
2014-02-19 11:22                                                   ` Thomas Renninger
2014-02-19 11:22                                                     ` [Devel] " Thomas Renninger
2014-02-21  7:24                                                     ` Zheng, Lv
2014-02-21  7:24                                                       ` Zheng, Lv
2014-02-21  7:28                                                 ` Zheng, Lv
2014-02-21  7:28                                                   ` Zheng, Lv
2014-02-18 18:22                                           ` [PATCH 2/4] ACPICA: Introduce new acpi_os_physical_table_add OS callback Thomas Renninger
2014-02-18 18:22                                             ` [Devel] " Thomas Renninger
2014-02-18 18:22                                           ` [PATCH 3/4] ACPICA: Add BGRT signature to known signatures Thomas Renninger
2014-02-18 18:22                                             ` [Devel] " Thomas Renninger
2014-02-18 18:22                                           ` [PATCH 4/4] ACPI: Add new table signatures that can be overridden/added Thomas Renninger
2014-02-18 18:22                                             ` [Devel] " Thomas Renninger
2014-02-18 18:38                                           ` [Devel] ACPI: Also allow ACPI table adding via initrd not only overriding Moore, Robert
2014-02-18 18:38                                             ` Moore, Robert
2014-02-18 18:52                                             ` Thomas Renninger
2014-02-18 18:52                                               ` Thomas Renninger
2014-02-18 19:59                                               ` Moore, Robert
2014-02-18 19:59                                                 ` Moore, Robert
2014-02-19 11:14                                                 ` Thomas Renninger
2014-02-19 11:14                                                   ` Thomas Renninger
2014-02-19 13:03                                                   ` Thomas Gleixner
2014-02-14 18:28           ` AW: AW: AW: [PATCH] x86: HPET force enable for Soekris net6501 Conrad Kostecki
2014-09-09 13:56             ` Eric Sesterhenn
2014-09-09 14:54               ` Thomas Gleixner
2014-09-09 15:26                 ` H. Peter Anvin
2014-09-09 15:41                   ` Thomas Gleixner
2014-09-12  9:41                   ` Eric Sesterhenn
2014-09-12 10:37                     ` Thomas Gleixner
2014-09-12 11:06                       ` [PATCH] x86: HPET force enable for e6xx based systems Eric Sesterhenn
2014-09-16  0:58                         ` [tip:x86/platform] " tip-bot for Peter Neubauer
2014-02-28 17:23 [Devel] [PATCH 1/4] ACPI: Provide support for ACPI table adding via OS Thomas Renninger
2014-02-28 17:26 Thomas Renninger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.