--- ../../kernel.org/linux-2.6.8.1/arch/sh64/Kconfig 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/Kconfig 2004-11-25 21:37:24.000000000 +0000 @@ -212,6 +212,10 @@ menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" +config SUPERHYWAY + bool + default y + config ISA bool @@ -310,6 +314,12 @@ If you don't debug the kernel, you can say N, but we may not be able to solve problems without frame pointers. +config POOR_MANS_STRACE + bool "Debug: enable rudimentary strace facility" + help + This option allows system calls to be traced to the console. It also + aids in detecting kernel stack underflow. It is useful for debugging + early-userland problems (e.g. init incurring fatal exceptions.) endmenu source "security/Kconfig" --- ../../kernel.org/linux-2.6.8.1/arch/sh64/Makefile 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/Makefile 2004-11-25 21:37:24.000000000 +0000 @@ -37,7 +37,8 @@ CFLAGS += $(cpu-y) LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_CACHED_MEMORY_OFFSET) \ - -e phys_stext + --defsym phys_stext_shmedia=phys_stext+1 \ + -e phys_stext_shmedia OBJCOPYFLAGS := -O binary -R .note -R .comment -R .stab -R .stabstr -S @@ -92,7 +93,7 @@ echo "struct syscall_info {"; \ echo " const char *name;"; \ echo "} syscall_info_table[] = {"; \ - sed -e '/^.*\.long /!d;s//\t{ "/;s/\(\([^/]*\)\/\)\{1\}.*/\2/; \ + sed -e '/^.*\.long /!d;s// { "/;s/\(\([^/]*\)\/\)\{1\}.*/\2/; \ s/[ \t]*$$//g;s/$$/" },/;s/\("\)sys_/\1/g'; \ echo "};"; \ echo ""; \ --- ../../kernel.org/linux-2.6.8.1/arch/sh64/defconfig 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/defconfig 2004-11-25 21:37:25.000000000 +0000 @@ -13,7 +13,6 @@ # CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y -CONFIG_STANDALONE=y CONFIG_BROKEN_ON_SMP=y # @@ -99,6 +98,7 @@ # # Bus options (PCI, PCMCIA, EISA, MCA, ISA) # +CONFIG_SUPERHYWAY=y CONFIG_PCI=y CONFIG_SH_PCIDMA_NONCOHERENT=y CONFIG_PCI_LEGACY_PROC=y @@ -118,6 +118,7 @@ # # Generic Driver Options # +CONFIG_STANDALONE=y CONFIG_PREVENT_FIRMWARE_BUILD=y # @@ -449,7 +450,6 @@ # # Ftape, the floppy tape device driver # -# CONFIG_FTAPE is not set # CONFIG_AGP is not set # CONFIG_DRM is not set # CONFIG_RAW_DRIVER is not set @@ -460,6 +460,11 @@ # CONFIG_I2C is not set # +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# # Misc devices # @@ -504,7 +509,6 @@ # CONFIG_MDA_CONSOLE is not set CONFIG_DUMMY_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_PCI_CONSOLE=y CONFIG_FONTS=y # CONFIG_FONT_8x8 is not set CONFIG_FONT_8x16=y @@ -566,7 +570,8 @@ # # DOS/FAT/NT Filesystems # -# CONFIG_FAT_FS is not set +# CONFIG_MSDOS_FS is not set +# CONFIG_VFAT_FS is not set # CONFIG_NTFS_FS is not set # @@ -662,6 +667,6 @@ # # Library routines # -# CONFIG_CRC16 is not set +# CONFIG_CRC_CCITT is not set CONFIG_CRC32=y # CONFIG_LIBCRC32C is not set --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/Makefile 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/kernel/Makefile 2004-11-25 21:37:25.000000000 +0000 @@ -25,6 +25,8 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-$(CONFIG_KALLSYMS) += unwind.o obj-$(CONFIG_PCI) += pci-dma.o pcibios.o +obj-$(CONFIG_SUPERHYWAY) += superhyway.o +obj-$(CONFIG_MODULES) += module.o ifeq ($(CONFIG_PCI),y) obj-$(CONFIG_CPU_SH5) += pci_sh5.o --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/dma.c 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/kernel/dma.c 2004-11-25 21:37:25.000000000 +0000 @@ -3,7 +3,7 @@ * * DMA routines for the SH-5 DMAC. * - * Copyright (C) 2003 Paul Mundt + * Copyright (C) 2003, 2004 Paul Mundt * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -243,9 +244,9 @@ return sh64_in64(DMAC_COUNT(chan) << calc_xmit_shift(chan)); } -int __init init_dma(void) +static int __devinit dmac_probe(struct superhyway_device *dev, + const struct superhyway_device_id *id) { - struct vcr_info vcr; u64 tmp; /* Remap the DMAC */ @@ -255,11 +256,6 @@ return -ENOMEM; } - /* Report DMAC.VCR Info */ - vcr = sh64_get_vcr_info(dmac_base); - printk("DMAC: Module ID: 0x%04x, Module version: 0x%04x\n", - vcr.mod_id, vcr.mod_vers); - /* Set the ME bit */ tmp = sh64_in64(DMAC_COMMON_BASE); tmp |= DMAC_COMMON_ME; @@ -272,12 +268,34 @@ return 0; } -static void __exit exit_dma(void) +static void __devexit dmac_remove(struct superhyway_device *dev) { onchip_unmap(dmac_base); free_irq(DMA_IRQ_DERR, 0); } +static struct superhyway_device_id superhyway_dma_tbl[] __devinitdata = { + { SUPERHYWAY_DEVICE_ID_SH5_DMAC, 0, }, + { 0, }, +}; + +static struct superhyway_driver dmac_driver = { + .name = "dmac", + .id_table = superhyway_dma_tbl, + .probe = dmac_probe, + .remove = __devexit_p(dmac_remove), +}; + +static int __init init_dma(void) +{ + return superhyway_register_driver(&dmac_driver); +} + +static void __exit exit_dma(void) +{ + superhyway_unregister_driver(&dmac_driver); +} + module_init(init_dma); module_exit(exit_dma); --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/early_printk.c 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/kernel/early_printk.c 2004-11-25 21:37:25.000000000 +0000 @@ -16,8 +16,6 @@ #include #include -extern void cpu_relax(void); - #define SCIF_BASE_ADDR 0x01030000 #define SCIF_ADDR_SH5 PHYS_PERIPHERAL_BLOCK+SCIF_BASE_ADDR --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/entry.S 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/kernel/entry.S 2004-11-25 21:37:25.000000000 +0000 @@ -237,6 +237,7 @@ .space 256, 0 /* Power-on class handler, */ /* not required here */ not_a_tlb_miss: + synco /* TAKum03020 (but probably a good idea anyway.) */ /* Save original stack pointer into KCR1 */ putcon SP, KCR1 @@ -278,6 +279,7 @@ * block making sure the final alignment is correct. */ tlb_miss: + synco /* TAKum03020 (but probably a good idea anyway.) */ putcon SP, KCR1 movi reg_save_area, SP /* SP is guaranteed 32-byte aligned. */ @@ -393,6 +395,7 @@ /* VBR + 0x600 */ interrupt: + synco /* TAKum03020 (but probably a good idea anyway.) */ /* Save original stack pointer into KCR1 */ putcon SP, KCR1 @@ -429,6 +432,7 @@ * (this may need to be extended...) */ reset_or_panic: + synco /* TAKum03020 (but probably a good idea anyway.) */ putcon SP, DCR /* First save r0-1 and tr0, as we need to use these */ movi resvec_save_area-CONFIG_CACHED_MEMORY_OFFSET, SP @@ -481,6 +485,7 @@ .balign 256 debug_exception: + synco /* TAKum03020 (but probably a good idea anyway.) */ /* * Single step/software_break_point first level handler. * Called with MMU off, so the first thing we do is enable it @@ -788,9 +793,7 @@ ! exceptions add SP, ZERO, r14 -#define POOR_MANS_STRACE 0 - -#if POOR_MANS_STRACE +#ifdef CONFIG_POOR_MANS_STRACE /* We've pushed all the registers now, so only r2-r4 hold anything * useful. Move them into callee save registers */ or r2, ZERO, r28 @@ -811,7 +814,6 @@ or r30, ZERO, r4 #endif - /* For syscall and debug race condition, get TRA now */ getcon TRA, r5 @@ -866,7 +868,7 @@ */ .global ret_from_irq ret_from_irq: -#if POOR_MANS_STRACE +#ifdef CONFIG_POOR_MANS_STRACE pta evt_debug_ret_from_irq, tr0 ori SP, 0, r2 blink tr0, LINK @@ -884,7 +886,7 @@ ret_from_exception: preempt_stop() -#if POOR_MANS_STRACE +#ifdef CONFIG_POOR_MANS_STRACE pta evt_debug_ret_from_exc, tr0 ori SP, 0, r2 blink tr0, LINK @@ -1223,7 +1225,7 @@ syscall_ret: st.q SP, FRAME_R(9), r2 /* Expecting SP back to BASIC frame */ -#if POOR_MANS_STRACE +#ifdef CONFIG_POOR_MANS_STRACE /* nothing useful in registers at this point */ movi evt_debug2, r5 @@ -1254,7 +1256,7 @@ ptabs r5, tr0 blink tr0, LINK -#if POOR_MANS_STRACE +#ifdef CONFIG_POOR_MANS_STRACE /* nothing useful in registers at this point */ movi evt_debug2, r5 --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/head.S 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/kernel/head.S 2004-11-25 21:37:25.000000000 +0000 @@ -96,8 +96,8 @@ .long 0 /* RAMDISK_FLAGS */ .long 0x0200 /* ORIG_ROOT_DEV */ .long 1 /* LOADER_TYPE */ - .long 0x00360000 /* INITRD_START */ - .long 0x000a0000 /* INITRD_SIZE */ + .long 0x00800000 /* INITRD_START */ + .long 0x00800000 /* INITRD_SIZE */ .long 0 .text --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/module.c 1970-01-01 01:00:00.000000000 +0100 +++ dropin/arch/sh64/kernel/module.c 2004-11-25 21:37:25.000000000 +0000 @@ -0,0 +1,161 @@ +/* Kernel module help for sh64. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Copyright 2004 SuperH (UK) Ltd + Author: Richard Curnow + + Based on the sh version, and on code from the sh64-specific parts of + modutils, originally written by Richard Curnow and Ben Gaster. + +*/ +#include +#include +#include +#include +#include +#include + +#if 0 +#define DEBUGP printk +#else +#define DEBUGP(fmt...) +#endif + +void *module_alloc(unsigned long size) +{ + if (size == 0) + return NULL; + return vmalloc(size); +} + + +/* Free memory returned from module_alloc */ +void module_free(struct module *mod, void *module_region) +{ + vfree(module_region); + /* FIXME: If module_region == mod->init_region, trim exception + table entries. */ +} + +/* We don't need anything special. */ +int module_frob_arch_sections(Elf_Ehdr *hdr, + Elf_Shdr *sechdrs, + char *secstrings, + struct module *mod) +{ + return 0; +} + +int apply_relocate_add(Elf32_Shdr *sechdrs, + const char *strtab, + unsigned int symindex, + unsigned int relsec, + struct module *me) +{ + unsigned int i; + Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; + Elf32_Sym *sym; + Elf32_Addr relocation; + uint32_t *location; + int align; + int is_shmedia; + + DEBUGP("Applying relocate section %u to %u\n", relsec, + sechdrs[relsec].sh_info); + for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { + /* This is where to make the change */ + location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr + + rel[i].r_offset; + /* This is the symbol it is referring to. Note that all + undefined symbols have been resolved. */ + sym = (Elf32_Sym *)sechdrs[symindex].sh_addr + + ELF32_R_SYM(rel[i].r_info); + relocation = sym->st_value + rel[i].r_addend; + align = (int)location & 3; + + /* For text addresses, bit2 of the st_other field indicates + * whether the symbol is SHmedia (1) or SHcompact (0). If + * SHmedia, the LSB of the symbol needs to be asserted + * for the CPU to be in SHmedia mode when it starts executing + * the branch target. */ + is_shmedia = (sym->st_other & 4) ? 1 : 0; + if (is_shmedia) { + relocation |= 1; + } + + switch (ELF32_R_TYPE(rel[i].r_info)) { + case R_SH_DIR32: + DEBUGP("R_SH_DIR32 @%08lx = %08lx\n", (unsigned long) location, (unsigned long) relocation); + *location += relocation; + break; + case R_SH_REL32: + DEBUGP("R_SH_REL32 @%08lx = %08lx\n", (unsigned long) location, (unsigned long) relocation); + relocation -= (Elf32_Addr) location; + *location += relocation; + break; + case R_SH_IMM_LOW16: + DEBUGP("R_SH_IMM_LOW16 @%08lx = %08lx\n", (unsigned long) location, (unsigned long) relocation); + *location = (*location & ~0x3fffc00) | + ((relocation & 0xffff) << 10); + break; + case R_SH_IMM_MEDLOW16: + DEBUGP("R_SH_IMM_MEDLOW16 @%08lx = %08lx\n", (unsigned long) location, (unsigned long) relocation); + *location = (*location & ~0x3fffc00) | + (((relocation >> 16) & 0xffff) << 10); + break; + case R_SH_IMM_LOW16_PCREL: + DEBUGP("R_SH_IMM_LOW16_PCREL @%08lx = %08lx\n", (unsigned long) location, (unsigned long) relocation); + relocation -= (Elf32_Addr) location; + *location = (*location & ~0x3fffc00) | + ((relocation & 0xffff) << 10); + break; + case R_SH_IMM_MEDLOW16_PCREL: + DEBUGP("R_SH_IMM_MEDLOW16_PCREL @%08lx = %08lx\n", (unsigned long) location, (unsigned long) relocation); + relocation -= (Elf32_Addr) location; + *location = (*location & ~0x3fffc00) | + (((relocation >> 16) & 0xffff) << 10); + break; + default: + printk(KERN_ERR "module %s: Unknown relocation: %u\n", + me->name, ELF32_R_TYPE(rel[i].r_info)); + return -ENOEXEC; + } + } + return 0; +} + +int apply_relocate(Elf32_Shdr *sechdrs, + const char *strtab, + unsigned int symindex, + unsigned int relsec, + struct module *me) +{ + printk(KERN_ERR "module %s: REL RELOCATION unsupported\n", + me->name); + return -ENOEXEC; +} + +int module_finalize(const Elf_Ehdr *hdr, + const Elf_Shdr *sechdrs, + struct module *me) +{ + return 0; +} + +void module_arch_cleanup(struct module *mod) +{ +} + --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/ptrace.c 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/kernel/ptrace.c 2004-11-25 21:37:25.000000000 +0000 @@ -123,9 +123,26 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) { struct task_struct *child; + extern void poke_real_address_q(unsigned long long addr, unsigned long long data); +#define WPC_DBRMODE 0x0d104008 + static int first_call = 1; int ret; lock_kernel(); + + if (first_call) { + /* Set WPC.DBRMODE to 0. This makes all debug events get + * delivered through RESVEC, i.e. into the handlers in entry.S. + * (If the kernel was downloaded using a remote gdb, WPC.DBRMODE + * would normally be left set to 1, which makes debug events get + * delivered through DBRVEC, i.e. into the remote gdb's + * handlers. This prevents ptrace getting them, and confuses + * the remote gdb.) */ + printk("DBRMODE set to 0 to permit native debugging\n"); + poke_real_address_q(WPC_DBRMODE, 0); + first_call = 0; + } + ret = -EPERM; if (request == PTRACE_TRACEME) { /* are we already being traced? */ --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/sh_ksyms.c 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/kernel/sh_ksyms.c 2004-11-25 21:37:25.000000000 +0000 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -51,7 +52,6 @@ /* Networking helper routines. */ EXPORT_SYMBOL(csum_partial_copy); -EXPORT_SYMBOL(strtok); EXPORT_SYMBOL(strpbrk); EXPORT_SYMBOL(strstr); @@ -73,12 +73,17 @@ EXPORT_SYMBOL(flush_dcache_page); +/* For ext3 */ +EXPORT_SYMBOL(sh64_page_clear); + /* Ugh. These come in from libgcc.a at link time. */ extern void __sdivsi3(void); extern void __muldi3(void); extern void __udivsi3(void); +extern char __div_table; EXPORT_SYMBOL_NOVERS(__sdivsi3); EXPORT_SYMBOL_NOVERS(__muldi3); EXPORT_SYMBOL_NOVERS(__udivsi3); +EXPORT_SYMBOL_NOVERS(__div_table); --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/superhyway.c 1970-01-01 01:00:00.000000000 +0100 +++ dropin/arch/sh64/kernel/superhyway.c 2004-11-25 21:37:25.000000000 +0000 @@ -0,0 +1,112 @@ +/* + * arch/sh64/kernel/superhyway.c + * + * sh64 helper functions for the SuperHyway bus driver. + * + * Copyright (C) 2004 Paul Mundt + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static unsigned long superhyway_vaddr = IOBASE_VADDR; +static pte_t *superhyway_pte; + +static inline void __init superhyway_set_phys(unsigned long phys) +{ + pgprot_t prot = __pgprot(_PAGE_PRESENT | _PAGE_READ | + _PAGE_WRITE | _PAGE_DIRTY | + _PAGE_ACCESSED | _PAGE_SHARED); + + set_pte(superhyway_pte, pfn_pte(phys >> PAGE_SHIFT, prot)); + flush_tlb_kernel_range(superhyway_vaddr, PAGE_SIZE); +} + +static int __init superhyway_pte_init(void) +{ + pgd_t *pgd; + pmd_t *pmd; + + spin_lock(&init_mm.page_table_lock); + + pgd = pgd_offset_k(superhyway_vaddr); + pmd = pmd_offset(pgd, superhyway_vaddr); + superhyway_pte = pte_offset_kernel(pmd, superhyway_vaddr); + + spin_unlock(&init_mm.page_table_lock); + + return 0; +} + +core_initcall(superhyway_pte_init); + +int __init superhyway_scan_bus(void) +{ + u32 next = PHYS_EMI_BLOCK; + int devices = 0; + + pr_info("Scanning SuperHyway bus for devices\n"); + + do { + u64 vcr; + u32 prev; + u16 mod_id; + u8 bot_mb, top_mb; + + superhyway_set_phys(next); + + vcr = sh64_in64(superhyway_vaddr); + top_mb = (vcr >> 56) & 0xff; + bot_mb = (vcr >> 48) & 0xff; + mod_id = (vcr >> 32) & 0xffff; + + if (mod_id) { + superhyway_add_device(mod_id, next, vcr); + devices++; + } + + prev = next; + + /* + * Some VCRs report the bot_mb as either 0x0 or 0x1, + * in this case we skip down by 0x01000000 << bot_mb + * and keep scanning.. + */ + if (!bot_mb || bot_mb == 0x1) { + next -= (1 << 24) << bot_mb; + } else { + if (next == PHYS_EMI_BLOCK) { + next = bot_mb << 24; + } else { + next -= (bot_mb << 24) << top_mb; + + if (prev < next) + break; + } + } + + /* + * Scanning will have undoubtedly stepped over some + * undefined or reserved blocks, so take care to zero + * out the P-port and P-module error flags. + */ + sh64_out64(vcr & ~0xffff, superhyway_vaddr); + } while (next); + + pr_info("SuperHyway: auto scan complete, found %d device%s.\n", + devices, devices > 1 ? "s" : ""); + + return 0; +} + --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/switchto.S 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/kernel/switchto.S 2004-11-25 21:37:25.000000000 +0000 @@ -62,7 +62,7 @@ switch state, some of this is not required. But the unwinder takes struct pt_regs * as an arg so we have to build this structure to allow unwinding switched tasks in show_state() */ - + st.q r0, ( 4*8), r4 st.q r0, ( 9*8), r9 st.q r0, (10*8), r10 st.q r0, (11*8), r11 @@ -147,6 +147,7 @@ ptabs r46, tr6 ptabs r47, tr7 + ld.q r0, ( 4*8), r4 ld.q r0, ( 9*8), r9 ld.q r0, (10*8), r10 ld.q r0, (11*8), r11 --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/sys_sh64.c 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/kernel/sys_sh64.c 2004-11-25 21:37:25.000000000 +0000 @@ -284,3 +284,17 @@ return err?-EFAULT:0; } +/* Copy from mips version */ +asmlinkage long sys_shmatcall(int shmid, char __user *shmaddr, + int shmflg) +{ + unsigned long raddr; + int err; + + err = do_shmat(shmid, shmaddr, shmflg, &raddr); + if (err) + return err; + + err = raddr; + return err; +} --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/syscalls.S 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/kernel/syscalls.S 2004-11-25 21:37:25.000000000 +0000 @@ -268,7 +268,7 @@ .long sys_msgrcv .long sys_msgget .long sys_msgctl - .long sys_ni_syscall /* sys_shmatcall */ + .long sys_shmatcall .long sys_shmdt /* 245 */ .long sys_shmget .long sys_shmctl --- ../../kernel.org/linux-2.6.8.1/arch/sh64/kernel/traps.c 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/kernel/traps.c 2004-11-25 21:37:25.000000000 +0000 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -286,6 +287,8 @@ { show_task(NULL); } +/* Needed by any user of WARN_ON in view of the defn in include/asm-sh/bug.h */ +EXPORT_SYMBOL(dump_stack); static void do_unhandled_exception(int trapnr, int signr, char *str, char *fn_name, unsigned long error_code, struct pt_regs *regs, struct task_struct *tsk) --- ../../kernel.org/linux-2.6.8.1/arch/sh64/lib/copy_user_memcpy.S 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/lib/copy_user_memcpy.S 2004-11-25 21:37:25.000000000 +0000 @@ -46,6 +46,11 @@ */ +/* NOTE : Prefetches removed and allocos guarded by synco to avoid TAKum03020 + * erratum. The first two prefetches are nop-ed out to avoid upsetting the + * instruction counts used in the jump address calculation. + * */ + .section .text..SHmedia32,"ax" .little .balign 32 @@ -58,7 +63,7 @@ #define LDUAL(P,O,D0,D1) ldlo.l P,O,D0; ldhi.l P,O+3,D1 #define STUAL(P,O,D0,D1) stlo.l P,O,D0; sthi.l P,O+3,D1 - ld.b r3,0,r63 + nop ! ld.b r3,0,r63 ! TAKum03020 pta/l Large,tr0 movi 25,r0 bgeu/u r4,r0,tr0 @@ -108,7 +113,7 @@ /* 2 or 3 byte memcpy */ ld.b r3,0,r0 - ld.b r2,0,r63 + nop ! ld.b r2,0,r63 ! TAKum03020 ld.b r3,1,r1 st.b r2,0,r0 pta/l L2_3,tr0 @@ -151,7 +156,7 @@ blink tr1,r63 Large: - ld.b r2, 0, r63 + ! ld.b r2, 0, r63 ! TAKum03020 pta/l Loop_ua, tr1 ori r3, -8, r7 sub r2, r7, r22 @@ -173,8 +178,7 @@ addi r6, -8, r21 Loop_line: - ldx.q r22, r36, r63 - synco + ! ldx.q r22, r36, r63 ! TAKum03020 alloco r22, 32 synco addi r22, 32, r22 --- ../../kernel.org/linux-2.6.8.1/arch/sh64/lib/dbg.c 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/lib/dbg.c 2004-11-25 21:37:25.000000000 +0000 @@ -8,6 +8,7 @@ -- Copyright 2004 Richard Curnow (evt_debug etc) -- --------------------------------------------------------------------------*/ +#include #include #include #include @@ -136,6 +137,8 @@ /* ======================================================================= */ +#ifdef CONFIG_POOR_MANS_STRACE + #include "syscalltab.h" struct ring_node { @@ -151,6 +154,17 @@ static struct ring_node event_ring[16]; static int event_ptr = 0; +struct stored_syscall_data { + int pid; + int syscall_number; +}; + +#define N_STORED_SYSCALLS 16 + +static struct stored_syscall_data stored_syscalls[N_STORED_SYSCALLS]; +static int syscall_next=0; +static int syscall_next_print=0; + void evt_debug(int evt, int ret_addr, int event, int tra, struct pt_regs *regs) { int syscallno = tra & 0xff; @@ -187,15 +201,35 @@ event_ptr = (event_ptr + 1) & 15; if ((event == 2) && (evt == 0x160)) { - if (syscallno < NUM_SYSCALL_INFO_ENTRIES) - printk("Task %d: %s()\n", - current->pid, - syscall_info_table[syscallno].name); + if (syscallno < NUM_SYSCALL_INFO_ENTRIES) { + /* Store the syscall information to print later. We + * can't print this now - currently we're running with + * SR.BL=1, so we can't take a tlbmiss (which could occur + * in the console drivers under printk). + * + * Just overwrite old entries on ring overflow - this + * is only for last-hope debugging. */ + stored_syscalls[syscall_next].pid = current->pid; + stored_syscalls[syscall_next].syscall_number = syscallno; + syscall_next++; + syscall_next &= (N_STORED_SYSCALLS - 1); + } + } +} + +static void drain_syscalls(void) { + while (syscall_next_print != syscall_next) { + printk("Task %d: %s()\n", + stored_syscalls[syscall_next_print].pid, + syscall_info_table[stored_syscalls[syscall_next_print].syscall_number].name); + syscall_next_print++; + syscall_next_print &= (N_STORED_SYSCALLS - 1); } } void evt_debug2(unsigned int ret) { + drain_syscalls(); printk("Task %d: syscall returns %08x\n", current->pid, ret); } @@ -231,6 +265,8 @@ event_ptr = (event_ptr + 1) & 15; } +#endif /* CONFIG_POOR_MANS_STRACE */ + /* ======================================================================= */ void show_excp_regs(char *from, int trapnr, int signr, struct pt_regs *regs) --- ../../kernel.org/linux-2.6.8.1/arch/sh64/lib/io.c 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/lib/io.c 2004-11-25 21:37:25.000000000 +0000 @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2000 David J. Mckay (david.mckay@st.com) * * May be copied or modified under the terms of the GNU General Public @@ -45,46 +45,46 @@ } } -unsigned long inb(unsigned long port) +unsigned char inb(unsigned long port) { - unsigned long r; + unsigned char r; r = ctrl_inb(io_addr(port)); dprintk("inb(0x%x)=0x%x (0x%x)\n", port, r, io_addr(port)); return r; } -unsigned long inw(unsigned long port) +unsigned short inw(unsigned long port) { - unsigned long r; + unsigned short r; r = ctrl_inw(io_addr(port)); dprintk("inw(0x%x)=0x%x (0x%x)\n", port, r, io_addr(port)); return r; } -unsigned long inl(unsigned long port) +unsigned int inl(unsigned long port) { - unsigned long r; + unsigned int r; r = ctrl_inl(io_addr(port)); dprintk("inl(0x%x)=0x%x (0x%x)\n", port, r, io_addr(port)); return r; } -void outb(unsigned long value, unsigned long port) +void outb(unsigned char value, unsigned long port) { dprintk("outb(0x%x,0x%x) (0x%x)\n", value, port, io_addr(port)); ctrl_outb(value, io_addr(port)); } -void outw(unsigned long value, unsigned long port) +void outw(unsigned short value, unsigned long port) { dprintk("outw(0x%x,0x%x) (0x%x)\n", value, port, io_addr(port)); ctrl_outw(value, io_addr(port)); } -void outl(unsigned long value, unsigned long port) +void outl(unsigned int value, unsigned long port) { dprintk("outw(0x%x,0x%x) (0x%x)\n", value, port, io_addr(port)); ctrl_outl(value, io_addr(port)); --- ../../kernel.org/linux-2.6.8.1/arch/sh64/lib/page_clear.S 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/lib/page_clear.S 2004-11-25 21:37:25.000000000 +0000 @@ -17,6 +17,8 @@ Always clears 4096 bytes. + Note : alloco guarded by synco to avoid TAKum03020 erratum + */ .section .text..SHmedia32,"ax" @@ -34,6 +36,7 @@ add r2, r63, r6 1: alloco r6, 0 + synco ! TAKum03020 addi r6, 32, r6 bgt/l r7, r6, tr1 --- ../../kernel.org/linux-2.6.8.1/arch/sh64/lib/page_copy.S 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/lib/page_copy.S 2004-11-25 21:37:25.000000000 +0000 @@ -39,12 +39,17 @@ pta 3f, tr3 ptabs r18, tr0 +#if 0 + /* TAKum03020 */ ld.q r2, 0x00, r63 ld.q r2, 0x20, r63 ld.q r2, 0x40, r63 ld.q r2, 0x60, r63 +#endif alloco r3, 0x00 + synco ! TAKum03020 alloco r3, 0x20 + synco ! TAKum03020 movi 3968, r6 add r3, r6, r6 @@ -60,11 +65,15 @@ because they overlap with the time spent waiting for prefetches to complete. */ 1: +#if 0 + /* TAKum03020 */ bge/u r3, r6, tr2 ! skip prefetch for last 4 lines ldx.q r3, r22, r63 ! prefetch 4 lines hence +#endif 2: bge/u r3, r7, tr3 ! skip alloco for last 2 lines alloco r3, 0x40 ! alloc destination line 2 lines ahead + synco ! TAKum03020 3: ldx.q r3, r60, r36 ldx.q r3, r61, r37 --- ../../kernel.org/linux-2.6.8.1/arch/sh64/mm/cache.c 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/mm/cache.c 2004-11-25 21:37:25.000000000 +0000 @@ -436,6 +436,7 @@ eaddr1 = eaddr0 + cpu_data->dcache.way_ofs * cpu_data->dcache.ways; for (eaddr=eaddr0; eaddrdcache.way_ofs) { asm __volatile__ ("alloco %0, 0" : : "r" (eaddr)); + asm __volatile__ ("synco"); /* TAKum03020 */ } eaddr1 = eaddr0 + cpu_data->dcache.way_ofs * cpu_data->dcache.ways; --- ../../kernel.org/linux-2.6.8.1/arch/sh64/mm/fault.c 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/mm/fault.c 2004-11-25 21:37:25.000000000 +0000 @@ -204,17 +204,17 @@ * we can handle it.. */ good_area: - if (writeaccess) { - if (!(vma->vm_flags & VM_WRITE)) - goto bad_area; - } else { - if (!(vma->vm_flags & (VM_READ | VM_EXEC))) - goto bad_area; - } - if (textaccess) { if (!(vma->vm_flags & VM_EXEC)) goto bad_area; + } else { + if (writeaccess) { + if (!(vma->vm_flags & VM_WRITE)) + goto bad_area; + } else { + if (!(vma->vm_flags & VM_READ)) + goto bad_area; + } } /* @@ -265,17 +265,28 @@ up_read(&mm->mmap_sem); if (user_mode(regs)) { - printk("user mode bad_area address=%08lx pid=%d (%s) pc=%08lx opcode=%08lx\n", - address, current->pid, current->comm, - (unsigned long) regs->pc, - *(unsigned long *)(u32)(regs->pc & ~3)); - show_regs(regs); + static int count=0; + siginfo_t info; + if (count < 4) { + /* This is really to help debug faults when starting + * usermode, so only need a few */ + count++; + printk("user mode bad_area address=%08lx pid=%d (%s) pc=%08lx\n", + address, current->pid, current->comm, + (unsigned long) regs->pc); +#if 0 + show_regs(regs); +#endif + } if (tsk->pid == 1) { panic("INIT had user mode bad_area\n"); } tsk->thread.address = address; tsk->thread.error_code = writeaccess; - force_sig(SIGSEGV, tsk); + info.si_signo = SIGSEGV; + info.si_errno = 0; + info.si_addr = (void *) address; + force_sig_info(SIGSEGV, &info, tsk); return; } --- ../../kernel.org/linux-2.6.8.1/arch/sh64/mm/ioremap.c 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/mm/ioremap.c 2004-11-25 21:37:25.000000000 +0000 @@ -169,9 +169,8 @@ void iounmap(void *addr) { - struct vm_struct *area; - vfree((void *) (PAGE_MASK & (unsigned long) addr)); +#if 0 area = remove_vm_area((void *) (PAGE_MASK & (unsigned long) addr)); if (!area) { printk(KERN_ERR "iounmap: bad address %p\n", addr); @@ -179,11 +178,12 @@ } kfree(area); +#endif } static struct resource shmedia_iomap = { .name = "shmedia_iomap", - .start = IOBASE_VADDR, + .start = IOBASE_VADDR + PAGE_SIZE, .end = IOBASE_END - 1, }; --- ../../kernel.org/linux-2.6.8.1/arch/sh64/mm/tlbmiss.c 2004-11-25 21:30:11.000000000 +0000 +++ dropin/arch/sh64/mm/tlbmiss.c 2004-11-25 21:37:25.000000000 +0000 @@ -76,7 +76,6 @@ /* Set PTEL register, set_pte has performed the sign extension */ ptel &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */ - ptel |= _PAGE_FLAGS_HARDWARE_DEFAULT; /* add default flags */ tlbp = is_text_not_data ? &(cpu_data->itlb) : &(cpu_data->dtlb); next = tlbp->next; --- ../../kernel.org/linux-2.6.8.1/drivers/Makefile 2004-11-25 21:30:12.000000000 +0000 +++ dropin/drivers/Makefile 2004-11-25 21:37:25.000000000 +0000 @@ -51,3 +51,4 @@ obj-$(CONFIG_EISA) += eisa/ obj-$(CONFIG_CPU_FREQ) += cpufreq/ obj-y += firmware/ +obj-$(CONFIG_SUPERH) += sh/ --- ../../kernel.org/linux-2.6.8.1/drivers/serial/sh-sci.c 2004-11-25 21:30:27.000000000 +0000 +++ dropin/drivers/serial/sh-sci.c 2004-11-25 21:37:25.000000000 +0000 @@ -90,12 +90,12 @@ #if defined(CONFIG_SH_STANDARD_BIOS) || defined(CONFIG_SH_KGDB) -static void handle_error(struct uart_port *port) +static void handle_error(struct sci_port *port) { /* Clear error flags */ sci_out(port, SCxSR, SCxSR_ERROR_CLEAR(port)); } -static int get_char(struct uart_port *port) +static int get_char(struct sci_port *port) { unsigned long flags; unsigned short status; @@ -332,11 +332,11 @@ #if defined(SCIF_ONLY) || defined(SCI_AND_SCIF) #if defined(CONFIG_CPU_SH3) -/* For SH7707, SH7709, SH7709A, SH7729, SH7300*/ +/* For SH7707, SH7709, SH7709A, SH7729 */ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) { unsigned int fcr_val = 0; -#if !defined(CONFIG_CPU_SUBTYPE_SH7300) /* SH7300 doesn't use RTS/CTS */ + { unsigned short data; @@ -360,7 +360,6 @@ /* Set /RTS2 (bit6) = 0 */ ctrl_outb(data&0xbf, SCPDR); } -#endif sci_out(port, SCFCR, fcr_val); } @@ -421,7 +420,7 @@ #if !defined(SCI_ONLY) if (port->type == PORT_SCIF) { - txroom = SCIF_TXROOM_MAX - (sci_in(port, SCFDR)>>8); + txroom = 16 - (sci_in(port, SCFDR)>>8); } else { txroom = (sci_in(port, SCxSR) & SCI_TDRE)?1:0; } @@ -489,7 +488,7 @@ while (1) { #if !defined(SCI_ONLY) if (port->type == PORT_SCIF) { - count = sci_in(port, SCFDR)&SCIF_RFDC_MASK ; + count = sci_in(port, SCFDR)&0x001f; } else { count = (sci_in(port, SCxSR)&SCxSR_RDxF(port))?1:0; } @@ -672,7 +671,8 @@ pr_debug("sci: BREAK detected\n"); } -#if defined(SCIF_ORER) +#if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_ST40STB1) || \ + defined(CONFIG_CPU_SUBTYPE_SH7760) /* XXX: Handle SCIF overrun error */ if (port->type == PORT_SCIF && (sci_in(port, SCLSR) & SCIF_ORER) != 0) { sci_out(port, SCLSR, 0); @@ -726,19 +726,6 @@ sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); } } else { -#if defined(SCIF_ORER) - if((sci_in(port, SCLSR) & SCIF_ORER) != 0) { - struct tty_struct *tty = port->info->tty; - - sci_out(port, SCLSR, 0); - if(tty->flip.countflip.flag_buf_ptr++ = TTY_OVERRUN; - tty->flip.count++; - tty_flip_buffer_push(tty); - pr_debug("scif: overrun error\n"); - } - } -#endif sci_rx_interrupt(irq, ptr, regs); } @@ -761,30 +748,6 @@ return IRQ_HANDLED; } -static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr, struct pt_regs *regs) -{ - unsigned short ssr_status, scr_status; - struct uart_port *port = ptr; - - ssr_status = sci_in(port,SCxSR); - scr_status = sci_in(port,SCSCR); - - /* Tx Interrupt */ - if ((ssr_status&0x0020) && (scr_status&0x0080)) - sci_tx_interrupt(irq, ptr, regs); - /* Rx Interrupt */ - if ((ssr_status&0x0002) && (scr_status&0x0040)) - sci_rx_interrupt(irq, ptr, regs); - /* Error Interrupt */ - if ((ssr_status&0x0080) && (scr_status&0x0400)) - sci_er_interrupt(irq, ptr, regs); - /* Break Interrupt */ - if ((ssr_status&0x0010) && (scr_status&0x0200)) - sci_br_interrupt(irq, ptr, regs); - - return IRQ_HANDLED; -} - #ifdef CONFIG_CPU_FREQ /* * Here we define a transistion notifier so that we can update all of our @@ -834,26 +797,14 @@ const char *desc[] = { "SCI Receive Error", "SCI Receive Data Full", "SCI Transmit Data Empty", "SCI Break" }; - if (port->irqs[0] == port->irqs[1]) { - if (!port->irqs[0]) { - printk(KERN_ERR "sci: Cannot allocate irq.(IRQ=0)\n"); - return -ENODEV; - } - if (request_irq(port->irqs[0], sci_mpxed_interrupt, SA_INTERRUPT, - "sci", port)) { + for (i = 0; i < ARRAY_SIZE(handlers); i++) { + if (!port->irqs[i]) + continue; + if (request_irq(port->irqs[i], handlers[i], SA_INTERRUPT, + desc[i], port)) { printk(KERN_ERR "sci: Cannot allocate irq.\n"); return -ENODEV; } - } else { - for (i = 0; i < ARRAY_SIZE(handlers); i++) { - if (!port->irqs[i]) - continue; - if (request_irq(port->irqs[i], handlers[i], SA_INTERRUPT, - desc[i], port)) { - printk(KERN_ERR "sci: Cannot allocate irq.\n"); - return -ENODEV; - } - } } return 0; @@ -863,18 +814,11 @@ { int i; - if (port->irqs[0] == port->irqs[1]) { - if (!port->irqs[0]) - printk("sci: sci_free_irq error\n"); - else - free_irq(port->irqs[0], port); - } else { - for (i = 0; i < ARRAY_SIZE(port->irqs); i++) { - if (!port->irqs[i]) - continue; + for (i = 0; i < ARRAY_SIZE(port->irqs); i++) { + if (!port->irqs[i]) + continue; - free_irq(port->irqs[i], port); - } + free_irq(port->irqs[i], port); } } @@ -929,7 +873,7 @@ /* Set RIE (Receive Interrupt Enable) bit in SCSCR */ local_irq_save(flags); ctrl = sci_in(port, SCSCR); - ctrl |= SCI_CTRL_FLAGS_RIE | SCI_CTRL_FLAGS_REIE; + ctrl |= SCI_CTRL_FLAGS_RIE; sci_out(port, SCSCR, ctrl); local_irq_restore(flags); } @@ -942,7 +886,7 @@ /* Clear RIE (Receive Interrupt Enable) bit in SCSCR */ local_irq_save(flags); ctrl = sci_in(port, SCSCR); - ctrl &= ~(SCI_CTRL_FLAGS_RIE | SCI_CTRL_FLAGS_REIE); + ctrl &= ~SCI_CTRL_FLAGS_RIE; sci_out(port, SCSCR, ctrl); local_irq_restore(flags); } @@ -1032,7 +976,7 @@ case 38400: t = BPS_38400; break; case 57600: t = BPS_57600; break; case 115200: t = BPS_115200; break; - default: t = SCBRR_VALUE(baud); break; + default: t = BPS_115200; break; } if (t > 0) { @@ -1086,7 +1030,7 @@ #if defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) if (port->mapbase == 0) port->mapbase = onchip_remap(SCIF_ADDR_SH5, 1024, "SCIF"); - + port->membase = (void *)port->mapbase; #endif } @@ -1182,36 +1126,6 @@ .irqs = SH3_IRDA_IRQS, .init_pins = sci_init_pins_irda, } -#elif defined(CONFIG_CPU_SUBTYPE_SH7300) - { - .port = { - .membase = (void *)0xA4430000, - .mapbase = 0xA4430000, - .iotype = SERIAL_IO_MEM, - .irq = 25, - .ops = &sci_uart_ops, - .flags = ASYNC_BOOT_AUTOCONF, - .line = 0, - }, - .type = PORT_SCIF, - .irqs = SH7300_SCIF0_IRQS, - .init_pins = sci_init_pins_scif, - }, -#elif defined(CONFIG_SH_RTS7751R2D) - { - .port = { - .membase = (void *)0xffe80000, - .mapbase = 0xffe80000, - .iotype = SERIAL_IO_MEM, - .irq = 43, - .ops = &sci_uart_ops, - .flags = ASYNC_BOOT_AUTOCONF, - .line = 0, - }, - .type = PORT_SCIF, - .irqs = SH4_SCIF_IRQS, - .init_pins = sci_init_pins_scif, - }, #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) { .port = { @@ -1443,7 +1357,7 @@ serial_console_port = &sci_ports[co->index]; port = &serial_console_port->port; port->type = serial_console_port->type; - + #ifdef CONFIG_SUPERH64 /* This is especially needed on sh64 to remap the SCIF */ sci_config_port(port, 0); @@ -1552,6 +1466,7 @@ static int __init kgdb_console_init(void) { register_console(&kgdb_console); + return 0; } --- ../../kernel.org/linux-2.6.8.1/drivers/serial/sh-sci.h 2004-11-25 21:30:27.000000000 +0000 +++ dropin/drivers/serial/sh-sci.h 2004-11-25 21:37:25.000000000 +0000 @@ -7,7 +7,6 @@ * Copyright (C) 2000 Greg Banks * Copyright (C) 2002, 2003 Paul Mundt * Modified to support multiple serial ports. Stuart Menefy (May 2000). - * Modified to support SH7300(SH-Mobile) SCIF. Takashi Kusuda (Jun 2003). * Modified to support H8/300 Series Yoshinori Sato (Feb 2004). */ #include @@ -37,7 +36,6 @@ #define SH7760_SCIF0_IRQS { 52, 53, 55, 54 } #define SH7760_SCIF1_IRQS { 72, 73, 75, 74 } #define SH7760_SCIF2_IRQS { 76, 77, 79, 78 } -#define SH7300_SCIF0_IRQS {80, 80, 80, 80 } #define H8300H_SCI_IRQS0 {52, 53, 54, 0 } #define H8300H_SCI_IRQS1 {56, 57, 58, 0 } #define H8300H_SCI_IRQS2 {60, 61, 62, 0 } @@ -57,13 +55,6 @@ # define SCPDR 0xA4000136 /* 8 bit SCI and SCIF */ # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ # define SCI_AND_SCIF -#elif defined(CONFIG_SH_RTS7751R2D) -# define SCI_NPORTS 1 -# define SCSPTR1 0xffe0001c /* 8 bit SCI */ -# define SCSPTR2 0xFFE80020 /* 16 bit SCIF */ -# define SCIF_ORER 0x0001 /* overrun error bit */ -# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ -# define SCIF_ONLY #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) # define SCI_NPORTS 2 # define SCSPTR1 0xffe0001c /* 8 bit SCI */ @@ -78,15 +69,9 @@ # define SCSPTR0 0xfe600000 /* 16 bit SCIF */ # define SCSPTR1 0xfe610000 /* 16 bit SCIF */ # define SCSPTR2 0xfe620000 /* 16 bit SCIF */ -# define SCIF_ORER 0x0001 /* overrun error bit */ +# define SCIF_ORDER 0x0001 /* overrun error bit */ # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ # define SCIF_ONLY -#elif defined(CONFIG_CPU_SUBTYPE_SH7300) -# define SCI_NPORTS 1 -# define SCPCR 0xA4050116 /* 16 bit SCIF */ -# define SCPDR 0xA4050136 /* 16 bit SCIF */ -# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */ -# define SCIF_ONLY #elif defined(CONFIG_CPU_SUBTYPE_ST40STB1) # define SCI_NPORTS 2 # define SCSPTR1 0xffe00020 /* 16 bit SCIF */ @@ -96,7 +81,7 @@ # define SCIF_ONLY #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) # include -# define SCIF_BASE_ADDR 0x01030000 +# define SCIF_BASE_ADDR 0x01030000 # define SCIF_ADDR_SH5 PHYS_PERIPHERAL_BLOCK+SCIF_BASE_ADDR # define SCIF_PTR2_OFFS 0x0000020 # define SCIF_LSR2_OFFS 0x0000024 @@ -129,11 +114,7 @@ #define SCI_CTRL_FLAGS_RIE 0x40 /* all */ #define SCI_CTRL_FLAGS_TE 0x20 /* all */ #define SCI_CTRL_FLAGS_RE 0x10 /* all */ -#if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) -#define SCI_CTRL_FLAGS_REIE 0x08 /* 7750 SCIF */ -#else -#define SCI_CTRL_FLAGS_REIE 0 -#endif +/* SCI_CTRL_FLAGS_REIE 0x08 * 7750 SCIF */ /* SCI_CTRL_FLAGS_MPIE 0x08 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */ /* SCI_CTRL_FLAGS_TEIE 0x04 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */ /* SCI_CTRL_FLAGS_CKE1 0x02 * all */ @@ -161,16 +142,7 @@ #define SCIF_RDF 0x0002 /* 7707 SCIF, 7709 SCIF, 7750 SCIF */ #define SCIF_DR 0x0001 /* 7707 SCIF, 7709 SCIF, 7750 SCIF */ -#if defined(CONFIG_CPU_SUBTYPE_SH7300) -#define SCIF_ORER 0x0200 -#define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER) -#define SCIF_RFDC_MASK 0x007f -#define SCIF_TXROOM_MAX 64 -#else #define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK) -#define SCIF_RFDC_MASK 0x001f -#define SCIF_TXROOM_MAX 16 -#endif #if defined(SCI_ONLY) # define SCxSR_TEND(port) SCI_TEND @@ -190,25 +162,14 @@ # define SCxSR_ERRORS(port) SCIF_ERRORS # define SCxSR_RDxF(port) SCIF_RDF # define SCxSR_TDxE(port) SCIF_TDFE -#if defined(CONFIG_CPU_SUBTYPE_SH7300) -# define SCxSR_ORER(port) SCIF_ORER -#else # define SCxSR_ORER(port) 0x0000 -#endif # define SCxSR_FER(port) SCIF_FER # define SCxSR_PER(port) SCIF_PER # define SCxSR_BRK(port) SCIF_BRK -#if defined(CONFIG_CPU_SUBTYPE_SH7300) -# define SCxSR_RDxF_CLEAR(port) (sci_in(port,SCxSR)&0xfffc) -# define SCxSR_ERROR_CLEAR(port) (sci_in(port,SCxSR)&0xfd73) -# define SCxSR_TDxE_CLEAR(port) (sci_in(port,SCxSR)&0xffdf) -# define SCxSR_BREAK_CLEAR(port) (sci_in(port,SCxSR)&0xffe3) -#else # define SCxSR_RDxF_CLEAR(port) 0x00fc # define SCxSR_ERROR_CLEAR(port) 0x0073 # define SCxSR_TDxE_CLEAR(port) 0x00df # define SCxSR_BREAK_CLEAR(port) 0x00e3 -#endif #else # define SCxSR_TEND(port) (((port)->type == PORT_SCI) ? SCI_TEND : SCIF_TEND) # define SCxSR_ERRORS(port) (((port)->type == PORT_SCI) ? SCI_ERRORS : SCIF_ERRORS) @@ -227,7 +188,6 @@ /* SCFCR */ #define SCFCR_RFRST 0x0002 #define SCFCR_TFRST 0x0004 -#define SCFCR_TCRST 0x4000 #define SCFCR_MCE 0x0008 #define SCI_MAJOR 204 @@ -307,17 +267,12 @@ } #ifdef CONFIG_CPU_SH3 -#if defined(CONFIG_CPU_SUBTYPE_SH7300) -#define SCIF_FNS(name, scif_offset, scif_size) \ - CPU_SCIF_FNS(name, scif_offset, scif_size) -#else #define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \ sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \ h8_sci_offset, h8_sci_size) \ CPU_SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh3_scif_offset, sh3_scif_size) #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \ CPU_SCIF_FNS(name, sh3_scif_offset, sh3_scif_size) -#endif #elif defined(__H8300H__) || defined(__H8300S__) #define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \ sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \ @@ -333,19 +288,6 @@ CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) #endif -#if defined(CONFIG_CPU_SUBTYPE_SH7300) -SCIF_FNS(SCSMR, 0x00, 16) -SCIF_FNS(SCBRR, 0x04, 8) -SCIF_FNS(SCSCR, 0x08, 16) -SCIF_FNS(SCTDSR, 0x0c, 8) -SCIF_FNS(SCFER, 0x10, 16) -SCIF_FNS(SCxSR, 0x14, 16) -SCIF_FNS(SCFCR, 0x18, 16) -SCIF_FNS(SCFDR, 0x1c, 16) -SCIF_FNS(SCxTDR, 0x20, 8) -SCIF_FNS(SCxRDR, 0x24, 8) -SCIF_FNS(SCLSR, 0x24, 16) -#else /* reg SCI/SH3 SCI/SH4 SCIF/SH3 SCIF/SH4 SCI/H8*/ /* name off sz off sz off sz off sz off sz*/ SCIx_FNS(SCSMR, 0x00, 8, 0x00, 8, 0x00, 8, 0x00, 16, 0x00, 8) @@ -358,7 +300,7 @@ SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16) SCIF_FNS(SCSPTR, 0, 0, 0x20, 16) SCIF_FNS(SCLSR, 0, 0, 0x24, 16) -#endif + #define sci_in(port, reg) sci_##reg##_in(port) #define sci_out(port, reg, value) sci_##reg##_out(port, value) @@ -445,13 +387,6 @@ if (port->mapbase == 0xfe620000) return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ } -#elif defined(CONFIG_CPU_SUBTYPE_SH7300) -static inline int sci_rxd_in(struct uart_port *port) -{ - if (port->mapbase == 0xa4430000) - return ctrl_inb(SCPDR)&0x01 ? 1 : 0; /* SCIF0 */ - return 1; -} #elif defined(CONFIG_CPU_SUBTYPE_ST40STB1) static inline int sci_rxd_in(struct uart_port *port) { @@ -508,9 +443,7 @@ #define PCLK (current_cpu_data.module_clock) -#if defined(CONFIG_CPU_SUBTYPE_SH7300) -#define SCBRR_VALUE(bps) ((PCLK+16*bps)/(16*bps)-1) -#elif !defined(__H8300H__) && !defined(__H8300S__) +#if !defined(__H8300H__) && !defined(__H8300S__) #define SCBRR_VALUE(bps) ((PCLK+16*bps)/(32*bps)-1) #else #define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1) --- ../../kernel.org/linux-2.6.8.1/drivers/sh/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ dropin/drivers/sh/Makefile 2004-11-25 21:37:25.000000000 +0000 @@ -0,0 +1,6 @@ +# +# Makefile for the SuperH specific drivers. +# + +obj-$(CONFIG_SUPERHYWAY) += superhyway/ + --- ../../kernel.org/linux-2.6.8.1/drivers/sh/superhyway/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ dropin/drivers/sh/superhyway/Makefile 2004-11-25 21:37:25.000000000 +0000 @@ -0,0 +1,18 @@ +# +# Makefile for the SuperHyway bus drivers. +# + +obj-$(CONFIG_SUPERHYWAY) += superhyway.o +obj-$(CONFIG_SYSFS) += superhyway-sysfs.o + +clean-files := devlist.h + +$(obj)/superhyway.o: $(obj)/devlist.h + +quiet_cmd_devlist = GEN $@ + cmd_devlist = sed -e 's/^\#.*$$//g;s/^[ ].*$$//g;/^$$/d; \ + s/\(0x.*\) / { \1, /g;s/$$/ },/' < $< > $@ + +$(obj)/devlist.h: $(src)/superhyway.ids + $(call cmd,devlist) + --- ../../kernel.org/linux-2.6.8.1/drivers/sh/superhyway/superhyway-sysfs.c 1970-01-01 01:00:00.000000000 +0100 +++ dropin/drivers/sh/superhyway/superhyway-sysfs.c 2004-11-25 21:37:25.000000000 +0000 @@ -0,0 +1,50 @@ +/* + * drivers/sh/superhyway/superhyway-sysfs.c + * + * SuperHyway Bus sysfs interface + * + * Copyright (C) 2004 Paul Mundt + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + */ + +#include +#include +#include +#include + +#define superhyway_ro_attr(name, fmt, field) \ +static ssize_t superhyway_show_##name(struct device *dev, char *buf) \ +{ \ + struct superhyway_device *s = to_superhyway_device(dev); \ + return sprintf(buf, fmt, s->field); \ +} \ +static DEVICE_ATTR(name, S_IRUGO, superhyway_show_##name, NULL); + +/* VCR flags */ +superhyway_ro_attr(perr_flags, "0x%02x\n", vcr.perr_flags); +superhyway_ro_attr(merr_flags, "0x%02x\n", vcr.merr_flags); +superhyway_ro_attr(mod_vers, "0x%04x\n", vcr.mod_vers); +superhyway_ro_attr(mod_id, "0x%04x\n", vcr.mod_id); +superhyway_ro_attr(bot_mb, "0x%02x\n", vcr.bot_mb); +superhyway_ro_attr(top_mb, "0x%02x\n", vcr.top_mb); + +/* Misc */ +superhyway_ro_attr(resource, "0x%08lx\n", resource.start); + +void superhyway_create_sysfs_files(struct superhyway_device *s) +{ + struct device *dev = &s->dev; + + device_create_file(dev, &dev_attr_perr_flags); + device_create_file(dev, &dev_attr_merr_flags); + device_create_file(dev, &dev_attr_mod_vers); + device_create_file(dev, &dev_attr_mod_id); + device_create_file(dev, &dev_attr_bot_mb); + device_create_file(dev, &dev_attr_top_mb); + device_create_file(dev, &dev_attr_resource); +} + --- ../../kernel.org/linux-2.6.8.1/drivers/sh/superhyway/superhyway.c 1970-01-01 01:00:00.000000000 +0100 +++ dropin/drivers/sh/superhyway/superhyway.c 2004-11-25 21:37:25.000000000 +0000 @@ -0,0 +1,234 @@ +/* + * drivers/sh/superhyway/superhyway.c + * + * SuperHyway Bus Driver + * + * Copyright (C) 2004 Paul Mundt + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +static struct superhyway_device_info { + unsigned int id; + const char *name; +} superhyway_device_table[] __initdata = { +#include "devlist.h" +}; + +static int superhyway_devices = 0; + +static struct superhyway_bus superhyway_bus = { + .name = "SuperHyway bus", +}; + +static void superhyway_name_device(struct superhyway_device *dev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(superhyway_device_table); i++) + if (superhyway_device_table[i].id == dev->id.id) + sprintf(dev->pretty_name, "%s", + superhyway_device_table[i].name); +} + +/** + * superhyway_add_device - Add a SuperHyway module + * @mod_id: Module ID (taken from MODULE.VCR.MOD_ID). + * @base: Physical address where module is mapped. + * @vcr: VCR value. + * + * This is responsible for adding a new SuperHyway module. This sets up a new + * struct superhyway_device for the module being added. Each one of @mod_id, + * @base, and @vcr are registered with the new device for further use + * elsewhere. + * + * Devices are initially added in the order that they are scanned (from the + * top-down of the memory map), and are assigned an ID based on the order that + * they are added. Any manual addition of a module will thus get the ID after + * the devices already discovered regardless of where it resides in memory. + * + * Further work can and should be done in superhyway_scan_bus(), to be sure + * that any new modules are properly discovered and subsequently registered. + */ +int superhyway_add_device(unsigned int mod_id, unsigned long base, + unsigned long long vcr) +{ + struct superhyway_device *dev; + int ret; + + dev = kmalloc(sizeof(struct superhyway_device), GFP_KERNEL); + if (!dev) + return -ENOMEM; + + memset(dev, 0, sizeof(struct superhyway_device)); + + dev->id.id = mod_id; + sprintf(dev->name, "SuperHyway device %04x\n", dev->id.id); + + superhyway_name_device(dev); + + dev->vcr = *((struct vcr_info *)(&vcr)); + dev->resource.name = dev->name; + dev->resource.start = base; + dev->resource.end = dev->resource.start + 0x01000000; + dev->dev.parent = &superhyway_bus.dev; + dev->dev.bus = &superhyway_bus_type; + + sprintf(dev->dev.bus_id, "%02x", superhyway_devices); + + pr_info(" 0x%04x (%s) control block at 0x%08lx\n", + dev->id.id, dev->pretty_name, dev->resource.start); + + superhyway_devices++; + + list_add(&dev->node, &superhyway_bus.devices); + + ret = device_register(&dev->dev); + superhyway_create_sysfs_files(dev); + + return ret; +} + +static int __init superhyway_init(void) +{ + extern int superhyway_scan_bus(void); + + INIT_LIST_HEAD(&superhyway_bus.devices); + strcpy(superhyway_bus.dev.bus_id, "superhyway"); + device_register(&superhyway_bus.dev); + + return superhyway_scan_bus(); +} + +postcore_initcall(superhyway_init); + +static const struct superhyway_device_id * +superhyway_match_id(const struct superhyway_device_id *ids, + struct superhyway_device *dev) +{ + while (ids->id) { + if (ids->id == dev->id.id) + return ids; + + ids++; + } + + return NULL; +} + +static int superhyway_device_probe(struct device *dev) +{ + struct superhyway_device *shyway_dev = to_superhyway_device(dev); + struct superhyway_driver *shyway_drv = to_superhyway_driver(dev->driver); + + if (shyway_drv && shyway_drv->probe) { + const struct superhyway_device_id *id; + + id = superhyway_match_id(shyway_drv->id_table, shyway_dev); + if (id) + return shyway_drv->probe(shyway_dev, id); + } + + return -ENODEV; +} + +static int superhyway_device_remove(struct device *dev) +{ + struct superhyway_device *shyway_dev = to_superhyway_device(dev); + struct superhyway_driver *shyway_drv = to_superhyway_driver(dev->driver); + + if (shyway_drv && shyway_drv->remove) { + shyway_drv->remove(shyway_dev); + return 0; + } + + return -ENODEV; +} + +/** + * superhyway_register_driver - Register a new SuperHyway driver + * @drv: SuperHyway driver to register. + * + * This registers the passed in @drv. Any devices matching the id table will + * automatically be populated and handed off to the driver's specified probe + * routine. + */ +int superhyway_register_driver(struct superhyway_driver *drv) +{ + drv->drv.name = drv->name; + drv->drv.bus = &superhyway_bus_type; + drv->drv.probe = superhyway_device_probe; + drv->drv.remove = superhyway_device_remove; + + return driver_register(&drv->drv); +} + +/** + * superhyway_unregister_driver - Unregister a SuperHyway driver + * @drv: SuperHyway driver to unregister. + * + * This cleans up after superhyway_register_driver(), and should be invoked in + * the exit path of any module drivers. + */ +void superhyway_unregister_driver(struct superhyway_driver *drv) +{ + driver_unregister(&drv->drv); +} + +static int superhyway_bus_match(struct device *dev, struct device_driver *drv) +{ + struct superhyway_device *shyway_dev = to_superhyway_device(dev); + struct superhyway_driver *shyway_drv = to_superhyway_driver(drv); + const struct superhyway_device_id *ids = shyway_drv->id_table; + + if (!ids) + return -EINVAL; + if (superhyway_match_id(ids, shyway_dev)) + return 1; + + return -ENODEV; +} + +struct bus_type superhyway_bus_type = { + .name = "superhyway", + .match = superhyway_bus_match, +}; + +static int __init superhyway_bus_init(void) +{ + return bus_register(&superhyway_bus_type); +} + +static void __exit superhyway_bus_exit(void) +{ + struct superhyway_device *dev; + + list_for_each_entry(dev, &superhyway_bus.devices, node) { + device_unregister(&dev->dev); + kfree(dev); + } + + device_unregister(&superhyway_bus.dev); + bus_unregister(&superhyway_bus_type); +} + +core_initcall(superhyway_bus_init); +module_exit(superhyway_bus_exit); + +EXPORT_SYMBOL(superhyway_bus_type); +EXPORT_SYMBOL(superhyway_add_device); +EXPORT_SYMBOL(superhyway_register_driver); +EXPORT_SYMBOL(superhyway_unregister_driver); + + --- ../../kernel.org/linux-2.6.8.1/drivers/sh/superhyway/superhyway.ids 1970-01-01 01:00:00.000000000 +0100 +++ dropin/drivers/sh/superhyway/superhyway.ids 2004-11-25 21:37:25.000000000 +0000 @@ -0,0 +1,13 @@ +# +# This list is a compilation of SuperHyway module IDs and +# their associated "pretty" names. +# + +0x0183 "SH-5 DMA controller" +0x1823 "SH-5 Debug module" +0x204f "SH-5 PCI bridge" +0x2184 "SH-5 External Memory Interface" +0x2185 "SH-5 Flash ROM Interface" +0x448f "SH-5 Peripheral bridge" +0x51e2 "SH-5 CPU (SH5-101) core" + --- ../../kernel.org/linux-2.6.8.1/fs/nfs/nfs3proc.c 2004-05-10 03:32:36.000000000 +0100 +++ dropin/fs/nfs/nfs3proc.c 2004-11-25 21:37:25.000000000 +0000 @@ -427,11 +427,16 @@ { struct nfs3_diropargs *arg; struct nfs_fattr *res; + struct unlinkxdr { + struct nfs3_diropargs arg; + struct nfs_fattr res; + } *ptr; - arg = (struct nfs3_diropargs *)kmalloc(sizeof(*arg)+sizeof(*res), GFP_KERNEL); - if (!arg) + ptr = (struct unlinkxdr *)kmalloc(sizeof(*ptr), GFP_KERNEL); + if (!ptr) return -ENOMEM; - res = (struct nfs_fattr*)(arg + 1); + arg = &ptr->arg; + res = &ptr->res; arg->fh = NFS_FH(dir->d_inode); arg->name = name->name; arg->len = name->len; --- ../../kernel.org/linux-2.6.8.1/include/asm-sh64/bug.h 2004-11-25 21:30:35.000000000 +0000 +++ dropin/include/asm-sh64/bug.h 2004-11-25 21:37:25.000000000 +0000 @@ -1,7 +1,32 @@ #ifndef __ASM_SH64_BUG_H #define __ASM_SH64_BUG_H -#include +#include + +/* + * Tell the user there is some problem, then force a segfault (in process + * context) or a panic (interrupt context). + */ +#define BUG() do { \ + printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ + *(volatile int *)0 = 0; \ +} while (0) + +#define BUG_ON(condition) do { \ + if (unlikely((condition)!=0)) \ + BUG(); \ +} while(0) + +#define PAGE_BUG(page) do { \ + BUG(); \ +} while (0) + +#define WARN_ON(condition) do { \ + if (unlikely((condition)!=0)) { \ + printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \ + dump_stack(); \ + } \ +} while (0) #endif /* __ASM_SH64_BUG_H */ --- ../../kernel.org/linux-2.6.8.1/include/asm-sh64/elf.h 2004-11-25 21:30:35.000000000 +0000 +++ dropin/include/asm-sh64/elf.h 2004-11-25 21:37:25.000000000 +0000 @@ -53,6 +53,12 @@ #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) +#define R_SH_DIR32 1 +#define R_SH_REL32 2 +#define R_SH_IMM_LOW16 246 +#define R_SH_IMM_LOW16_PCREL 247 +#define R_SH_IMM_MEDLOW16 248 +#define R_SH_IMM_MEDLOW16_PCREL 249 #define ELF_CORE_COPY_REGS(_dest,_regs) \ memcpy((char *) &_dest, (char *) _regs, \ --- ../../kernel.org/linux-2.6.8.1/include/asm-sh64/hardware.h 2004-11-25 21:30:35.000000000 +0000 +++ dropin/include/asm-sh64/hardware.h 2004-11-25 21:37:25.000000000 +0000 @@ -17,29 +17,6 @@ #define PHYS_PERIPHERAL_BLOCK 0x09000000 #define PHYS_DMAC_BLOCK 0x0e000000 #define PHYS_PCI_BLOCK 0x60000000 - -#ifndef __ASSEMBLY__ -#include -#include - -struct vcr_info { - u8 perr_flags; /* P-port Error flags */ - u8 merr_flags; /* Module Error flags */ - u16 mod_vers; /* Module Version */ - u16 mod_id; /* Module ID */ - u8 bot_mb; /* Bottom Memory block */ - u8 top_mb; /* Top Memory block */ -}; - -static inline struct vcr_info sh64_get_vcr_info(unsigned long base) -{ - unsigned long long tmp; - - tmp = sh64_in64(base); - - return *((struct vcr_info *)&tmp); -} - -#endif /* __ASSEMBLY__ */ +#define PHYS_EMI_BLOCK 0xff000000 #endif /* __ASM_SH64_HARDWARE_H */ --- ../../kernel.org/linux-2.6.8.1/include/asm-sh64/ide.h 2004-11-25 21:30:35.000000000 +0000 +++ dropin/include/asm-sh64/ide.h 2004-11-25 21:37:25.000000000 +0000 @@ -21,6 +21,9 @@ #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS #endif +/* Without this, the initialisation of PCI IDE cards end up calling + * ide_init_hwif_ports, which won't work. */ +#define IDE_ARCH_OBSOLETE_INIT 1 #define ide_default_io_ctl(base) (0) #include --- ../../kernel.org/linux-2.6.8.1/include/asm-sh64/io.h 2004-11-25 21:30:35.000000000 +0000 +++ dropin/include/asm-sh64/io.h 2004-11-25 21:37:25.000000000 +0000 @@ -49,9 +49,9 @@ return *(volatile unsigned short *)addr; } -static inline unsigned long sh64_in32(unsigned long addr) +static inline unsigned int sh64_in32(unsigned long addr) { - return *(volatile unsigned long *)addr; + return *(volatile unsigned int *)addr; } static inline unsigned long long sh64_in64(unsigned long addr) @@ -71,9 +71,9 @@ wmb(); } -static inline void sh64_out32(unsigned long b, unsigned long addr) +static inline void sh64_out32(unsigned int b, unsigned long addr) { - *(volatile unsigned long *)addr = b; + *(volatile unsigned int *)addr = b; wmb(); } @@ -83,13 +83,13 @@ wmb(); } -#define readb(addr) sh64_in8(addr) -#define readw(addr) sh64_in16(addr) -#define readl(addr) sh64_in32(addr) - -#define writeb(b, addr) sh64_out8(b, addr) -#define writew(b, addr) sh64_out16(b, addr) -#define writel(b, addr) sh64_out32(b, addr) +#define readb(addr) sh64_in8((unsigned long)(addr)) +#define readw(addr) sh64_in16((unsigned long)(addr)) +#define readl(addr) sh64_in32((unsigned long)(addr)) + +#define writeb(b, addr) sh64_out8(b, (unsigned long)(addr)) +#define writew(b, addr) sh64_out16(b, (unsigned long)(addr)) +#define writel(b, addr) sh64_out32(b, (unsigned long)(addr)) #define ctrl_inb(addr) sh64_in8(addr) #define ctrl_inw(addr) sh64_in16(addr) @@ -99,12 +99,19 @@ #define ctrl_outw(b, addr) sh64_out16(b, addr) #define ctrl_outl(b, addr) sh64_out32(b, addr) -unsigned long inb(unsigned long port); -unsigned long inw(unsigned long port); -unsigned long inl(unsigned long port); -void outb(unsigned long value, unsigned long port); -void outw(unsigned long value, unsigned long port); -void outl(unsigned long value, unsigned long port); +unsigned char inb(unsigned long port); +unsigned short inw(unsigned long port); +unsigned int inl(unsigned long port); +void outb(unsigned char value, unsigned long port); +void outw(unsigned short value, unsigned long port); +void outl(unsigned int value, unsigned long port); +void outsw(unsigned long port, const void *addr, unsigned long count); +void insw(unsigned long port, void *addr, unsigned long count); +void outsl(unsigned long port, const void *addr, unsigned long count); +void insl(unsigned long port, void *addr, unsigned long count); + +void memcpy_toio(unsigned long to, const void *from, long count); +void memcpy_fromio(void *to, unsigned long from, long count); #ifdef __KERNEL__ --- ../../kernel.org/linux-2.6.8.1/include/asm-sh64/ioctls.h 2004-11-25 21:30:35.000000000 +0000 +++ dropin/include/asm-sh64/ioctls.h 2004-11-25 21:37:25.000000000 +0000 @@ -9,103 +9,108 @@ * include/asm-sh64/ioctls.h * * Copyright (C) 2000, 2001 Paolo Alberelli + * Copyright (C) 2004 Richard Curnow * */ #include -#define FIOCLEX _IO('f', 1) -#define FIONCLEX _IO('f', 2) -#define FIOASYNC _IOW('f', 125, int) -#define FIONBIO _IOW('f', 126, int) -#define FIONREAD _IOR('f', 127, int) +#define FIOCLEX 0x6601 /* _IO('f', 1) */ +#define FIONCLEX 0x6602 /* _IO('f', 2) */ +#define FIOASYNC 0x4004667d /* _IOW('f', 125, int) */ +#define FIONBIO 0x4004667e /* _IOW('f', 126, int) */ +#define FIONREAD 0x8004667f /* _IOW('f', 127, int) */ #define TIOCINQ FIONREAD -#define FIOQSIZE _IOR('f', 128, loff_t) +#define FIOQSIZE 0x80086680 /* _IOR('f', 128, loff_t) */ #define TCGETS 0x5401 #define TCSETS 0x5402 #define TCSETSW 0x5403 #define TCSETSF 0x5404 -#define TCGETA _IOR('t', 23, struct termio) -#define TCSETA _IOW('t', 24, struct termio) -#define TCSETAW _IOW('t', 25, struct termio) -#define TCSETAF _IOW('t', 28, struct termio) - -#define TCSBRK _IO('t', 29) -#define TCXONC _IO('t', 30) -#define TCFLSH _IO('t', 31) - -#define TIOCSWINSZ _IOW('t', 103, struct winsize) -#define TIOCGWINSZ _IOR('t', 104, struct winsize) -#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ -#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ -#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ - -#define TIOCSPGRP _IOW('t', 118, int) -#define TIOCGPGRP _IOR('t', 119, int) - -#define TIOCEXCL _IO('T', 12) /* 0x540C */ -#define TIOCNXCL _IO('T', 13) /* 0x540D */ -#define TIOCSCTTY _IO('T', 14) /* 0x540E */ - -#define TIOCSTI _IOW('T', 18, char) /* 0x5412 */ -#define TIOCMGET _IOR('T', 21, unsigned int) /* 0x5415 */ -#define TIOCMBIS _IOW('T', 22, unsigned int) /* 0x5416 */ -#define TIOCMBIC _IOW('T', 23, unsigned int) /* 0x5417 */ -#define TIOCMSET _IOW('T', 24, unsigned int) /* 0x5418 */ -# define TIOCM_LE 0x001 -# define TIOCM_DTR 0x002 -# define TIOCM_RTS 0x004 -# define TIOCM_ST 0x008 -# define TIOCM_SR 0x010 -# define TIOCM_CTS 0x020 -# define TIOCM_CAR 0x040 -# define TIOCM_RNG 0x080 -# define TIOCM_DSR 0x100 -# define TIOCM_CD TIOCM_CAR -# define TIOCM_RI TIOCM_RNG - -#define TIOCGSOFTCAR _IOR('T', 25, unsigned int) /* 0x5419 */ -#define TIOCSSOFTCAR _IOW('T', 26, unsigned int) /* 0x541A */ -#define TIOCLINUX _IOW('T', 28, char) /* 0x541C */ -#define TIOCCONS _IO('T', 29) /* 0x541D */ -#define TIOCGSERIAL _IOR('T', 30, struct serial_struct) /* 0x541E */ -#define TIOCSSERIAL _IOW('T', 31, struct serial_struct) /* 0x541F */ -#define TIOCPKT _IOW('T', 32, int) /* 0x5420 */ -# define TIOCPKT_DATA 0 -# define TIOCPKT_FLUSHREAD 1 -# define TIOCPKT_FLUSHWRITE 2 -# define TIOCPKT_STOP 4 -# define TIOCPKT_START 8 -# define TIOCPKT_NOSTOP 16 -# define TIOCPKT_DOSTOP 32 - - -#define TIOCNOTTY _IO('T', 34) /* 0x5422 */ -#define TIOCSETD _IOW('T', 35, int) /* 0x5423 */ -#define TIOCGETD _IOR('T', 36, int) /* 0x5424 */ -#define TCSBRKP _IOW('T', 37, int) /* 0x5425 */ /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* 0x5426 */ /* For debugging only */ -#define TIOCSBRK _IO('T', 39) /* 0x5427 */ /* BSD compatibility */ -#define TIOCCBRK _IO('T', 40) /* 0x5428 */ /* BSD compatibility */ -#define TIOCGSID _IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session ID of FD */ -#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ -#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ - -#define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */ -#define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */ -#define TIOCSERSWILD _IOW('T', 85, int) /* 0x5455 */ +#define TCGETA 0x80127417 /* _IOR('t', 23, struct termio) */ +#define TCSETA 0x40127418 /* _IOW('t', 24, struct termio) */ +#define TCSETAW 0x40127419 /* _IOW('t', 25, struct termio) */ +#define TCSETAF 0x4012741c /* _IOW('t', 28, struct termio) */ + +#define TCSBRK 0x741d /* _IO('t', 29) */ +#define TCXONC 0x741e /* _IO('t', 30) */ +#define TCFLSH 0x741f /* _IO('t', 31) */ + +#define TIOCSWINSZ 0x40087467 /* _IOW('t', 103, struct winsize) */ +#define TIOCGWINSZ 0x80087468 /* _IOR('t', 104, struct winsize) */ +#define TIOCSTART 0x746e /* _IO('t', 110) start output, like ^Q */ +#define TIOCSTOP 0x746f /* _IO('t', 111) stop output, like ^S */ +#define TIOCOUTQ 0x80047473 /* _IOR('t', 115, int) output queue size */ + +#define TIOCSPGRP 0x40047476 /* _IOW('t', 118, int) */ +#define TIOCGPGRP 0x80047477 /* _IOR('t', 119, int) */ + +#define TIOCEXCL 0x540c /* _IO('T', 12) */ +#define TIOCNXCL 0x540d /* _IO('T', 13) */ +#define TIOCSCTTY 0x540e /* _IO('T', 14) */ + +#define TIOCSTI 0x40015412 /* _IOW('T', 18, char) 0x5412 */ +#define TIOCMGET 0x80045415 /* _IOR('T', 21, unsigned int) 0x5415 */ +#define TIOCMBIS 0x40045416 /* _IOW('T', 22, unsigned int) 0x5416 */ +#define TIOCMBIC 0x40045417 /* _IOW('T', 23, unsigned int) 0x5417 */ +#define TIOCMSET 0x40045418 /* _IOW('T', 24, unsigned int) 0x5418 */ + +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG + +#define TIOCGSOFTCAR 0x80045419 /* _IOR('T', 25, unsigned int) 0x5419 */ +#define TIOCSSOFTCAR 0x4004541a /* _IOW('T', 26, unsigned int) 0x541A */ +#define TIOCLINUX 0x4004541c /* _IOW('T', 28, char) 0x541C */ +#define TIOCCONS 0x541d /* _IO('T', 29) */ +#define TIOCGSERIAL 0x803c541e /* _IOR('T', 30, struct serial_struct) 0x541E */ +#define TIOCSSERIAL 0x403c541f /* _IOW('T', 31, struct serial_struct) 0x541F */ +#define TIOCPKT 0x40045420 /* _IOW('T', 32, int) 0x5420 */ + +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 + + +#define TIOCNOTTY 0x5422 /* _IO('T', 34) */ +#define TIOCSETD 0x40045423 /* _IOW('T', 35, int) 0x5423 */ +#define TIOCGETD 0x80045424 /* _IOR('T', 36, int) 0x5424 */ +#define TCSBRKP 0x40045424 /* _IOW('T', 37, int) 0x5425 */ /* Needed for POSIX tcsendbreak() */ +#define TIOCTTYGSTRUCT 0x8c105426 /* _IOR('T', 38, struct tty_struct) 0x5426 */ /* For debugging only */ +#define TIOCSBRK 0x5427 /* _IO('T', 39) */ /* BSD compatibility */ +#define TIOCCBRK 0x5428 /* _IO('T', 40) */ /* BSD compatibility */ +#define TIOCGSID 0x80045429 /* _IOR('T', 41, pid_t) 0x5429 */ /* Return the session ID of FD */ +#define TIOCGPTN 0x80045430 /* _IOR('T',0x30, unsigned int) 0x5430 Get Pty Number (of pty-mux device) */ +#define TIOCSPTLCK 0x40045431 /* _IOW('T',0x31, int) Lock/unlock Pty */ + +#define TIOCSERCONFIG 0x5453 /* _IO('T', 83) */ +#define TIOCSERGWILD 0x80045454 /* _IOR('T', 84, int) 0x5454 */ +#define TIOCSERSWILD 0x40045455 /* _IOW('T', 85, int) 0x5455 */ #define TIOCGLCKTRMIOS 0x5456 #define TIOCSLCKTRMIOS 0x5457 -#define TIOCSERGSTRUCT _IOR('T', 88, struct async_struct) /* 0x5458 */ /* For debugging only */ -#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line status register */ - /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ -# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ -#define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* 0x545A */ /* Get multiport config */ -#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* 0x545B */ /* Set multiport config */ +#define TIOCSERGSTRUCT 0x80d85458 /* _IOR('T', 88, struct async_struct) 0x5458 */ /* For debugging only */ +#define TIOCSERGETLSR 0x80045459 /* _IOR('T', 89, unsigned int) 0x5459 */ /* Get line status register */ -#define TIOCMIWAIT _IO('T', 92) /* 0x545C */ /* wait for a change on serial input line(s) */ -#define TIOCGICOUNT _IOR('T', 93, struct async_icount) /* 0x545D */ /* read serial port inline interrupt counts */ +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ +#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ + +#define TIOCSERGETMULTI 0x80a8545a /* _IOR('T', 90, struct serial_multiport_struct) 0x545A */ /* Get multiport config */ +#define TIOCSERSETMULTI 0x40a8545b /* _IOW('T', 91, struct serial_multiport_struct) 0x545B */ /* Set multiport config */ + +#define TIOCMIWAIT 0x545c /* _IO('T', 92) wait for a change on serial input line(s) */ +#define TIOCGICOUNT 0x802c545d /* _IOR('T', 93, struct async_icount) 0x545D */ /* read serial port inline interrupt counts */ #endif /* __ASM_SH64_IOCTLS_H */ --- ../../kernel.org/linux-2.6.8.1/include/asm-sh64/module.h 2004-11-25 21:30:35.000000000 +0000 +++ dropin/include/asm-sh64/module.h 2004-11-25 21:37:25.000000000 +0000 @@ -4,6 +4,14 @@ * This file contains the SH architecture specific module code. */ +struct mod_arch_specific { + /* empty */ +}; + +#define Elf_Shdr Elf32_Shdr +#define Elf_Sym Elf32_Sym +#define Elf_Ehdr Elf32_Ehdr + #define module_map(x) vmalloc(x) #define module_unmap(x) vfree(x) #define module_arch_init(x) (0) --- ../../kernel.org/linux-2.6.8.1/include/asm-sh64/pgtable.h 2004-11-25 21:30:35.000000000 +0000 +++ dropin/include/asm-sh64/pgtable.h 2004-11-25 21:37:25.000000000 +0000 @@ -278,8 +278,6 @@ /* Mask which drops software flags */ #define _PAGE_FLAGS_HARDWARE_MASK 0xfffffffffffff3dbLL -/* Flags default: 4KB, Read, Not write, Not execute, Not user */ -#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x0000000000000040LL /* * HugeTLB support --- ../../kernel.org/linux-2.6.8.1/include/asm-sh64/thread_info.h 2004-11-25 21:30:35.000000000 +0000 +++ dropin/include/asm-sh64/thread_info.h 2004-11-25 21:37:25.000000000 +0000 @@ -61,13 +61,18 @@ } /* thread information allocation */ -#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,2)) + + + +#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) #define get_thread_info(ti) get_task_struct((ti)->task) #define put_thread_info(ti) put_task_struct((ti)->task) #endif /* __ASSEMBLY__ */ +#define THREAD_SIZE 8192 + #define PREEMPT_ACTIVE 0x4000000 /* thread information flags */ @@ -75,7 +80,6 @@ #define TIF_SIGPENDING 2 /* signal pending */ #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ -#define THREAD_SIZE 16384 #endif /* __KERNEL__ */ --- ../../kernel.org/linux-2.6.8.1/include/linux/superhyway.h 1970-01-01 01:00:00.000000000 +0100 +++ dropin/include/linux/superhyway.h 2004-11-25 21:37:26.000000000 +0000 @@ -0,0 +1,96 @@ +/* + * include/linux/superhyway.h + * + * SuperHyway Bus definitions + * + * Copyright (C) 2004 Paul Mundt + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + */ + +#ifndef __LINUX_SUPERHYWAY_H +#define __LINUX_SUPERHYWAY_H + +#include + +/* + * SuperHyway IDs + */ +#define SUPERHYWAY_DEVICE_ID_SH5_DMAC 0x0183 + + +struct vcr_info { + u8 perr_flags; /* P-port Error flags */ + u8 merr_flags; /* Module Error flags */ + u16 mod_vers; /* Module Version */ + u16 mod_id; /* Module ID */ + u8 bot_mb; /* Bottom Memory block */ + u8 top_mb; /* Top Memory block */ +}; + +struct superhyway_device_id { + unsigned int id; + unsigned long driver_data; +}; + +struct superhyway_device; +extern struct bus_type superhyway_bus_type; + +struct superhyway_driver { + char *name; + + const struct superhyway_device_id *id_table; + struct device_driver drv; + + int (*probe)(struct superhyway_device *dev, const struct superhyway_device_id *id); + void (*remove)(struct superhyway_device *dev); +}; + +#define to_superhyway_driver(d) container_of((d), struct superhyway_driver, drv) + +struct superhyway_device { + struct list_head node; + + char name[32]; + char pretty_name[64]; + + struct device dev; + + struct superhyway_device_id id; + struct superhyway_driver *drv; + + struct resource resource; + struct vcr_info vcr; +}; + +#define to_superhyway_device(d) container_of((d), struct superhyway_device, dev) + +struct superhyway_bus { + struct list_head devices; + struct device dev; + char name[16]; +}; + +#define superhyway_get_drvdata(d) dev_get_drvdata(&(d)->dev) +#define superhyway_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p)) + +/* drivers/sh/superhyway/superhyway.c */ +int superhyway_register_driver(struct superhyway_driver *); +void superhyway_unregister_driver(struct superhyway_driver *); +int superhyway_add_device(unsigned int, unsigned long, unsigned long long); + +/* drivers/sh/superhyway/superhyway-sysfs.c */ +#ifdef CONFIG_SYSFS +void superhyway_create_sysfs_files(struct superhyway_device *); +#else +void superhyway_create_sysfs_files(struct superhyway_device *s) +{ + /* Nothing to do */ +} +#endif + +#endif /* __LINUX_SUPERHYWAY_H */ + --- ../../kernel.org/linux-2.6.8.1/scripts/checkstack.pl 2004-11-25 21:30:40.000000000 +0000 +++ dropin/scripts/checkstack.pl 2004-11-25 21:37:26.000000000 +0000 @@ -9,6 +9,7 @@ # Mips port by Juan Quintela # IA64 port via Andreas Dilger # Arm port by Holger Schurig +# sh64 port by Paul Mundt # Random bits by Matt Mackall # M68k port by Geert Uytterhoeven and Andreas Schwab # @@ -61,6 +62,12 @@ } elsif ($arch =~ /^s390x?$/) { # 11160: a7 fb ff 60 aghi %r15,-160 $re = qr/.*ag?hi.*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})/o; + } elsif ($arch =~ /^sh64$/) { + #XXX: we only check for the immediate case presently, + # though we will want to check for the movi/sub + # pair for larger users. -- PFM. + #a00048e0: d4fc40f0 addi.l r15,-240,r15 + $re = qr/.*addi\.l.*r15,-(([0-9]{2}|[3-9])[0-9]{2}),r15/o; } else { print("wrong or unknown architecture\n"); exit --- ../../kernel.org/linux-2.6.8.1/scripts/lxdialog/colors.h 2004-05-10 03:31:59.000000000 +0100 +++ dropin/scripts/lxdialog/colors.h 2004-11-25 21:37:26.000000000 +0000 @@ -38,7 +38,7 @@ #define DIALOG_BG COLOR_WHITE #define DIALOG_HL FALSE -#define TITLE_FG COLOR_YELLOW +#define TITLE_FG COLOR_RED #define TITLE_BG COLOR_WHITE #define TITLE_HL TRUE @@ -82,7 +82,7 @@ #define SEARCHBOX_BG COLOR_WHITE #define SEARCHBOX_HL FALSE -#define SEARCHBOX_TITLE_FG COLOR_YELLOW +#define SEARCHBOX_TITLE_FG COLOR_RED #define SEARCHBOX_TITLE_BG COLOR_WHITE #define SEARCHBOX_TITLE_HL TRUE @@ -90,7 +90,7 @@ #define SEARCHBOX_BORDER_BG COLOR_WHITE #define SEARCHBOX_BORDER_HL TRUE -#define POSITION_INDICATOR_FG COLOR_YELLOW +#define POSITION_INDICATOR_FG COLOR_RED #define POSITION_INDICATOR_BG COLOR_WHITE #define POSITION_INDICATOR_HL TRUE @@ -110,7 +110,7 @@ #define ITEM_SELECTED_BG COLOR_BLUE #define ITEM_SELECTED_HL TRUE -#define TAG_FG COLOR_YELLOW +#define TAG_FG COLOR_RED #define TAG_BG COLOR_WHITE #define TAG_HL TRUE @@ -118,7 +118,7 @@ #define TAG_SELECTED_BG COLOR_BLUE #define TAG_SELECTED_HL TRUE -#define TAG_KEY_FG COLOR_YELLOW +#define TAG_KEY_FG COLOR_RED #define TAG_KEY_BG COLOR_WHITE #define TAG_KEY_HL TRUE