Hi,
The Simple Boot Flag specification support (in
arch/x86/kernel/bootflag.c) is not really needed on embedded platforms,
so it can probably be compiled out. Zwane Mwaikambo did a patch a few
months (years ?) ago to configure out the compilation of that file, and
I've updated the patch to recent versions of the kernel.
However, after writing the patch, I discovered that the space savings
are not that interesting. When Zwane wrote the patch:
text data bss dec hex filename
1645 8 0 1653 675 arch/i386/kernel/bootflag.o
And now:
text data bss dec hex filename
310 8 0 318 13e arch/x86/kernel/bootflag.o
Which means that on the whole kernel, the savings are really small:
text data bss dec hex filename
1081314 121464 94208 1296986 13ca5a vmlinux.before
1081106 121460 94208 1296774 13c986 vmlinux.after
-208 -4 0 -212 -D4 +/-
Is it interesting to add such a patch to the kernel ?
I've enclosed the patch in that mail. Maybe it can considered as a
clean-up patch, because of the move to arch/x86/kernel/bootflag.c of
the acpi_parse_sbf() function ?
(Note: the arch/x86/kernel/acpi/boot.c file calls
acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf) twice, once in
acpi_boot_init() and once in acpi_boot_table_init(). Both functions are
called from setup_arch(), either in the 32bits and 64bits versions.
Can't we remove one of the call to acpi_table_parse() ? The patch below
assumes that the call to acpi_table_parse() has been removed from
acpi_boot_init(), but I can of course change that.)
Thanks for your comments,
Thomas
---
Allow to disable the compilation of Simple Boot Flag specification
support, which allows Linux to tell the BIOS various boot options.
Basically, the patch adds a BOOTFLAG configuration option, on which
the compilation of arch/x86/kernel/bootflag.c depends. The patch also
changes the way sbf_port is initialized by the ACPI initialization
routines. Instead of having sbf_port exported, we rather export the
sbf_acpi_parse() function (formerly known as acpi_parse_buf() and
implemented in the ACPI initialization code).
Result:
text data bss dec hex filename
1081314 121464 94208 1296986 13ca5a vmlinux.before
1081106 121460 94208 1296774 13c986 vmlinux.after
-208 -4 0 -212 -D4 +/-
This patch is part of the Linux Tiny project and is based on previous
work done by Zwane Mwaikambo <[email protected]>.
---
arch/x86/Kconfig | 8 ++++++++
arch/x86/kernel/Makefile | 3 ++-
arch/x86/kernel/acpi/boot.c | 17 +----------------
arch/x86/kernel/bootflag.c | 18 +++++++++++++++++-
include/linux/acpi.h | 10 +++++++++-
5 files changed, 37 insertions(+), 19 deletions(-)
Index: linux/arch/x86/Kconfig
===================================================================
--- linux.orig/arch/x86/Kconfig
+++ linux/arch/x86/Kconfig
@@ -439,6 +439,14 @@
affected by entries in the DMI blacklist. Required by PNP
BIOS code.
+config BOOTFLAG
+ default y
+ bool "Enable Simple Boot Flag specification support" if EMBEDDED
+ depends on ACPI
+ help
+ Enable support for the Simple Boot Flag specification, that
+ can be use by Linux to communicate boot options to the BIOS.
+
config GART_IOMMU
bool "GART IOMMU support" if EMBEDDED
default y
Index: linux/arch/x86/kernel/Makefile
===================================================================
--- linux.orig/arch/x86/kernel/Makefile
+++ linux/arch/x86/kernel/Makefile
@@ -15,7 +15,7 @@
obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o
obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o
obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o setup64.o
-obj-y += pci-dma_$(BITS).o bootflag.o e820_$(BITS).o
+obj-y += pci-dma_$(BITS).o e820_$(BITS).o
obj-y += quirks.o i8237.o topology.o kdebugfs.o
obj-y += alternative.o i8253.o
obj-$(CONFIG_X86_64) += pci-nommu_64.o bugs_64.o
@@ -58,6 +58,7 @@
obj-$(CONFIG_ACPI_SRAT) += srat_32.o
obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o
+obj-$(CONFIG_BOOTFLAG) += bootflag.o
obj-$(CONFIG_VM86) += vm86_32.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
Index: linux/arch/x86/kernel/acpi/boot.c
===================================================================
--- linux.orig/arch/x86/kernel/acpi/boot.c
+++ linux/arch/x86/kernel/acpi/boot.c
@@ -584,21 +584,6 @@
EXPORT_SYMBOL(acpi_unregister_ioapic);
-static int __init acpi_parse_sbf(struct acpi_table_header *table)
-{
- struct acpi_table_boot *sb;
-
- sb = (struct acpi_table_boot *)table;
- if (!sb) {
- printk(KERN_WARNING PREFIX "Unable to map SBF\n");
- return -ENODEV;
- }
-
- sbf_port = sb->cmos_index; /* Save CMOS port */
-
- return 0;
-}
-
#ifdef CONFIG_HPET_TIMER
#include <asm/hpet.h>
@@ -1170,7 +1155,7 @@
return error;
}
- acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
+ acpi_table_parse(ACPI_SIG_BOOT, sbf_acpi_parse);
/*
* blacklist may disable ACPI entirely
Index: linux/arch/x86/kernel/bootflag.c
===================================================================
--- linux.orig/arch/x86/kernel/bootflag.c
+++ linux/arch/x86/kernel/bootflag.c
@@ -18,7 +18,7 @@
#define SBF_DIAG (1<<2)
#define SBF_PARITY (1<<7)
-int sbf_port __initdata = -1; /* set via acpi_boot_init() */
+static int sbf_port __initdata = -1;
static int __init parity(u8 v)
{
@@ -76,6 +76,22 @@
return 1;
}
+/* called via acpi_boot_init() */
+int __init sbf_acpi_parse(struct acpi_table_header *table)
+{
+ struct acpi_table_boot *sb;
+
+ sb = (struct acpi_table_boot *)table;
+ if (!sb) {
+ printk(KERN_WARNING PREFIX "Unable to map SBF\n");
+ return -ENODEV;
+ }
+
+ sbf_port = sb->cmos_index; /* Save CMOS port */
+
+ return 0;
+}
+
static int __init sbf_init(void)
{
u8 v;
Index: linux/include/linux/acpi.h
===================================================================
--- linux.orig/include/linux/acpi.h
+++ linux/include/linux/acpi.h
@@ -119,7 +119,15 @@
extern struct acpi_mcfg_allocation *pci_mmcfg_config;
extern int pci_mmcfg_config_num;
-extern int sbf_port;
+#ifdef CONFIG_BOOTFLAG
+int sbf_acpi_parse(struct acpi_table_header *table);
+#else
+static inline int sbf_acpi_parse(struct acpi_table_header *table)
+{
+ return -ENODEV;
+}
+#endif
+
extern unsigned long acpi_realmode_flags;
int acpi_register_gsi (u32 gsi, int triggering, int polarity);
--
Thomas Petazzoni, Free Electrons
Free Embedded Linux Training Materials
on http://free-electrons.com/training
(More than 1500 pages!)
* Thomas Petazzoni <[email protected]> wrote:
> - acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
> + acpi_table_parse(ACPI_SIG_BOOT, sbf_acpi_parse);
no strong feelings if the ACPI guys ack it - but i suspect the renaming
of the function from acpi_parse_sbf to sbf_acpi_parse was unnecessary?
Ingo
Le Wed, 13 Feb 2008 10:29:58 +0100,
Ingo Molnar <[email protected]> a écrit :
> no strong feelings if the ACPI guys ack it - but i suspect the
> renaming of the function from acpi_parse_sbf to sbf_acpi_parse was
> unnecessary?
I rename acpi_parse_sbf() to sbf_acpi_parse() because the function was
moved from arch/x86/kernel/acpi/boot.c, where pretty much all functions
are named acpi_*() to the file arch/x86/kernel/bootflag.c, where all
the functions are named sbf_*(). However, I don't mind reverting that
renaming, I just thought it was cleaner, but I have no strong opinion
on it.
Any thoughts about the duplicate call to
acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf) ?
Thanks for your comments,
Thomas
--
Thomas Petazzoni, Free Electrons
Free Embedded Linux Training Materials
on http://free-electrons.com/training
(More than 1500 pages!)