Skip to contentSkip to conversation

Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

PATCH In review Jonathan Campbell 8 participants 16 messages Sep 24, 2007 – Oct 2, 2007 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

Sorry for the long delay, been very busy since I last posted the 386 kernel patches back in July. Now that I have more free time I remade the patches in a cleaner manner, broken down into smaller patches, with fewer #ifdefs all over the place. most #ifdefs are in the include/asm-i386 headers now.

linux-2.6.22.7-embedded-disable-rdtsc.patch:
* Allows you to remove Pentium TSC register-based timing, which
would never be used on
a kernel targeting 386 and 486 boxes exclusively. Apparently
there is already a
CONFIG_X86_TSC out there, this patch makes it work as a means to
disable TSC support
entirely. Depends on CONFIG_EMBEDDED.

linux-2.6.22.7-embedded-dmi-disable-option.patch:
* Allows you to remove DMI (Desktop Management Interface) parsing.
Older computers do
not have DMI structures in the BIOS, on these computers the DMI
code is a waste of space.
In my tests with applying this patch and disabling DMI removes
6KB from
arch/i386/boot/bzImage after compile. Apparently there is already
a CONFIG_DMI out there,
and #ifdef's in some parts to check this, so all this patch does
is make CONFIG_DMI visible
from "make menuconfig" while patching up other parts (like ACPI)
that simply assume DMI
functions are there. Depends on CONFIG_EMBEDDED.

arch/i386/Kconfig +13 -4
diff -u -r linux-2.6.22.7-old/arch/i386/Kconfig linux-2.6.22.7/arch/i386/Kconfig
@@ -83,10 +83,6 @@
 	bool
 	default y
 
-config DMI
-	bool
-	default y
-
 source "init/Kconfig"
 
 menu "Processor type and features"
@@ -395,6 +391,19 @@
           XFree86 to initialize some video cards via BIOS. Disabling this
           option saves about 6k.
 
+config DMI
+	default y
+	bool "Enable DMI support" if EMBEDDED
+	depends on X86
+	help
+	  This enables support for processing the Desktop Management
+	  Interface structures present in most modern BIOSes. If you are
+	  building a kernel for an older Pentium, 486, or 386 system and
+	  memory is tight, you can disable this to help reduce the size
+	  of your kernel by about 6K.
+	  
+	  If unsure, say Y
+
 config TOSHIBA
 	tristate "Toshiba Laptop support"
 	---help---
arch/i386/kernel/acpi/boot.c +3 -1
diff -u -r linux-2.6.22.7-old/arch/i386/kernel/acpi/boot.c linux-2.6.22.7/arch/i386/kernel/acpi/boot.c
@@ -891,6 +891,7 @@
 	return 0;
 }
 
+#ifdef CONFIG_DMI
 static int __init dmi_disable_acpi(struct dmi_system_id *d)
 {
 	if (!acpi_force) {
@@ -1097,6 +1098,7 @@
 	 },
 	{}
 };
+#endif /* CONFIG_DMI */
 
 #endif				/* __i386__ */
 
@@ -1127,7 +1129,7 @@
 {
 	int error;
 
-#ifdef __i386__
+#if defined(__i386__) && defined(CONFIG_DMI)
 	dmi_check_system(acpi_dmi_table);
 #endif
 
arch/i386/kernel/acpi/sleep.c +3 -0
diff -u -r linux-2.6.22.7-old/arch/i386/kernel/acpi/sleep.c linux-2.6.22.7/arch/i386/kernel/acpi/sleep.c
@@ -86,6 +86,7 @@
 	return 0;
 }
 
+#ifdef CONFIG_DMI
 static __initdata struct dmi_system_id acpisleep_dmi_table[] = {
 	{			/* Reset video mode after returning from ACPI S3 sleep */
 	 .callback = reset_videomode_after_s3,
@@ -104,3 +105,5 @@
 }
 
 core_initcall(acpisleep_dmi_init);
+#endif
+
arch/i386/kernel/setup.c +2 -0
diff -u -r linux-2.6.22.7-old/arch/i386/kernel/setup.c linux-2.6.22.7/arch/i386/kernel/setup.c
@@ -611,7 +611,9 @@
 	 * NOTE: at this point the bootmem allocator is fully available.
 	 */
 
+#ifdef CONFIG_DMI
 	dmi_scan_machine();
+#endif
 
 #ifdef CONFIG_X86_GENERICARCH
 	generic_apic_probe();
arch/i386/kernel/tsc.c +4 -0
diff -u -r linux-2.6.22.7-old/arch/i386/kernel/tsc.c linux-2.6.22.7/arch/i386/kernel/tsc.c
@@ -290,6 +290,7 @@
 }
 EXPORT_SYMBOL_GPL(mark_tsc_unstable);
 
+#ifdef CONFIG_DMI
 static int __init dmi_mark_tsc_unstable(struct dmi_system_id *d)
 {
 	printk(KERN_NOTICE "%s detected: marking TSC unstable.\n",
@@ -310,6 +311,7 @@
 	 },
 	 {}
 };
+#endif
 
 /*
  * Make an educated guess if the TSC is trustworthy and synchronized
@@ -369,8 +371,10 @@
 	set_cyc2ns_scale(cpu_khz);
 	use_tsc_delay();
 
+#ifdef CONFIG_DMI
 	/* Check and install the TSC clocksource */
 	dmi_check_system(bad_tsc_dmi_table);
+#endif
 
 	unsynchronized_tsc();
 	check_geode_tsc_reliable();
drivers/acpi/Kconfig +1 -0
diff -u -r linux-2.6.22.7-old/drivers/acpi/Kconfig linux-2.6.22.7/drivers/acpi/Kconfig
@@ -263,6 +263,7 @@
 
 config ACPI_BLACKLIST_YEAR
 	int "Disable ACPI for systems before Jan 1st this year" if X86_32
+	depends on DMI
 	default 0
 	help
 	  enter a 4-digit year, eg. 2001 to disable ACPI by default
