From: Len Brown <lenb@kernel.org>
To: sfi-devel@simplefirmware.org, linux-kernel@vger.kernel.org
Cc: Feng Tang <feng.tang@intel.com>, Len Brown <len.brown@intel.com>
Subject: [PATCH 2/8] SFI: include/linux/sfi.h
Date: Tue, 23 Jun 2009 03:14:00 -0400 [thread overview]
Message-ID: <b3fb5fa65a532941d61a8c8415495f752aac540d.1245740912.git.len.brown@intel.com> (raw)
In-Reply-To: <1245741246-6503-1-git-send-email-lenb@kernel.org>
In-Reply-To: <7425334c8329b15bec7cb4ecd0b17af042e97465.1245740912.git.len.brown@intel.com>
From: Feng Tang <feng.tang@intel.com>
linux/include/sfi.h defines everything that customers
of SFI need to know in order to use the SFI suport in the kernel.
The primary API is sfi_table_parse(), where a driver or another part
of the kernel can supply a handler to parse the named table.
Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
---
include/linux/sfi.h | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 161 insertions(+), 0 deletions(-)
create mode 100644 include/linux/sfi.h
diff --git a/include/linux/sfi.h b/include/linux/sfi.h
new file mode 100644
index 0000000..2164fc1
--- /dev/null
+++ b/include/linux/sfi.h
@@ -0,0 +1,161 @@
+/* sfi.h Simple Firmware Interface */
+
+/*
+ * Copyright (C) 2009, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef _LINUX_SFI_H
+#define _LINUX_SFI_H
+
+#ifdef CONFIG_SFI
+
+#define SFI_SYST_SEARCH_BEGIN 0x000E0000
+#define SFI_SYST_SEARCH_END 0x000FFFFF
+
+/* Table signatures reserved by the SFI specification */
+#define SFI_SIG_SYST "SYST"
+#define SFI_SIG_FREQ "FREQ"
+#define SFI_SIG_IDLE "IDLE"
+#define SFI_SIG_CPUS "CPUS"
+#define SFI_SIG_MTMR "MTMR"
+#define SFI_SIG_MRTC "MRTC"
+#define SFI_SIG_MMAP "MMAP"
+#define SFI_SIG_APIC "APIC"
+#define SFI_SIG_XSDT "XSDT" /* ACPI Extended System Description Table */
+#define SFI_SIG_WAKE "WAKE"
+
+#define SFI_SIGNATURE_SIZE 4
+#define SFI_OEM_ID_SIZE 6
+#define SFI_OEM_TABLE_ID_SIZE 8
+
+#define SFI_GET_ENTRY_NUM(ptable, entry) \
+ ((ptable->header.length - sizeof(struct sfi_table_header)) / \
+ (sizeof(struct entry)))
+/*
+ * Table structures must be byte-packed to match the SFI specification,
+ * as they are provided by the BIOS.
+ */
+#pragma pack(1)
+struct sfi_table_header {
+ char signature[SFI_SIGNATURE_SIZE];
+ u32 length;
+ u8 revision;
+ u8 checksum;
+ char oem_id[SFI_OEM_ID_SIZE];
+ char oem_table_id[SFI_OEM_TABLE_ID_SIZE];
+};
+
+struct sfi_table_simple {
+ struct sfi_table_header header;
+ u64 pentry[1];
+};
+
+/* comply with UEFI spec 2.1 */
+struct sfi_mem_entry {
+ u32 type;
+ u64 phy_start;
+ u64 vir_start;
+ u64 pages;
+ u64 attrib;
+};
+
+struct sfi_cpu_table_entry {
+ u32 apicid;
+};
+
+struct sfi_cstate_table_entry {
+ u32 hint; /* MWAIT hint */
+ u32 latency; /* latency in ms */
+};
+
+struct sfi_apic_table_entry {
+ u64 phy_addr; /* phy base addr for APIC reg */
+};
+
+struct sfi_freq_table_entry {
+ u32 freq;
+ u32 latency; /* transition latency in ms */
+ u32 ctrl_val; /* value to write to PERF_CTL to enter this state */
+};
+
+struct sfi_wake_table_entry {
+ u64 phy_addr;
+};
+
+struct sfi_timer_table_entry {
+ u64 phy_addr; /* phy base addr for the timer */
+ u32 freq; /* in HZ */
+ u32 irq;
+};
+
+struct sfi_rtc_table_entry {
+ u64 phy_addr; /* phy base addr for the RTC */
+ u32 irq;
+};
+#pragma pack()
+
+extern int __init sfi_init_memory_map(void);
+extern int __init sfi_init(void);
+extern int __init sfi_platform_init(void);
+extern void __init sfi_init_late(void);
+
+typedef int (*sfi_table_handler) (struct sfi_table_header *table);
+
+int sfi_table_parse(char *signature, char *oem_id, char* oem_table_id,
+ uint flag, sfi_table_handler handler);
+
+void __init __iomem *
+arch_early_ioremap(unsigned long phys, unsigned long size);
+void __init arch_early_iounmap(void __iomem *virt, unsigned long size);
+
+
+extern int sfi_disabled;
+static inline void disable_sfi(void) { sfi_disabled = 1; }
+
+
+#else /* !CONFIG_SFI */
+
+static inline int sfi_init_memory_map(void) { return -1; }
+static inline int sfi_init(void) { return 0; }
+static inline void sfi_init_late(void) {}
+#define sfi_disabled 0
+
+static inline int sfi_table_parse(char *signature, char *oem_id, char* oem_table_id,
+ unsigned int flags, sfi_table_handler handler) { return -1; }
+
+#endif /* CONFIG_SFI */
+
+#endif /*_LINUX_SFI_H*/
--
1.6.0.6
next prev parent reply other threads:[~2009-06-23 7:16 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-23 7:13 [RFC/PATCH 2.6.32] Simple Firmware Interface (SFI): initial support Len Brown
2009-06-23 7:13 ` [PATCH 1/8] SFI: Simple Firmware Interface - new Linux sub-system Len Brown
2009-06-23 7:14 ` Len Brown [this message]
2009-06-23 7:28 ` [PATCH 2/8] SFI: include/linux/sfi.h Ingo Molnar
2009-06-23 7:47 ` Feng Tang
2009-06-23 8:00 ` Ingo Molnar
2009-06-23 8:02 ` Feng Tang
2009-06-23 8:09 ` Ingo Molnar
2009-06-23 15:14 ` H. Peter Anvin
2009-06-30 21:57 ` Andrew Morton
2009-06-30 21:59 ` Ingo Molnar
2009-06-23 9:06 ` Sam Ravnborg
2009-06-23 15:52 ` Feng Tang
2009-06-23 19:26 ` Sam Ravnborg
2009-06-23 7:14 ` [PATCH 3/8] SFI: core support Len Brown
2009-06-23 7:56 ` Ingo Molnar
2009-06-23 8:32 ` Feng Tang
2009-06-23 9:03 ` Ingo Molnar
2009-06-23 9:15 ` Feng Tang
2009-06-23 17:20 ` Len Brown
2009-06-23 19:20 ` Ingo Molnar
2009-06-23 12:32 ` Andi Kleen
2009-06-23 16:57 ` Len Brown
2009-06-24 3:34 ` Feng Tang
2009-06-24 7:12 ` Andi Kleen
2009-06-24 7:40 ` Feng Tang
2009-06-24 7:55 ` Andi Kleen
2009-06-23 7:14 ` [PATCH 4/8] SFI: Hook boot-time initialization Len Brown
2009-06-23 7:14 ` [PATCH 5/8] SFI: Hook e820 memory map initialization Len Brown
2009-06-23 7:14 ` [PATCH 6/8] SFI: add ACPI extensions Len Brown
2009-06-23 12:18 ` Andi Kleen
2009-06-23 16:51 ` Len Brown
2009-06-23 7:14 ` [PATCH 7/8] SFI, PCI: Hook MMCONFIG Len Brown
2009-06-23 7:14 ` [PATCH 8/8] SFI: expose IO-APIC routines to SFI, not just ACPI Len Brown
2009-06-23 7:58 ` Ingo Molnar
2009-06-23 7:23 ` [PATCH 1/8] SFI: Simple Firmware Interface - new Linux sub-system Ingo Molnar
2009-06-23 18:31 ` [RFC/PATCH 2.6.32] Simple Firmware Interface (SFI): initial support Matthew Garrett
2009-06-23 18:41 ` Len Brown
2009-06-22 19:43 ` Pavel Machek
2009-06-24 21:13 ` Len Brown
2009-07-11 22:02 ` Pavel Machek
2009-07-13 3:25 ` [SFI-devel] " Peter Stuge
2009-06-23 18:51 ` Matthew Garrett
2009-06-23 20:00 ` Len Brown
2009-06-23 20:23 ` Matthew Garrett
2009-06-23 20:45 ` Matthew Garrett
2009-06-23 21:23 ` Alan Cox
2009-06-23 22:34 ` Len Brown
2009-06-23 22:20 ` Len Brown
2009-06-23 22:56 ` Matthew Garrett
2009-06-23 23:00 ` [SFI-devel] " Justen, Jordan L
2009-06-24 0:35 ` Len Brown
2009-06-23 21:33 ` Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b3fb5fa65a532941d61a8c8415495f752aac540d.1245740912.git.len.brown@intel.com \
--to=lenb@kernel.org \
--cc=feng.tang@intel.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sfi-devel@simplefirmware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®