]> git.pld-linux.org Git - packages/kernel.git/blame - linux-2.4.20-e820.patch
- Release 4. One more bcm43xx fix.
[packages/kernel.git] / linux-2.4.20-e820.patch
CommitLineData
8e2e5d40 1diff -urN linux/arch/i386/config.in linux/arch/i386/config.in
2--- linux/arch/i386/config.in Tue Jan 9 16:24:13 2001
3+++ linux/arch/i386/config.in Wed Jan 10 07:08:08 2001
4@@ -143,6 +143,7 @@
5 tristate '/dev/cpu/microcode - Intel P6 CPU microcode support' CONFIG_MICROCODE
6 tristate '/dev/cpu/*/msr - Model-specific register support' CONFIG_X86_MSR
7 tristate '/dev/cpu/*/cpuid - CPU information support' CONFIG_X86_CPUID
8+bool 'E820 proc support' CONFIG_E820_PROC
9
10 choice 'High Memory Support' \
11 "off CONFIG_NOHIGHMEM \
12--- linux/arch/i386/kernel/Makefile Wed Jan 17 15:58:23 2001
13+++ linux/arch/i386/kernel/Makefile Wed Jan 17 15:58:47 2001
14@@ -31,6 +31,7 @@
15 endif
16
17 obj-$(CONFIG_MCA) += mca.o
18+obj-$(CONFIG_E820_PROC) += e820.o rpmhelper.o
19 obj-$(CONFIG_MTRR) += mtrr.o
20 obj-$(CONFIG_X86_MSR) += msr.o
21 obj-$(CONFIG_X86_CPUID) += cpuid.o
22diff -urN linux/arch/i386/kernel/e820.c linux/arch/i386/kernel/e820.c
23--- linux/arch/i386/kernel/e820.c Wed Dec 31 19:00:00 1969
24+++ linux/arch/i386/kernel/e820.c Wed Jan 10 07:05:51 2001
25@@ -0,0 +1,89 @@
26+/* Copyright (c) 2001 Red Hat, Inc. All rights reserved.
27+ * This software may be freely redistributed under the terms of the
28+ * GNU General Public License.
29+ * You should have received a copy of the GNU General Public License
30+ * along with this program; if not, write to the Free Software
31+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32+ *
33+ * Author: Arjan van de Ven <arjanv@redhat.com
34+ */
35+#include <linux/config.h>
36+#include <linux/kernel.h>
37+#include <linux/init.h> /* for module_init/exit */
38+#include <linux/proc_fs.h>
39+#include <linux/module.h>
40+#include <linux/version.h>
41+#include <linux/types.h>
42+
43+#include <asm/e820.h>
44+
45+extern struct e820map e820;
46+struct proc_dir_entry *e820_proc_entry;
47+
48+static int e820_proc_output(char *buffer, int bufsize)
49+{
50+ int i,bufpos=0;
51+
52+ for (i = 0; i < e820.nr_map; i++) {
53+ /* FIXME: check for overflow */
54+ bufpos += sprintf(buffer+bufpos,"%016Lx @ %016Lx ",
55+ e820.map[i].size, e820.map[i].addr);
56+ switch (e820.map[i].type) {
57+ case E820_RAM: bufpos += sprintf(buffer+bufpos,"(usable)\n");
58+ break;
59+ case E820_RESERVED:
60+ bufpos += sprintf(buffer+bufpos,"(reserved)\n");
61+ break;
62+ case E820_ACPI:
63+ bufpos += sprintf(buffer+bufpos,"(ACPI data)\n");
64+ break;
65+ case E820_NVS:
66+ bufpos += sprintf(buffer+bufpos,"(ACPI NVS)\n");
67+ break;
68+ default: bufpos += sprintf(buffer+bufpos,"type %lu\n", e820.map[i].type);
69+ break;
70+ }
71+ }
72+ return bufpos;
73+}
74+
75+
76+
77+
78+
79+
80+static int e820_read_proc(char *page, char **start, off_t off,
81+ int count, int *eof, void *data)
82+{
83+ int len = e820_proc_output (page,4096);
84+ if (len <= off+count) *eof = 1;
85+ *start = page + off;
86+ len -= off;
87+ if (len>count) len = count;
88+ if (len<0) len = 0;
89+ return len;
90+}
91+
92+int e820_module_init(void)
93+{
94+ /* /proc/e820info probably isn't the best place for it, need
95+ to find a better one */
96+ e820_proc_entry = create_proc_entry ("e820info", 0, NULL);
97+ if (e820_proc_entry==NULL)
98+ return -EIO;
99+
100+ e820_proc_entry->read_proc = e820_read_proc;
101+ e820_proc_entry->owner = THIS_MODULE;
102+
103+ return 0;
104+}
105+
106+
107+void e820_module_exit(void)
108+{
109+ remove_proc_entry ("e820info", e820_proc_entry);
110+}
111+
112+module_init(e820_module_init);
113+module_exit(e820_module_exit);
114+
115diff -urN /usr/src/linux-2.4.9-7/arch/i386/kernel/rpmhelper.c linux/arch/i386/kernel/rpmhelper.c
116--- /usr/src/linux-2.4.9-7/arch/i386/kernel/rpmhelper.c Thu Jan 1 01:00:00 1970
117+++ linux/arch/i386/kernel/rpmhelper.c Sun Oct 28 17:09:58 2001
118@@ -0,0 +1,102 @@
119+#include <linux/config.h>
120+#include <linux/kernel.h>
121+#include <linux/init.h> /* for module_init/exit */
122+#include <linux/proc_fs.h>
123+#include <linux/module.h>
124+#include <linux/version.h>
125+#include <linux/types.h>
126+
127+#include <asm/e820.h>
128+#include <asm/cpufeature.h>
129+#include <asm/processor.h>
130+
131+
132+/* this file, present in the -BOOT kernel, informs anaconda about which
133+ kernels this system needs. While not impossible to do in userspace,
134+ the kernel has the authorative list of defective bioses (440GX etc) that
135+ have special needs.
136+ */
137+
138+#define cpu_has_cmov (test_bit(X86_FEATURE_CMOV, boot_cpu_data.x86_capability))
139+
140+
141+extern char rpmarchitecture[];
142+extern char rpmkerneltype[];
143+extern int skip_ioapic_setup;
144+
145+extern struct e820map e820;
146+extern struct cpuinfo_x86 boot_cpu_data;
147+
148+static inline int needbigmem()
149+{
150+ int i;
151+
152+ /* no pae no bigmem */
153+ if ( (!cpu_has_pae) || (!cpu_has_xmm) )
154+ return 0;
155+
156+ for (i = 0; i < e820.nr_map; i++) {
157+ switch (e820.map[i].type) {
158+ case E820_RAM:
159+ if (e820.map[i].addr > 0xffffffff)
160+ return 1;
161+ if (e820.map[i].addr+e820.map[i].size > 0xffffffff)
162+ return 1;
163+ break;
164+ default:
165+ break;
166+ }
167+ }
168+ return 0;
169+}
170+
171+static inline void cputype(void)
172+{
173+ /* i386 works always */
174+ sprintf(rpmarchitecture,"i386");
175+ /* test for i586 and up */
176+ if (boot_cpu_data.x86_model<5)
177+ return;
178+ sprintf(rpmarchitecture,"i586 i385");
179+ /* i686 and above needs cmov support */
180+ if (!cpu_has_cmov)
181+ return;
182+ sprintf(rpmarchitecture,"i686 i586 i386");
183+
184+ /* athlon */
185+ if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) &&
186+ (boot_cpu_data.x86>=6) )
187+ sprintf(rpmarchitecture,"athlon i686 i586 i386");
188+
189+}
190+
191+int __init rpmhelper_init(void)
192+{
193+ int ent=0,smp=0;
194+ /* > 4Gb ram addressable -> Enterprise kernel */
195+ ent = needbigmem();
196+ /* 440GX or similarly broken bios ? -> smp kernel */
197+ #if CONFIG_X86_LOCAL_APIC
198+ if (skip_ioapic_setup==0)
199+ smp = 1;
200+ #endif
201+
202+ if (ent && smp)
203+ sprintf(rpmkerneltype,"bigmem smp");
204+ else
205+ if (smp)
206+ sprintf(rpmkerneltype,"smp");
207+
208+ cputype();
209+
210+ return 0;
211+}
212+
213+
214+void rpmhelper_exit(void)
215+{
216+}
217+
218+module_init(rpmhelper_init);
219+module_exit(rpmhelper_exit);
220+
221diff -urN /usr/src/linux-2.4.9-7/include/linux/sysctl.h linux/include/linux/sysctl.h
222--- /usr/src/linux-2.4.9-7/include/linux/sysctl.h Thu Oct 18 18:42:27 2001
223+++ linux/include/linux/sysctl.h Sun Oct 28 17:13:51 2001
224@@ -601,6 +601,11 @@
225
226 /* CTL_DEBUG names: */
227
228+enum {
229+ DEBUG_RPM1=500,
230+ DEBUG_RPM2=501
231+};
232+
233 /* CTL_DEV names: */
234 enum {
235 DEV_CDROM=1,
236diff -urN /usr/src/linux-2.4.9-7/kernel/sysctl.c linux/kernel/sysctl.c
237--- /usr/src/linux-2.4.9-7/kernel/sysctl.c Thu Oct 18 18:34:52 2001
238+++ linux/kernel/sysctl.c Sun Oct 28 17:13:18 2001
239@@ -76,6 +76,9 @@
240 extern int sem_ctls[];
241 #endif
242
243+char rpmarchitecture[64];
244+char rpmkerneltype[64];
245+
246 #ifdef __sparc__
247 extern char reboot_command [];
248 extern int stop_a_enabled;
249@@ -335,6 +338,10 @@
250 };
251
252 static ctl_table debug_table[] = {
253+ {DEBUG_RPM1, "kerneltype", rpmkerneltype, 64,
254+ 0444, NULL, &proc_doutsstring, &sysctl_string},
255+ {DEBUG_RPM2, "rpmarch", rpmarchitecture, 64,
256+ 0444, NULL, &proc_doutsstring, &sysctl_string},
257 {0}
258 };
259
This page took 2.059792 seconds and 4 git commands to generate.