drivers/acpi/osl.c +2 -0
diff -u -r linux-2.6.22.7-old/drivers/acpi/osl.c linux-2.6.22.7/drivers/acpi/osl.c
@@ -139,7 +139,9 @@
 
 acpi_status __init acpi_os_initialize(void)
 {
+#ifdef CONFIG_DMI
 	dmi_check_system(acpi_osl_dmi_table);
+#endif
 	return AE_OK;
 }
 
arch/i386/Kconfig +12 -0
diff -u -r linux-2.6.22.7-old/arch/i386/Kconfig linux-2.6.22.7/arch/i386/Kconfig
@@ -362,6 +362,18 @@
 	  to disable it.  MCE support simply ignores non-MCE processors like
 	  the 386 and 486, so nearly everyone can say Y here.
 
+config X86_TSC
+	bool "Use TSC as time source" if EMBEDDED
+	depends on X86
+	default y
+	help
+	  Uses the TSC (time stamp counter) in Pentium and newer systems as a
+	  high resolution timer. If you are compiling a kernel for older 386
+	  and 486 systems that do not have this counter, you can say N here
+	  to help reduce the size of your kernel.
+	  
+	  If unsure, say Y.
+
 config X86_MCE_NONFATAL
 	tristate "Check for non-fatal errors on AMD Athlon/Duron / Intel Pentium 4"
 	depends on X86_MCE
arch/i386/kernel/Makefile +2 -1
diff -u -r linux-2.6.22.7-old/arch/i386/kernel/Makefile linux-2.6.22.7/arch/i386/kernel/Makefile
@@ -7,8 +7,9 @@
 obj-y	:= process.o signal.o entry.o traps.o irq.o \
 		ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
 		pci-dma.o i386_ksyms.o i387.o bootflag.o e820.o\
-		quirks.o i8237.o topology.o alternative.o i8253.o tsc.o
+		quirks.o i8237.o topology.o alternative.o i8253.o
 
+obj-$(CONFIG_X86_TSC)		+= tsc.o
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
 obj-y				+= cpu/
 obj-y				+= acpi/
arch/i386/kernel/cpu/amd.c +2 -0
diff -u -r linux-2.6.22.7-old/arch/i386/kernel/cpu/amd.c linux-2.6.22.7/arch/i386/kernel/cpu/amd.c
@@ -117,6 +117,7 @@
 				break;
 			}
 			
+#ifdef CONFIG_X86_TSC /* this test requires the presence of the TSC */
 			if ( c->x86_model == 6 && c->x86_mask == 1 ) {
 				const int K6_BUG_LOOP = 1000000;
 				int n;
@@ -144,6 +145,7 @@
 					printk("probably OK (after B9730xxxx).\n");
 				printk(KERN_INFO "Please see http://membres.lycos.fr/poulot/k6bug.html\n");
 			}
+#endif
 
 			/* K6 with old style WHCR */
 			if (c->x86_model < 8 ||
arch/i386/lib/delay.c +4 -0
diff -u -r linux-2.6.22.7-old/arch/i386/lib/delay.c linux-2.6.22.7/arch/i386/lib/delay.c
@@ -37,6 +37,7 @@
 		:"0" (loops));
 }
 
+#ifdef CONFIG_X86_TSC
 /* TSC based delay: */
 static void delay_tsc(unsigned long loops)
 {
@@ -48,6 +49,7 @@
 		rdtscl(now);
 	} while ((now-bclock) < loops);
 }
+#endif
 
 /*
  * Since we calibrate only once at boot, this
@@ -55,6 +57,7 @@
  */
 static void (*delay_fn)(unsigned long) = delay_loop;
 
+#ifdef CONFIG_X86_TSC
 void use_tsc_delay(void)
 {
 	delay_fn = delay_tsc;
@@ -68,6 +71,7 @@
 	}
 	return -1;
 }
+#endif
 
 void __delay(unsigned long loops)
 {
include/asm-i386/cpufeature.h +4 -0
diff -u -r linux-2.6.22.7-old/include/asm-i386/cpufeature.h linux-2.6.22.7/include/asm-i386/cpufeature.h
@@ -119,7 +119,11 @@
 #define cpu_has_vme		boot_cpu_has(X86_FEATURE_VME)
 #define cpu_has_de		boot_cpu_has(X86_FEATURE_DE)
 #define cpu_has_pse		boot_cpu_has(X86_FEATURE_PSE)
+#ifdef CONFIG_X86_TSC
 #define cpu_has_tsc		boot_cpu_has(X86_FEATURE_TSC)
+#else
+#define cpu_has_tsc		0
+#endif
 #define cpu_has_pae		boot_cpu_has(X86_FEATURE_PAE)
 #define cpu_has_pge		boot_cpu_has(X86_FEATURE_PGE)
 #define cpu_has_apic		boot_cpu_has(X86_FEATURE_APIC)
include/asm-i386/delay.h +4 -0
diff -u -r linux-2.6.22.7-old/include/asm-i386/delay.h linux-2.6.22.7/include/asm-i386/delay.h
@@ -26,6 +26,10 @@
 	((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
 	__ndelay(n))
 
+#ifdef CONFIG_X86_TSC
 void use_tsc_delay(void);
+#else
+static inline void use_tsc_delay(void) { }
+#endif
 
 #endif /* defined(_I386_DELAY_H) */
include/asm-i386/msr.h +14 -0
diff -u -r linux-2.6.22.7-old/include/asm-i386/msr.h linux-2.6.22.7/include/asm-i386/msr.h
@@ -60,12 +60,14 @@
 	return err;
 }
 
+#ifdef CONFIG_X86_TSC
 static inline unsigned long long native_read_tsc(void)
 {
 	unsigned long long val;
 	asm volatile("rdtsc" : "=A" (val));
 	return val;
 }
+#endif
 
 static inline unsigned long long native_read_pmc(void)
 {
@@ -117,6 +119,8 @@
 		__err;							\
 	})
 
+#ifdef CONFIG_X86_TSC
+
 #define rdtscl(low)						\
 	((low) = (u32)native_read_tsc())
 
