source: patches/linux-2.6.17.11-mips_fixes-1.patch@ 69b2a0a

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 69b2a0a was 568625a, checked in by Jim Gifford <clfs@…>, 18 years ago

Linux patches updated to 2.6.17.11

  • Property mode set to 100644
File size: 10.7 KB
RevLine 
[a66a890]1Submitted By: Jim Gifford (patches at jg555 dot com)
[8bb5996]2Date: 2006-08-14
[a66a890]3Initial Package Version: 2.6.17.4
4Origin: Linux-MIPS Mailing List
5Upstream Status: Not Applied
6Description: These are patches that have not been accepted by
7 Linux-MIPS.
8
9 1 - iomap for MIPS - iomap.c io.h
10 2 - Cobalt ide fixes
[8bb5996]11 3 - Updates to Support N32 only builds
[a66a890]12
[8bb5996]13diff -Naur linux-2.6.17.8.orig/arch/mips/kernel/Makefile linux-2.6.17.8/arch/mips/kernel/Makefile
14--- linux-2.6.17.8.orig/arch/mips/kernel/Makefile 2006-08-06 21:18:54.000000000 -0700
15+++ linux-2.6.17.8/arch/mips/kernel/Makefile 2006-08-14 08:07:02.196300148 -0700
16@@ -54,7 +54,7 @@
17 obj-$(CONFIG_64BIT) += scall64-64.o
18 obj-$(CONFIG_BINFMT_IRIX) += binfmt_irix.o
19 obj-$(CONFIG_MIPS32_COMPAT) += linux32.o signal32.o
20-obj-$(CONFIG_MIPS32_N32) += binfmt_elfn32.o scall64-n32.o signal_n32.o
21+obj-$(CONFIG_MIPS32_N32) += binfmt_elfn32.o scall64-n32.o signal_n32.o ptrace32.o
22 obj-$(CONFIG_MIPS32_O32) += binfmt_elfo32.o scall64-o32.o ptrace32.o
23
24 obj-$(CONFIG_KGDB) += gdb-low.o gdb-stub.o
25diff -Naur linux-2.6.17.8.orig/arch/mips/lib/Makefile linux-2.6.17.8/arch/mips/lib/Makefile
26--- linux-2.6.17.8.orig/arch/mips/lib/Makefile 2006-08-14 08:05:04.143414758 -0700
27+++ linux-2.6.17.8/arch/mips/lib/Makefile 2006-08-14 08:05:27.786793056 -0700
28@@ -5,6 +5,8 @@
29 lib-y += csum_partial_copy.o memcpy.o promlib.o strlen_user.o strncpy_user.o \
30 strnlen_user.o uncached.o
31
32+obj-y += iomap.o
33+
34 # libgcc-style stuff needed in the kernel
35 lib-y += ashldi3.o ashrdi3.o lshrdi3.o
36
37diff -Naur linux-2.6.17.8.orig/arch/mips/lib/ashldi3.c linux-2.6.17.8/arch/mips/lib/ashldi3.c
38--- linux-2.6.17.8.orig/arch/mips/lib/ashldi3.c 1969-12-31 16:00:00.000000000 -0800
39+++ linux-2.6.17.8/arch/mips/lib/ashldi3.c 2006-08-14 08:05:27.786793056 -0700
40@@ -0,0 +1,29 @@
41+#include <linux/module.h>
42+
43+#include "libgcc.h"
44+
45+long long __ashldi3(long long u, word_type b)
46+{
47+ DWunion uu, w;
48+ word_type bm;
49+
50+ if (b == 0)
51+ return u;
52+
53+ uu.ll = u;
54+ bm = 32 - b;
55+
56+ if (bm <= 0) {
57+ w.s.low = 0;
58+ w.s.high = (unsigned int) uu.s.low << -bm;
59+ } else {
60+ const unsigned int carries = (unsigned int) uu.s.low >> bm;
61+
62+ w.s.low = (unsigned int) uu.s.low << b;
63+ w.s.high = ((unsigned int) uu.s.high << b) | carries;
64+ }
65+
66+ return w.ll;
67+}
68+
69+EXPORT_SYMBOL(__ashldi3);
70diff -Naur linux-2.6.17.8.orig/arch/mips/lib/ashrdi3.c linux-2.6.17.8/arch/mips/lib/ashrdi3.c
71--- linux-2.6.17.8.orig/arch/mips/lib/ashrdi3.c 1969-12-31 16:00:00.000000000 -0800
72+++ linux-2.6.17.8/arch/mips/lib/ashrdi3.c 2006-08-14 08:05:27.786793056 -0700
73@@ -0,0 +1,31 @@
74+#include <linux/module.h>
75+
76+#include "libgcc.h"
77+
78+long long __ashrdi3(long long u, word_type b)
79+{
80+ DWunion uu, w;
81+ word_type bm;
82+
83+ if (b == 0)
84+ return u;
85+
86+ uu.ll = u;
87+ bm = 32 - b;
88+
89+ if (bm <= 0) {
90+ /* w.s.high = 1..1 or 0..0 */
91+ w.s.high =
92+ uu.s.high >> 31;
93+ w.s.low = uu.s.high >> -bm;
94+ } else {
95+ const unsigned int carries = (unsigned int) uu.s.high << bm;
96+
97+ w.s.high = uu.s.high >> b;
98+ w.s.low = ((unsigned int) uu.s.low >> b) | carries;
99+ }
100+
101+ return w.ll;
102+}
103+
104+EXPORT_SYMBOL(__ashrdi3);
105diff -Naur linux-2.6.17.8.orig/arch/mips/lib/iomap.c linux-2.6.17.8/arch/mips/lib/iomap.c
106--- linux-2.6.17.8.orig/arch/mips/lib/iomap.c 1969-12-31 16:00:00.000000000 -0800
107+++ linux-2.6.17.8/arch/mips/lib/iomap.c 2006-08-14 08:05:27.786793056 -0700
[a66a890]108@@ -0,0 +1,78 @@
109+/*
110+ * iomap.c, Memory Mapped I/O routines for MIPS architecture.
111+ *
112+ * This code is based on lib/iomap.c, by Linus Torvalds.
113+ *
114+ * Copyright (C) 2004-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
115+ *
116+ * This program is free software; you can redistribute it and/or modify
117+ * it under the terms of the GNU General Public License as published by
118+ * the Free Software Foundation; either version 2 of the License, or
119+ * (at your option) any later version.
120+ *
121+ * This program is distributed in the hope that it will be useful,
122+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
123+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
124+ * GNU General Public License for more details.
125+ *
126+ * You should have received a copy of the GNU General Public License
127+ * along with this program; if not, write to the Free Software
128+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
129+ */
130+#include <linux/ioport.h>
131+#include <linux/module.h>
132+#include <linux/pci.h>
133+
134+#include <asm/io.h>
135+
136+void __iomem *ioport_map(unsigned long port, unsigned int nr)
137+{
138+ unsigned long end;
139+
140+ end = port + nr - 1UL;
141+ if (ioport_resource.start > port ||
142+ ioport_resource.end < end || port > end)
143+ return NULL;
144+
145+ return (void __iomem *)(mips_io_port_base + port);
146+}
147+
148+void ioport_unmap(void __iomem *addr)
149+{
150+}
151+EXPORT_SYMBOL(ioport_map);
152+EXPORT_SYMBOL(ioport_unmap);
153+
154+void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
155+{
156+ unsigned long start, len, flags;
157+
158+ if (dev == NULL)
159+ return NULL;
160+
161+ start = pci_resource_start(dev, bar);
162+ len = pci_resource_len(dev, bar);
163+ if (!start || !len)
164+ return NULL;
165+
166+ if (maxlen != 0 && len > maxlen)
167+ len = maxlen;
168+
169+ flags = pci_resource_flags(dev, bar);
170+ if (flags & IORESOURCE_IO)
171+ return ioport_map(start, len);
172+ if (flags & IORESOURCE_MEM) {
173+ if (flags & IORESOURCE_CACHEABLE)
174+ return ioremap_cachable(start, len);
175+ return ioremap_nocache(start, len);
176+ }
177+
178+ return NULL;
179+}
180+
181+void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
182+{
183+ iounmap(addr);
184+}
185+EXPORT_SYMBOL(pci_iomap);
186+EXPORT_SYMBOL(pci_iounmap);
[8bb5996]187diff -Naur linux-2.6.17.8.orig/arch/mips/lib/libgcc.h linux-2.6.17.8/arch/mips/lib/libgcc.h
188--- linux-2.6.17.8.orig/arch/mips/lib/libgcc.h 1969-12-31 16:00:00.000000000 -0800
189+++ linux-2.6.17.8/arch/mips/lib/libgcc.h 2006-08-14 08:05:27.786793056 -0700
190@@ -0,0 +1,26 @@
191+#ifndef __ASM_LIBGCC_H
192+#define __ASM_LIBGCC_H
[a66a890]193+
[8bb5996]194+#include <asm/byteorder.h>
195+
196+typedef int word_type __attribute__ ((mode (__word__)));
197+
198+#ifdef __BIG_ENDIAN
199+struct DWstruct {
200+ int high, low;
201+};
202+#elif defined(__LITTLE_ENDIAN)
203+struct DWstruct {
204+ int low, high;
205+};
206+#else
207+#error I feel sick.
208+#endif
209+
210+typedef union
211+{
212+ struct DWstruct s;
213+ long long ll;
214+} DWunion;
215+
216+#endif /* __ASM_LIBGCC_H */
217diff -Naur linux-2.6.17.8.orig/arch/mips/lib/lshrdi3.c linux-2.6.17.8/arch/mips/lib/lshrdi3.c
218--- linux-2.6.17.8.orig/arch/mips/lib/lshrdi3.c 1969-12-31 16:00:00.000000000 -0800
219+++ linux-2.6.17.8/arch/mips/lib/lshrdi3.c 2006-08-14 08:05:27.786793056 -0700
220@@ -0,0 +1,29 @@
221+#include <linux/module.h>
222+
223+#include "libgcc.h"
224+
225+long long __lshrdi3(long long u, word_type b)
226+{
227+ DWunion uu, w;
228+ word_type bm;
229+
230+ if (b == 0)
231+ return u;
232+
233+ uu.ll = u;
234+ bm = 32 - b;
235+
236+ if (bm <= 0) {
237+ w.s.high = 0;
238+ w.s.low = (unsigned int) uu.s.high >> -bm;
239+ } else {
240+ const unsigned int carries = (unsigned int) uu.s.high << bm;
241+
242+ w.s.high = (unsigned int) uu.s.high >> b;
243+ w.s.low = ((unsigned int) uu.s.low >> b) | carries;
244+ }
245+
246+ return w.ll;
247+}
248+
249+EXPORT_SYMBOL(__lshrdi3);
250diff -Naur linux-2.6.17.8.orig/include/asm-mips/io.h linux-2.6.17.8/include/asm-mips/io.h
251--- linux-2.6.17.8.orig/include/asm-mips/io.h 2006-08-14 08:05:04.311410340 -0700
252+++ linux-2.6.17.8/include/asm-mips/io.h 2006-08-14 08:05:27.786793056 -0700
[a66a890]253@@ -519,6 +519,34 @@
254 }
255
256 /*
257+ * Memory Mapped I/O
258+ */
259+#define ioread8(addr) readb(addr)
260+#define ioread16(addr) readw(addr)
261+#define ioread32(addr) readl(addr)
262+
263+#define iowrite8(b,addr) writeb(b,addr)
264+#define iowrite16(w,addr) writew(w,addr)
265+#define iowrite32(l,addr) writel(l,addr)
266+
267+#define ioread8_rep(a,b,c) readsb(a,b,c)
268+#define ioread16_rep(a,b,c) readsw(a,b,c)
269+#define ioread32_rep(a,b,c) readsl(a,b,c)
270+
271+#define iowrite8_rep(a,b,c) writesb(a,b,c)
272+#define iowrite16_rep(a,b,c) writesw(a,b,c)
273+#define iowrite32_rep(a,b,c) writesl(a,b,c)
274+
275+/* Create a virtual mapping cookie for an IO port range */
276+extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
277+extern void ioport_unmap(void __iomem *);
278+
279+/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
280+struct pci_dev;
281+extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
282+extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
283+
284+/*
285 * ISA space is 'always mapped' on currently supported MIPS systems, no need
286 * to explicitly ioremap() it. The fact that the ISA IO space is mapped
287 * to PAGE_OFFSET is pure coincidence - it does not mean ISA values
[8bb5996]288diff -Naur linux-2.6.17.8.orig/include/asm-mips/mach-cobalt/ide.h linux-2.6.17.8/include/asm-mips/mach-cobalt/ide.h
289--- linux-2.6.17.8.orig/include/asm-mips/mach-cobalt/ide.h 1969-12-31 16:00:00.000000000 -0800
290+++ linux-2.6.17.8/include/asm-mips/mach-cobalt/ide.h 2006-08-14 08:05:27.786793056 -0700
[a66a890]291@@ -0,0 +1,83 @@
292+
293+/*
294+ * PIO "in" transfers can cause D-cache lines to be allocated
295+ * to the data being read. If the target is the page cache then
296+ * the kernel can create a user space mapping of the same page
297+ * without flushing it from the D-cache. This has large potential
298+ * to create cache aliases. The Cobalts seem to trigger this
299+ * problem easily.
300+ *
301+ * MIPs doesn't have a flush_dcache_range() so we roll
302+ * our own.
303+ *
304+ * -- pdh
305+ */
306+
307+#define MAX_HWIFS 2
308+
309+#include <asm/r4kcache.h>
310+
311+static inline void __flush_dcache(void)
312+{
313+ unsigned long dc_size, dc_line, addr, end;
314+
315+ dc_size = current_cpu_data.dcache.ways << current_cpu_data.dcache.waybit;
316+ dc_line = current_cpu_data.dcache.linesz;
317+
318+ addr = CKSEG0;
319+ end = addr + dc_size;
320+
321+ for (; addr < end; addr += dc_line)
322+ flush_dcache_line_indexed(addr);
323+}
324+
325+static inline void __flush_dcache_range(unsigned long start, unsigned long end)
326+{
327+ unsigned long dc_size, dc_line, addr;
328+
329+ dc_size = current_cpu_data.dcache.ways << current_cpu_data.dcache.waybit;
330+ dc_line = current_cpu_data.dcache.linesz;
331+
332+ addr = start & ~(dc_line - 1);
333+ end += dc_line - 1;
334+
335+ if (end - addr < dc_size)
336+ for (; addr < end; addr += dc_line)
337+ flush_dcache_line(addr);
338+ else
339+ __flush_dcache();
340+}
341+
342+static inline void __ide_insw(unsigned long port, void *addr, unsigned int count)
343+{
344+ insw(port, addr, count);
345+
346+ __flush_dcache_range((unsigned long) addr, (unsigned long) addr + count * 2);
347+}
348+
349+static inline void __ide_insl(unsigned long port, void *addr, unsigned int count)
350+{
351+ insl(port, addr, count);
352+
353+ __flush_dcache_range((unsigned long) addr, (unsigned long) addr + count * 4);
354+}
355+
356+static inline void __ide_mm_insw(volatile void __iomem *port, void *addr, unsigned int count)
357+{
358+ readsw(port, addr, count);
359+
360+ __flush_dcache_range((unsigned long) addr, (unsigned long) addr + count * 2);
361+}
362+
363+static inline void __ide_mm_insl(volatile void __iomem *port, void *addr, unsigned int count)
364+{
365+ readsl(port, addr, count);
366+
367+ __flush_dcache_range((unsigned long) addr, (unsigned long) addr + count * 4);
368+}
369+
370+#define insw __ide_insw
371+#define insl __ide_insl
372+
373+#define __ide_mm_outsw writesw
374+#define __ide_mm_outsl writesl
Note: See TracBrowser for help on using the repository browser.