|
From: NIIBE Y. <gn...@m1...> - 2001-12-11 06:52:11
|
Well, here is a patch to 2.4 which I'm going to submit.
Please check this. I think that all is safe to submit and included.
To be sure, I'll re-diff against 2.4.17-pre8, if it will be applied
cleanly.
--------------------------
arch/sh/config.in | 2
arch/sh/kernel/io_7751se.c | 8 +--
arch/sh/kernel/pci-7751se.c | 1
arch/sh/kernel/traps.c | 5 ++
drivers/char/shwdt.c | 7 +--
include/asm-sh/hitachi_se.h | 2
include/asm-sh/pci.h | 5 ++
include/asm-sh/stat.h | 25 +++++++++-
include/asm-sh/uaccess.h | 1
Documentation/sh/new-machine.txt | 77 +++++++++++++++++++++++++++++++++
10 files changed, 119 insertions(+), 14 deletions(-)
--------------------------
Stuart Menefy
Documentation/sh/new-machine.txt
Jeremy Siegel
arch/sh/config.in
arch/sh/kernel/io_7751se.c
arch/sh/kernel/pci-7751se.c
include/asm-sh/pci.h
Jeremy Siegel
Big endian support
include/asm-sh/stat.h
Tomoyoshi ASANO
Big endian fix
include/asm-sh/uaccess.h
Someone did that:
drivers/char/shwdt.c
arch/sh/kernel/traps.c
include/asm-sh/hitachi_se.h
--- /dev/null Tue Dec 4 19:42:15 2001
+++ linux/Documentation/sh/new-machine.txt Tue Oct 16 05:44:46 2001
@@ -0,0 +1,77 @@
+The multiple machine support relies on redirecting all functions which will
+need to be machine specific through a table of function pointers, the
+machvec. These functions fall into a number of categories:
+
+ - I/O functions to IO memory (inb etc) and PCI/main memory (readb etc).
+ - I/O remapping functions (ioremap etc)
+ - some initialisation functions
+ - a 'heartbeat' function
+ - some miscellaneous flags
+
+The tree can be built in two ways:
+ - as a fully generic build. All drivers are linked in, and all functions
+ go through the machvec
+ - as a machine specific build. In this case only the required drivers
+ will be linked in, and some macros may be redefined to not go through
+ the machvec where performance is important (in particular IO functions).
+
+There are three ways in which IO can be performed:
+ - none at all. This is really only useful for the 'unknown' machine type,
+ which us designed to run on a machine about which we know nothing, and
+ so all all IO instructions do nothing.
+ - fully custom. In this case all IO functions go to a machine specific
+ set of functions which can do what they like
+ - a generic set of functions. These will cope with most situations,
+ and rely on a single function, mv_port2addr, which is called through the
+ machine vector, and converts an IO address into a memory address, which
+ can be read from/written to directly.
+
+Thus adding a new machine involves the following steps (I will assume I am
+adding a machine called fred):
+
+ - add a new file include/asm-sh/io_fred.h which contains prototypes for
+ any machine specific IO functions prefixed with the machine name, for
+ example fred_inb. These will be needed when filling out the machine
+ vector. In addition, a section is required which defines what to do when
+ building a machine specific version. For example:
+
+ #ifdef __WANT_IO_DEF
+ #define inb fred_inb
+ ...
+ #endif
+
+ This is the minimum that is required, however there are ample
+ opportunities to optimise this. In particular, by making the prototypes
+ inline function definitions, it is possible to inline the function when
+ building machine specific versions. Note that the machine vector
+ functions will still be needed, so that a module built for a generic
+ setup can be loaded.
+
+ - add a new file arch/sh/kernel/mach_fred.c. This contains the definition
+ of the machine vector. When building the machine specific version, this
+ will be the real machine vector (via an alias), while in the generic
+ version is used to initialise the machine vector, and then freed, by
+ making it initdata. This should be defined as:
+
+ struct sh_machine_vector mv_fred __initmv = {
+ mv_name: "Fred"
+ }
+ ALIAS_MV(se)
+
+ - finally add a file arch/sh/kernel/io_fred.c, which contains
+ definitions of the machine specific io functions.
+
+A note about initialisation functions. Three initialisation functions are
+provided in the machine vector:
+ - mv_arch_init - called very early on from setup_arch
+ - mv_init_irq - called from init_IRQ, after the generic SH interrupt
+ initialisation
+ - mv_init_pci - currently not used
+
+Any other remaining functions which need to be called at start up can be
+added to the list using the __initcalls macro (or module_init if the code
+can be built as a module). Many generic drivers probe to see if the device
+they are targeting is present, however this may not always be appropriate,
+so a flag can be added to the machine vector which will be set on those
+machines which have the hardware in question, reducing the probe to a
+single conditional.
--- linux-2.4.16/arch/sh/config.in Tue Oct 16 05:36:48 2001
+++ linux/arch/sh/config.in Sat Nov 3 09:52:47 2001
@@ -189,7 +189,7 @@ if [ "$CONFIG_PCI" = "y" ]; then
if [ "$CONFIG_PCI_GODIRECT" = "y" -o "$CONFIG_PCI_GOANY" = "y" ]; then
define_bool CONFIG_PCI_DIRECT y
fi
- define_bool CONFIG_SH_PCIDMA_NONCOHERENT n
+ bool 'Cache and PCI noncoherent' CONFIG_SH_PCIDMA_NONCOHERENT n
fi
source drivers/pci/Config.in
--- linux-2.4.16/arch/sh/kernel/io_7751se.c Sun Sep 9 04:29:09 2001
+++ linux/arch/sh/kernel/io_7751se.c Sat Nov 3 09:52:47 2001
@@ -17,7 +17,7 @@
#include <asm/hitachi_7751se.h>
#include <asm/addrspace.h>
-#include <asm/pci.h>
+#include <linux/pci.h>
#include <asm/pci-sh7751.h>
#if 0
@@ -70,7 +70,7 @@ port2adr(unsigned int port)
else
return (volatile __u16 *) (PA_SUPERIO + (port << 1));
#endif
- maybebadio(name,port);
+ maybebadio(name,(unsigned long)port);
return (volatile __u16*)port;
}
@@ -276,6 +276,7 @@ void sh7751se_writel(unsigned int b, uns
/* ISA page descriptor. */
static __u32 sh_isa_memmap[256];
+#if 0
static int
sh_isa_mmap(__u32 start, __u32 length, __u32 offset)
{
@@ -286,12 +287,11 @@ sh_isa_mmap(__u32 start, __u32 length, _
idx = start >> 12;
sh_isa_memmap[idx] = 0xb8000000 + (offset &~ 0xfff);
-#if 0
printk("sh_isa_mmap: start %x len %x offset %x (idx %x paddr %x)\n",
start, length, offset, idx, sh_isa_memmap[idx]);
-#endif
return 0;
}
+#endif
unsigned long
sh7751se_isa_port2addr(unsigned long offset)
--- linux-2.4.16/arch/sh/kernel/pci-7751se.c Sun Sep 9 04:29:09 2001
+++ linux/arch/sh/kernel/pci-7751se.c Sat Nov 3 09:52:47 2001
@@ -37,7 +37,6 @@
*/
int __init pcibios_init_platform(void)
{
- unsigned long data;
unsigned long bcr1, wcr1, wcr2, wcr3, mcr;
unsigned short bcr2;
--- linux-2.4.16/arch/sh/kernel/traps.c Sun Sep 9 04:29:09 2001
+++ linux/arch/sh/kernel/traps.c Sat Dec 1 08:03:38 2001
@@ -559,4 +559,9 @@ void dump_stack(void)
printk("%08lx\n", v);
}
}
+}
+
+void show_trace_task(struct task_struct *tsk)
+{
+ printk("Backtrace not yet implemented for SH.\n");
}
--- linux-2.4.16/drivers/char/shwdt.c Tue Oct 16 05:36:48 2001
+++ linux/drivers/char/shwdt.c Fri Nov 30 09:27:08 2001
@@ -10,7 +10,6 @@
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
-
#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -177,7 +176,7 @@ static int sh_wdt_close(struct inode *in
* sh_wdt_read - Read from Device
*
* @file: file handle of device
- * @char: buffer to write to
+ * @buf: buffer to write to
* @count: length of buffer
* @ppos: offset
*
@@ -193,7 +192,7 @@ static ssize_t sh_wdt_read(struct file *
* sh_wdt_write - Write to Device
*
* @file: file handle of device
- * @char: buffer to write
+ * @buf: buffer to write
* @count: length of buffer
* @ppos: offset
*
@@ -269,7 +268,7 @@ static int sh_wdt_ioctl(struct inode *in
static int sh_wdt_notify_sys(struct notifier_block *this,
unsigned long code, void *unused)
{
- if (code == SYS_DOWN || SYS_HALT) {
+ if (code == SYS_DOWN || code == SYS_HALT) {
sh_wdt_stop();
}
--- linux-2.4.16/include/asm-sh/hitachi_se.h Tue Jul 3 05:56:40 2001
+++ linux/include/asm-sh/hitachi_se.h Wed Oct 17 04:39:50 2001
@@ -36,7 +36,7 @@
#define PA_DIPSW0 0xb0800000 /* Dip switch 5,6 */
#define PA_DIPSW1 0xb0800002 /* Dip switch 7,8 */
#define PA_LED 0xb0c00000 /* LED */
-#define PA_BCR 0xb1400000 /* FPGA */
+#define PA_BCR 0xb1400000 /* FPGA on the MS7750SE01 */
#define PA_MRSHPC 0xb83fffe0 /* MR-SHPC-01 PCMCIA controller */
#define PA_MRSHPC_MW1 0xb8400000 /* MR-SHPC-01 memory window base */
--- linux-2.4.16/include/asm-sh/pci.h Sat Oct 13 07:35:54 2001
+++ linux/include/asm-sh/pci.h Wed Oct 31 08:22:18 2001
@@ -196,6 +196,11 @@ static inline int pci_dma_supported(stru
return 1;
}
+/* Not supporting more than 32-bit PCI bus addresses now, but
+ * must satisfy references to this function. Change if needed.
+ */
+#define pci_dac_dma_supported(pci_dev, mask) (0)
+
/* Return the index of the PCI controller for device PDEV. */
#define pci_controller_num(PDEV) (0)
--- linux-2.4.16/include/asm-sh/stat.h Tue Aug 1 09:38:07 2000
+++ linux/include/asm-sh/stat.h Sat Nov 3 09:52:47 2001
@@ -42,8 +42,16 @@ struct stat {
* insane amounts of padding around dev_t's.
*/
struct stat64 {
+#if defined(__BIG_ENDIAN__)
+ unsigned char __pad0b[6];
unsigned short st_dev;
- unsigned char __pad0[10];
+#elif defined(__LITTLE_ENDIAN__)
+ unsigned short st_dev;
+ unsigned char __pad0b[6];
+#else
+#error Must know endian to build stat64 structure!
+#endif
+ unsigned char __pad0[4];
unsigned long st_ino;
unsigned int st_mode;
@@ -52,14 +60,25 @@ struct stat64 {
unsigned long st_uid;
unsigned long st_gid;
+#if defined(__BIG_ENDIAN__)
+ unsigned char __pad3b[6];
+ unsigned short st_rdev;
+#else /* Must be little */
unsigned short st_rdev;
- unsigned char __pad3[10];
+ unsigned char __pad3b[6];
+#endif
+ unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
+#if defined(__BIG_ENDIAN__)
+ unsigned long __pad4; /* Future possible st_blocks hi bits */
+ unsigned long st_blocks; /* Number 512-byte blocks allocated. */
+#else /* Must be little */
unsigned long st_blocks; /* Number 512-byte blocks allocated. */
- unsigned long __pad4; /* future possible st_blocks high bits */
+ unsigned long __pad4; /* Future possible st_blocks hi bits */
+#endif
unsigned long st_atime;
unsigned long __pad5;
--- linux-2.4.16/include/asm-sh/uaccess.h Tue Oct 16 05:36:48 2001
+++ linux/include/asm-sh/uaccess.h Sat Nov 3 09:52:47 2001
@@ -216,6 +216,7 @@ __asm__ __volatile__( \
: "r" (val), "m" (__m(addr)), "i" (-EFAULT) \
: "memory"); })
#else
+#define __put_user_u64(val,addr,retval) \
({ \
__asm__ __volatile__( \
"1:\n\t" \
--
|