@@ -125,6 +129,16 @@
 
 #define write_tsc(val1,val2) wrmsr(0x10, val1, val2)
 
+#else /* CONFIG_X86_TSC */
+
+#define rdtscl(low) ((low) = 0)
+
+#define rdtscll(val) ((val) = 0)
+
+#define write_tsc(val1,val2)
+
+#endif /* CONFIG_X86_TSC */
+
 #define rdpmc(counter,low,high)					\
 	do {							\
 		u64 _l = native_read_pmc();			\
include/asm-i386/processor.h +4 -0
diff -u -r linux-2.6.22.7-old/include/asm-i386/processor.h linux-2.6.22.7/include/asm-i386/processor.h
@@ -24,7 +24,11 @@
 #include <asm/processor-flags.h>
 
 /* flag for disabling the tsc */
+#ifdef CONFIG_X86_TSC
 extern int tsc_disable;
+#else
+#  define tsc_disable 1
+#endif
 
 struct desc_struct {
 	unsigned long a,b;
include/asm-i386/timer.h +5 -0
diff -u -r linux-2.6.22.7-old/include/asm-i386/timer.h linux-2.6.22.7/include/asm-i386/timer.h
@@ -12,7 +12,12 @@
 extern int timer_ack;
 extern int no_timer_check;
 extern int no_sync_cmos_clock;
+
+#ifdef CONFIG_X86_TSC
 extern int recalibrate_cpu_khz(void);
+#else
+static inline int recalibrate_cpu_khz(void) { return -ENODEV; }
+#endif
 
 #ifndef CONFIG_PARAVIRT
 #define get_scheduled_cycles(val) rdtscll(val)
include/asm-i386/timex.h +5 -1
diff -u -r linux-2.6.22.7-old/include/asm-i386/timex.h linux-2.6.22.7/include/asm-i386/timex.h
@@ -15,8 +15,12 @@
 #  define CLOCK_TICK_RATE 1193182 /* Underlying HZ */
 #endif
 
-
+#ifdef CONFIG_X86_TSC
 extern int read_current_timer(unsigned long *timer_value);
+#else
+static inline int read_current_timer(unsigned long *timer_value) { return -1; }
+#endif
+
 #define ARCH_HAS_READ_CURRENT_TIMER	1
 
 #endif
include/asm-i386/tsc.h +16 -1
diff -u -r linux-2.6.22.7-old/include/asm-i386/tsc.h linux-2.6.22.7/include/asm-i386/tsc.h
@@ -25,7 +25,7 @@
 		return 0;
 #endif
 
-#if defined(CONFIG_X86_GENERIC) || defined(CONFIG_X86_TSC)
+#if defined(CONFIG_X86_GENERIC) && defined(CONFIG_X86_TSC)
 	rdtscll(ret);
 #endif
 	return ret;
@@ -34,6 +34,7 @@
 /* Like get_cycles, but make sure the CPU is synchronized. */
 static __always_inline cycles_t get_cycles_sync(void)
 {
+#ifdef CONFIG_X86_TSC
 	unsigned long long ret;
 	unsigned eax, edx;
 
@@ -57,8 +58,12 @@
 	rdtscll(ret);
 
 	return ret;
+#else
+	return 0;
+#endif
 }
 
+#ifdef CONFIG_X86_TSC
 extern void tsc_init(void);
 extern void mark_tsc_unstable(char *reason);
 extern int unsynchronized_tsc(void);
@@ -70,5 +75,15 @@
  */
 extern void check_tsc_sync_source(int cpu);
 extern void check_tsc_sync_target(void);
+#else /* CONFIG_X86_TSC */
+/* effectively disable all calls to TSC functions.
+ * GCC should optimize these inline functions down to nothing. */
+static inline void tsc_init(void) { }
+static inline void mark_tsc_unstable(char *reason) { }
+static inline int unsynchronized_tsc(void) { return 1; }
+static inline void init_tsc_clocksource(void) { }
+static inline void check_tsc_sync_source(int cpu) { }
+static inline void check_tsc_sync_target(void) { }
+#endif /* CONFIG_X86_TSC */
 
 #endif
#1 lore raw
Quoted 7 lines · On Mon, 24 Sep 2007 01:51:17 -0700 Jonathan Campbell wrote:

Sorry for the long delay, been very busy since I last posted the 386 kernel patches back in July.
Now that I have more free time I remade the patches in a cleaner manner, broken down into
smaller patches, with fewer #ifdefs all over the place. most #ifdefs are in the include/asm-i386 headers
now.

Regarding only the DMI-disable patch:

Quoted 6 lines

linux-2.6.22.7-embedded-dmi-disable-option.patch:
* Allows you to remove DMI (Desktop Management Interface) parsing.
Older computers do
not have DMI structures in the BIOS, on these computers the DMI
code is a waste of space.
In my tests with applying this patch and disabling DMI removes

Quoted 8 lines

6KB from
arch/i386/boot/bzImage after compile. Apparently there is already
a CONFIG_DMI out there,
and #ifdef's in some parts to check this, so all this patch does
is make CONFIG_DMI visible
from "make menuconfig" while patching up other parts (like ACPI)
that simply assume DMI
functions are there. Depends on CONFIG_EMBEDDED.

This seems reasonable, so I tried to use it. Here are the results and comments and meta-comments.

1. Please forcibly wrap text lines in mail body at around column 70-72.

2. Put patches inline in the mail body, not as attachments.

3. Make patches against current mainline (e.g., 2.6.23-rc7), not against the stable tree. Mainline is where someone would end up applying them.

4. The DMI patch does not build against current mainline. It needs the additional patch below (at end of mail).

5. The Kconfig part of the DMI patch contains a trailing space. No brownie today.

6. The Kconfig entry for "config DMI" should not be listed under "Processor types and features". It should just go into the main EMBEDDED menu:

menuconfig EMBEDDED
bool "Configure standard kernel features (for small systems)"

After all of these fixes, I can ack the patch.

---

From: Randy Dunlap <[email protected]>

---
 drivers/acpi/thermal.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/thermal.c +2 -0
@@ -1440,7 +1440,9 @@ static int __init acpi_thermal_init(void
 {
 	int result = 0;
 
+#ifdef CONFIG_DMI
 	dmi_check_system(thermal_dmi_table);
+#endif /* CONFIG_DMI */
 
 	if (off) {
 		printk(KERN_NOTICE "ACPI: thermal control disabled\n");
#2 lore raw

Here is the DMI patch again, written against linux-2.6.23-rc8, with some of the #ifdef CONFIG_DMI's removed and moved to include/linux/dmi.h. Putting them there in the way I've done ensures that you don't have to put #ifdef CONFIG_DMI around each dmi_check_machine() and that you don't have to apply little patches to so many device drivers.

arch/i386/Kconfig 2007-09-26 00:01:48.000000000 +0000 renamed from arch/i386/Kconfig 2007-09-21 22:38:23.000000000 +0000 +0 -4
diff -u -r linux-2.6.23-rc8-old/arch/i386/Kconfig linux-2.6.23-rc8/arch/i386/Kconfig
@@ -83,10 +83,6 @@
    bool
    default y
 
-config DMI
-    bool
-    default y
-

source "init/Kconfig"

menu "Processor type and features"

arch/i386/kernel/acpi/boot.c 2007-09-26 00:40:42.000000000 +0000 renamed from arch/i386/kernel/acpi/boot.c 2007-09-21 22:38:23.000000000 +0000 +0 -0
diff -u -r linux-2.6.23-rc8-old/arch/i386/kernel/acpi/boot.c linux-2.6.23-rc8/arch/i386/kernel/acpi/boot.c
@@ -869,7 +869,7 @@
    return;

}

-#ifdef __i386__
+#if defined(__i386__) && defined(CONFIG_DMI)

static int __init disable_acpi_irq(struct dmi_system_id *d) {
@@ -1097,8 +1097,7 @@

     },
    {}
};

-
-#endif /* __i386__ */
+#endif /* CONFIG_DMI && __i386__ */

/*
* acpi_boot_table_init() and acpi_boot_init()

arch/i386/kernel/acpi/sleep.c 2007-09-25 23:59:14.000000000 +0000 renamed from arch/i386/kernel/acpi/sleep.c 2007-09-21 22:38:23.000000000 +0000 +0 -0
diff -u -r linux-2.6.23-rc8-old/arch/i386/kernel/acpi/sleep.c linux-2.6.23-rc8/arch/i386/kernel/acpi/sleep.c
@@ -86,6 +86,7 @@
    return 0;

}

+#ifdef CONFIG_DMI
static __initdata struct dmi_system_id acpisleep_dmi_table[] = {
{ /* Reset video mode after returning from ACPI S3 sleep */
.callback = reset_videomode_after_s3,
@@ -104,3 +105,5 @@
}

core_initcall(acpisleep_dmi_init);
+#endif
+

arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c 2007-09-26 00:59:26.000000000 +0000 renamed from arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c 2007-09-21 22:38:23.000000000 +0000 +0 -0
diff -u -r linux-2.6.23-rc8-old/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c linux-2.6.23-rc8/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -535,7 +535,7 @@
    return 0;

}

-#ifdef CONFIG_SMP
+#if defined(CONFIG_SMP) && defined(CONFIG_DMI)
/*
* Some BIOSes do SW_ANY coordination internally, either set it up in hw
* or do it in BIOS firmware and won't inform about it to OS. If not
@@ -562,7 +562,9 @@

    },
    { }
};

-#endif
+#else
+# define bios_with_sw_any_bug 0
+#endif /* CONFIG_SMP && CONFIG_DMI */

static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) {

arch/i386/kernel/reboot.c 2007-09-26 01:00:08.000000000 +0000 renamed from arch/i386/kernel/reboot.c 2007-09-21 22:38:23.000000000 +0000 +0 -0
diff -u -r linux-2.6.23-rc8-old/arch/i386/kernel/reboot.c linux-2.6.23-rc8/arch/i386/kernel/reboot.c
@@ -71,6 +71,7 @@
 

__setup("reboot=", reboot_setup);

+#ifdef CONFIG_DMI
/*
* Reboot options and system auto-detection code provided by
* Dell Inc. so their systems "just work". :-)
@@ -131,6 +132,7 @@

    },
    { }
};

+#endif /* CONFIG_DMI */

static int __init reboot_init(void)
{

arch/i386/kernel/tsc.c 2007-09-26 00:39:52.000000000 +0000 renamed from arch/i386/kernel/tsc.c 2007-09-21 22:38:23.000000000 +0000 +0 -0
diff -u -r linux-2.6.23-rc8-old/arch/i386/kernel/tsc.c linux-2.6.23-rc8/arch/i386/kernel/tsc.c
@@ -290,6 +290,7 @@

}
EXPORT_SYMBOL_GPL(mark_tsc_unstable);

+#ifdef CONFIG_DMI
static int __init dmi_mark_tsc_unstable(struct dmi_system_id *d) {
printk(KERN_NOTICE "%s detected: marking TSC unstable.\n",
@@ -310,6 +311,7 @@

     },
     {}
};

+#endif

/*
* Make an educated guess if the TSC is trustworthy and synchronized

arch/i386/mach-generic/bigsmp.c 2007-09-26 00:57:13.000000000 +0000 renamed from arch/i386/mach-generic/bigsmp.c 2007-09-21 22:38:23.000000000 +0000 +0 -0
diff -u -r linux-2.6.23-rc8-old/arch/i386/mach-generic/bigsmp.c linux-2.6.23-rc8/arch/i386/mach-generic/bigsmp.c
@@ -21,6 +21,7 @@
 

static int dmi_bigsmp; /* can be set by dmi scanners */

+#ifdef CONFIG_DMI
static int hp_ht_bigsmp(struct dmi_system_id *d)
{
#ifdef CONFIG_X86_GENERICARCH
@@ -30,7 +31,6 @@

    return 0;
}

-

static struct dmi_system_id bigsmp_dmi_table[] = {
    { hp_ht_bigsmp, "HP ProLiant DL760 G2", {
        DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
@@ -43,7 +43,7 @@
     }},
     { }
};

-
+#endif /* CONFIG_DMI */

static int probe_bigsmp(void)
{

arch/i386/pci/fixup.c 2007-09-26 01:17:23.000000000 +0000 renamed from arch/i386/pci/fixup.c 2007-09-21 22:38:23.000000000 +0000 +0 -0
diff -u -r linux-2.6.23-rc8-old/arch/i386/pci/fixup.c linux-2.6.23-rc8/arch/i386/pci/fixup.c
@@ -367,6 +367,7 @@
 */

static u16 toshiba_line_size;

+#ifdef CONFIG_DMI
static struct dmi_system_id __devinitdata toshiba_ohci1394_dmi_table[] = {
{
.ident = "Toshiba PS5 based laptop",
@@ -391,6 +392,7 @@

    },
    { }
};

+#endif

static void __devinit pci_pre_fixup_toshiba_ohci1394(struct pci_dev *dev) {

drivers/acpi/Kconfig 2007-09-25 23:59:14.000000000 +0000 renamed from drivers/acpi/Kconfig 2007-09-21 22:38:23.000000000 +0000 +0 -0
diff -u -r linux-2.6.23-rc8-old/drivers/acpi/Kconfig linux-2.6.23-rc8/drivers/acpi/Kconfig
@@ -263,6 +263,7 @@
 

config ACPI_BLACKLIST_YEAR
int "Disable ACPI for systems before Jan 1st this year" if X86_32
+ depends on DMI
default 0
help
enter a 4-digit year, eg. 2001 to disable ACPI by default

drivers/acpi/blacklist.c 2007-09-26 01:06:59.000000000 +0000 renamed from drivers/acpi/blacklist.c 2007-09-21 22:38:23.000000000 +0000 +0 -0
diff -u -r linux-2.6.23-rc8-old/drivers/acpi/blacklist.c linux-2.6.23-rc8/drivers/acpi/blacklist.c
@@ -73,7 +73,7 @@
    {""}

};

-#if CONFIG_ACPI_BLACKLIST_YEAR
+#if defined(CONFIG_ACPI_BLACKLIST_YEAR) && CONFIG_ACPI_BLACKLIST_YEAR > 0

static int __init blacklist_by_year(void)
{

drivers/acpi/processor_idle.c 2007-09-26 01:08:00.000000000 +0000 renamed from drivers/acpi/processor_idle.c 2007-09-21 22:38:23.000000000 +0000 +1 -1
diff -u -r linux-2.6.23-rc8-old/drivers/acpi/processor_idle.c linux-2.6.23-rc8/drivers/acpi/processor_idle.c
@@ -85,6 +85,7 @@
                                Power Management
   
-------------------------------------------------------------------------- */
 
+#ifdef CONFIG_DMI

/*
* IBM ThinkPad R40e crashes mysteriously when going into C2 or C3.
* For now disable this. Probably a bug somewhere else.
@@ -165,6 +166,7 @@

     (void *)2},
    {},
};

+#endif // CONFIG_DMI

static inline u32 ticks_elapsed(u32 t1, u32 t2)
{

drivers/input/mouse/Kconfig 2007-09-26 01:12:13.000000000 +0000 renamed from drivers/input/mouse/Kconfig 2007-09-21 22:38:23.000000000 +0000 +0 -0
diff -u -r linux-2.6.23-rc8-old/drivers/input/mouse/Kconfig linux-2.6.23-rc8/drivers/input/mouse/Kconfig
@@ -60,7 +60,7 @@

config MOUSE_PS2_SYNAPTICS
bool "Synaptics PS/2 mouse protocol extension" if EMBEDDED default y
- depends on MOUSE_PS2
+ depends on MOUSE_PS2 && DMI
help
Say Y here if you have a Synaptics PS/2 TouchPad connected to your system.
@@ -70,7 +70,7 @@
config MOUSE_PS2_LIFEBOOK
bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED default y
- depends on MOUSE_PS2
+ depends on MOUSE_PS2 && DMI
help
Say Y here if you have a Fujitsu B-series Lifebook PS/2 TouchScreen connected to your system.

drivers/input/serio/i8042-x86ia64io.h 2007-09-26 01:19:54.000000000 +0000 renamed from drivers/input/serio/i8042-x86ia64io.h 2007-09-21 22:38:23.000000000 +0000 +0 -0
diff -u -r linux-2.6.23-rc8-old/drivers/input/serio/i8042-x86ia64io.h linux-2.6.23-rc8/drivers/input/serio/i8042-x86ia64io.h
@@ -63,7 +63,7 @@
    outb(val, I8042_COMMAND_REG);

}

-#if defined(__i386__)
+#if defined(__i386__) && defined(CONFIG_DMI)

#include <linux/dmi.h>

@@ -472,7 +472,7 @@

        i8042_reset = 1;

#endif

-#if defined(__i386__)
+#if defined(__i386__) && defined(CONFIG_DMI)

    if (dmi_check_system(i8042_dmi_noloop_table))
        i8042_noloop = 1;
include/linux/dmi.h 2007-09-26 01:34:13.000000000 +0000 renamed from include/linux/dmi.h 2007-09-21 22:38:23.000000000 +0000 +0 -0
diff -u -r linux-2.6.23-rc8-old/include/linux/dmi.h linux-2.6.23-rc8/include/linux/dmi.h
@@ -73,12 +73,24 @@
 

#else

-static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } +/* use the C preprocessor to toss out the DMI id list, and redirect
+ * to an inline function that reduces down to 0 (failure). this
+ * satisfies code using this in if () ... else ... statements that
+ * do not use brackets where #define dmi_check_list(list) 0 would
+ * give many "statement reduces to nothing" errors. { } is a
+ * possibility except that many parts of the kernel do in fact
+ * check the return value, { } would result in a syntax error.
+ * we toss out the param because the list is included only if
+ * #ifdef CONFIG_DMI. without DMI the id list is not used, and
+ * a waste of memory, so it is #ifdef'd out. */
+#define dmi_check_system(list) dmi_check_system_NOTHING() +static inline int dmi_check_system_NOTHING(void) { return 0; }
+
static inline char * dmi_get_system_info(int field) { return NULL; } -static inline struct dmi_device * dmi_find_device(int type, const char *name,
- struct dmi_device *from) { return NULL; }
-static inline int dmi_get_year(int year) { return 0; }
-static inline int dmi_name_in_vendors(char *s) { return 0; } +#define dmi_find_device(type,name,from) NULL
+#define dmi_scan_machine() { }
+static inline int dmi_get_year(int field) { return 0; }
+static inline int dmi_name_in_vendors(char *str) { return 0; }

#endif

init/Kconfig 2007-09-26 00:03:05.000000000 +0000 renamed from init/Kconfig 2007-09-21 22:38:23.000000000 +0000 +12 -0
diff -u -r linux-2.6.23-rc8-old/init/Kconfig linux-2.6.23-rc8/init/Kconfig
@@ -542,6 +542,18 @@
      on EMBEDDED systems.  /proc/vmstat will only show page counts
      if VM event counters are disabled.
 
+config DMI
+    default y
+    bool "Enable DMI support" if EMBEDDED
+    depends on X86
+    help
+      This enables support for processing the Desktop Management
+      Interface structures present in most modern BIOSes. If you are
+      building a kernel for an older Pentium, 486, or 386 system and
+      memory is tight, you can disable this to help reduce the size
+      of your kernel by about 6K.
+      If unsure, say Y.
+

config SLUB_DEBUG
default y
bool "Enable SLUB debugging support" if EMBEDDED

#3 lore raw
Quoted 6 lines · On Wed, 26 Sep 2007 11:42:16 -0700 Jonathan Campbell wrote:

Here is the DMI patch again, written against linux-2.6.23-rc8, with some of the #ifdef CONFIG_DMI's removed and moved to include/linux/dmi.h. Putting them there in the way I've done ensures that you don't have to put #ifdef CONFIG_DMI around each dmi_check_machine() and that you don't have to apply little patches to so many device drivers.

This patch is horribly whitespace-damaged and does not apply to 2.6.23-rc8 as is:

Reversed (or previously applied) patch detected! Assume -R? [n] n Apply anyway? [n]
1 out of 1 hunk ignored -- saving rejects to file arch/i386/Kconfig.rej 1 out of 2 hunks FAILED -- saving rejects to file arch/i386/kernel/acpi/boot.c.rej 1 out of 1 hunk FAILED -- saving rejects to file drivers/acpi/Kconfig.rej 1 out of 1 hunk FAILED -- saving rejects to file drivers/acpi/blacklist.c.rej
patch: **** malformed patch at line 233: */

Please send it to yourself and make sure that you can apply it before sending it to the mailing list.

---
~Randy
Phaedrus says that Quality is about caring.

#4 lore raw
In reply to Jonathan Campbell
Quoted 6 lines · On Wed, 26 Sep 2007 11:42:16 -0700 Jonathan Campbell wrote:

Here is the DMI patch again, written against linux-2.6.23-rc8, with some of the #ifdef CONFIG_DMI's removed and moved to include/linux/dmi.h. Putting them there in the way I've done ensures that you don't have to put #ifdef CONFIG_DMI around each dmi_check_machine() and that you don't have to apply little patches to so many device drivers.

Damaged as the patch is, I was able to apply it by using 'patch -l' (ignore whitespace) + some fuzz. Not something that Linus or Andrew would or should do.

I built and booted the kernel, it's running fine (x86_32 notebook).

Quoted 9 lines

diff -u -r linux-2.6.23-rc8-old/init/Kconfig linux-2.6.23-rc8/init/Kconfig

init/Kconfig 2007-09-26 00:03:05.000000000 +0000 renamed from init/Kconfig 2007-09-21 22:38:23.000000000 +0000 +2 -0
@@ -542,6 +542,18 @@
       on EMBEDDED systems.  /proc/vmstat will only show page counts
       if VM event counters are disabled.
 
+config DMI
+    default y

init/Kconfig 2007-09-26 00:03:05.000000000 +0000 line 556

Quoted 10 lines
init/Kconfig 2007-09-26 00:03:05.000000000 +0000 renamed from init/Kconfig 2007-09-21 22:38:23.000000000 +0000 +10 -0
+    bool "Enable DMI support" if EMBEDDED
+    depends on X86
+    help
+      This enables support for processing the Desktop Management
+      Interface structures present in most modern BIOSes. If you are
+      building a kernel for an older Pentium, 486, or 386 system and
+      memory is tight, you can disable this to help reduce the size
+      of your kernel by about 6K.
+      If unsure, say Y.
+

This is in the General setup menu. How about putting it into the EMBEDDED menu instead? [Configure standard kernel features (for small systems)]

init/Kconfig 2007-09-26 00:03:05.000000000 +0000 line 559

Quoted 3 lines
init/Kconfig 2007-09-26 00:03:05.000000000 +0000 renamed from init/Kconfig 2007-09-21 22:38:23.000000000 +0000 +0 -0
 config SLUB_DEBUG
     default y
     bool "Enable SLUB debugging support" if EMBEDDED

There are still several build warnings that need attention:

drivers/acpi/sleep/main.c:223: warning: 'acpisleep_dmi_table' defined but not used drivers/pnp/pnpbios/core.c:509: warning: 'pnpbios_dmi_table' defined but not used arch/i386/pci/irq.c:1035: warning: 'pciirq_dmi_table' defined but not used arch/i386/pci/common.c:148: warning: 'pciprobe_dmi_table' defined but not used

+#endif // CONFIG_DMI

Use /* ... */ style comments instead of // comments.

---
~Randy
Phaedrus says that Quality is about caring.

#5 lore raw

Sorry about that. That's the reason I send them as attachments. Any suggestions for someone like myself using Mozilla Thunderbird?

Quoted 6 lines

Damaged as the patch is, I was able to apply it by using 'patch -l' (ignore whitespace) + some fuzz. Not something that Linus or Andrew would or should do.

I built and booted the kernel, it's running fine (x86_32 notebook).

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 2 lines · Jonathan Campbell

Sorry about that. That's why I always send as attachments. Do you have similar problems when using Mozilla Thunderbird?

tbird works when following the instructions at
http://mbligh.org/linuxdocs/Email/Clients/Thunderbird
or (simpler) use an External Editor plugin.

Quoted 1 line

And have you checked System.map to verify the DMI functions aren't there?

Nope. I expect(ed) you to do that, i.e., make sure that the patch does that the description says that it does.

Quoted 16 lines
Quoted 16 lines · On Wed, 26 Sep 2007 11:42:16 -0700 Jonathan Campbell wrote:
Quoted 9 lines

Here is the DMI patch again, written against linux-2.6.23-rc8, with some of the #ifdef CONFIG_DMI's removed and moved to include/linux/dmi.h. Putting them there in the way I've done ensures that you don't have to put #ifdef CONFIG_DMI around each dmi_check_machine() and that you don't have to apply little patches to so many device drivers.

Damaged as the patch is, I was able to apply it by using 'patch -l' (ignore whitespace) + some fuzz. Not something that Linus or Andrew would or should do.

I built and booted the kernel, it's running fine (x86_32 notebook).

Signature · 2 lines
~Randy
Phaedrus says that Quality is about caring.
#8 lore raw

Heh, well of course I vigoursly checked System.map. On my x86 and amd64 systems it removes them all. What a stupid question :-p

Quoted 2 lines

Nope. I expect(ed) you to do that, i.e., make sure that the patch does that the description says that it does.

#9 lore raw
In reply to Randy Dunlap
Quoted 8 lines · Randy Dunlap

This seems reasonable, so I tried to use it. Here are the results and comments and meta-comments.

1. Please forcibly wrap text lines in mail body at around column 70-72.

2. Put patches inline in the mail body, not as attachments.

I'll offer this suggestion, knowing it may piss you off, given the difficulty of preserving whitespace on *many* mailers without using attachments, and given that attachments can be saved easily without prying them out of the message, why don't you (one person) switch to a capable mail agent, if only for patches, instead of trying to teach many people to jump through hoops to avoid whitespace issues?

Not criticizing, just seems easier for everybody for you to avoid teaching people things they don't find useful elsewhere, or getting discouraged and not bothering.

Signature · 3 lines
Bill Davidsen <[email protected]>
  "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot
#10 lore raw
Quoted 8 lines · On Fri, 28 Sep 2007 17:24:20 -0400 Bill Davidsen wrote:
Quoted 6 lines · Randy Dunlap

This seems reasonable, so I tried to use it. Here are the results and comments and meta-comments.

1. Please forcibly wrap text lines in mail body at around column 70-72.

Quoted 8 lines
Quoted 2 lines

2. Put patches inline in the mail body, not as attachments.

I'll offer this suggestion, knowing it may piss you off, given the difficulty of preserving whitespace on *many* mailers without using attachments, and given that attachments can be saved easily without prying them out of the message, why don't you (one person) switch to a capable mail agent, if only for patches, instead of trying to teach many people to jump through hoops to avoid whitespace issues?

Is "you" referring to me? You didn't piss me off. I don't even understand what you are talking about.

BTW, lots of us have capable mail clients.

Quoted 3 lines

Not criticizing, just seems easier for everybody for you to avoid teaching people things they don't find useful elsewhere, or getting discouraged and not bothering.

(again, if "you" are referring to me:) I generally try to help people. Another option is just to give them no feedback and drop their patches. I think that's not useful or helpful at all.

---
~Randy
Phaedrus says that Quality is about caring.

#11 lore raw
In reply to Bill Davidsen
Quoted 10 lines · Bill Davidsen

I'll offer this suggestion, knowing it may piss you off, given the difficulty of preserving whitespace on *many* mailers without using attachments, and given that attachments can be saved easily without prying them out of the message, why don't you (one person) switch to a capable mail agent, if only for patches, instead of trying to teach many people to jump through hoops to avoid whitespace issues?

Not criticizing, just seems easier for everybody for you to avoid teaching people things they don't find useful elsewhere, or getting discouraged and not bothering.

Ehm, so you want people to save the patch, then when replying they should load the patch into their (much better) mail client where they can comment on the patch? That is the reason the patch should be inline. People need to comment on it just as they would comment on any other plain text email.

Well that and some people use git to import patches from the email in a mostly automated way which also expects them to have the info at top with signed-off and then the patch, which attachments also screw up.

So yes there are good reasons for getting a non broken mail client when sending patches to lkml.

--
Len Sorensen

#12 lore raw
Quoted 4 lines · Lennart Sorensen
Quoted 2 lines · Bill Davidsen

I'll offer this suggestion, knowing it may piss you off, given the difficulty of preserving whitespace on *many* mailers without using attachments, and given that attachments can be saved easily without prying them out of the message, why don't you (one person) switch to a capable mail agent, if only for patches, instead of trying to teach many people to jump through hoops to avoid whitespace issues?

Quoted 9 lines
Quoted 2 lines

Not criticizing, just seems easier for everybody for you to avoid teaching people things they don't find useful elsewhere, or getting discouraged and not bothering.

Ehm, so you want people to save the patch, then when replying they should load the patch into their (much better) mail client where they can comment on the patch? That is the reason the patch should be inline. People need to comment on it just as they would comment on any other plain text email.

And in a perfect world everyone would have a mail client which made that easy, no one would be force by company policy or other circumstances to use a client which didn't work the way you think it should, no company or ISP would filter and mangle outgoing mail, and all vendors would understand that pristine patches are more important that all that stuff they do to make business communications look reasonable.

In my world people send me attachments so they don't get mangled, and if I need to quote them I know how to do so.

Quoted 7 lines

Well that and some people use git to import patches from the email in a mostly automated way which also expects them to have the info at top with signed-off and then the patch, which attachments also screw up.

So yes there are good reasons for getting a non broken mail client when sending patches to lkml.

And reading them, many show attached text at the end of the message and make turning it into inline text simple.

Signature · 3 lines
Bill Davidsen <[email protected]>
 "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot
#13 lore raw
Quoted 35 lines · Bill Davidsen
Quoted 14 lines · Lennart Sorensen
Quoted 11 lines · Bill Davidsen

I'll offer this suggestion, knowing it may piss you off, given the difficulty of preserving whitespace on *many* mailers without using attachments, and given that attachments can be saved easily without prying them out of the message, why don't you (one person) switch to a capable mail agent, if only for patches, instead of trying to teach many people to jump through hoops to avoid whitespace issues?

Not criticizing, just seems easier for everybody for you to avoid teaching people things they don't find useful elsewhere, or getting discouraged and not bothering.

Quoted 6 lines

Ehm, so you want people to save the patch, then when replying they should load the patch into their (much better) mail client where they can comment on the patch? That is the reason the patch should be inline. People need to comment on it just as they would comment on any other plain text email.

And in a perfect world everyone would have a mail client which made that easy, no one would be force by company policy or other circumstances to use a client which didn't work the way you think it should, no company or ISP would filter and mangle outgoing mail, and all vendors would understand that pristine patches are more important that all that stuff they do to make business communications look reasonable.

In my world people send me attachments so they don't get mangled, and if I need to quote them I know how to do so.

Quoted 4 lines

Well that and some people use git to import patches from the email in a mostly automated way which also expects them to have the info at top with signed-off and then the patch, which attachments also screw up.

Quoted 6 lines
Quoted 3 lines

So yes there are good reasons for getting a non broken mail client when sending patches to lkml.

And reading them, many show attached text at the end of the message and make turning it into inline text simple.

Hey, if the poster knows his mail client is broken, nothing prevents him from attaching the patches (so that they don't get mangled) and at the same time inline them for an easy review. People who review patches won't bother about spaces or tabs when you indicate to them from the beginning that the patch may have been mangled.

Willy

#14 lore raw
In reply to Jonathan Campbell
Quoted 6 lines · Jonathan Campbell
(quoted diff) +2 -0
+#if defined(__i386__) && defined(CONFIG_DMI)
 	dmi_check_system(acpi_dmi_table);
 #endif
 
+#ifdef CONFIG_DMI
 	dmi_scan_machine();

Review

Quoted 10 lines
(quoted diff) +5 -0
+#endif
 
+#ifdef CONFIG_DMI
 	/* Check and install the TSC clocksource */
 	dmi_check_system(bad_tsc_dmi_table);
+#endif
 
+#ifdef CONFIG_DMI
 	dmi_check_system(acpi_osl_dmi_table);
+#endif

Instead of adding all these ifdefs, we could just define add something along the lines of..

#ifndef CONFIG_DMI
#define dmi_check_system do {} while (0)
#endif

in some header, which hides the uglies away from the code whilst having the same net effect.

Dave

Signature · 1 line
http://www.codemonkey.org.uk
#15 lore raw
Quoted 23 lines · Dave Jones
Quoted 6 lines · Jonathan Campbell
(quoted diff) +2 -0
+#if defined(__i386__) && defined(CONFIG_DMI)
 	dmi_check_system(acpi_dmi_table);
 #endif
 
+#ifdef CONFIG_DMI
 	dmi_scan_machine();

Review

Quoted 10 lines
(quoted diff) +5 -0
+#endif
 
+#ifdef CONFIG_DMI
 	/* Check and install the TSC clocksource */
 	dmi_check_system(bad_tsc_dmi_table);
+#endif
 
+#ifdef CONFIG_DMI
 	dmi_check_system(acpi_osl_dmi_table);
+#endif

Instead of adding all these ifdefs, we could just define add something along the lines of..

Quoted 6 lines

#ifndef CONFIG_DMI
#define dmi_check_system do {} while (0)
#endif

in some header, which hides the uglies away from the code whilst having the same net effect.

Let take a look at linux/dmi.h:

#ifdef CONFIG_DMI

extern int dmi_check_system(struct dmi_system_id *list); extern char * dmi_get_system_info(int field);
extern struct dmi_device * dmi_find_device(int type, const char *name,

	struct dmi_device *from);

extern void dmi_scan_machine(void);
extern int dmi_get_year(int field);
extern int dmi_name_in_vendors(char *str);

#else

static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } static inline char * dmi_get_system_info(int field) { return NULL; } static inline struct dmi_device * dmi_find_device(int type, const char *name,

	struct dmi_device *from) { return NULL; }

static inline int dmi_get_year(int year) { return 0; } static inline int dmi_name_in_vendors(char *s) { return 0; }

#endif

Signature · 2 lines
Andrey Panin		| Linux and UNIX system administrator
[email protected]		| PGP key: wwwkeys.pgp.net
#16 lore raw
In reply to Dave Jones
Quoted 21 lines · Dave Jones
Quoted 7 lines
(quoted diff) +2 -0
+#if defined(__i386__) && defined(CONFIG_DMI)
 	dmi_check_system(acpi_dmi_table);
 #endif
 
+#ifdef CONFIG_DMI
 	dmi_scan_machine();

Review

Quoted 10 lines
(quoted diff) +5 -0
+#endif
 
+#ifdef CONFIG_DMI
 	/* Check and install the TSC clocksource */
 	dmi_check_system(bad_tsc_dmi_table);
+#endif
 
+#ifdef CONFIG_DMI
 	dmi_check_system(acpi_osl_dmi_table);
+#endif

Instead of adding all these ifdefs, we could just define add something along the lines of..

Quoted 6 lines

#ifndef CONFIG_DMI
#define dmi_check_system do {} while (0)
#endif

in some header, which hides the uglies away from the code whilst having the same net effect.

Need #define dmi_check_system(x) otherwise you get

	/* Check and install the TSC clocksource */
	do {} while (0) (bad_tsc_dmi_table);