diff -urN linux-2.5/arch/ppc/8260_io/uart.c ppc/arch/ppc/8260_io/uart.c --- linux-2.5/arch/ppc/8260_io/uart.c 2003-06-12 20:27:46.000000000 +1000 +++ ppc/arch/ppc/8260_io/uart.c 2003-08-22 09:54:55.000000000 +1000 @@ -50,6 +50,10 @@ #include #include +#ifdef CONFIG_MAGIC_SYSRQ +#include +#endif + #ifdef CONFIG_SERIAL_CONSOLE #include @@ -77,6 +81,14 @@ static struct tty_driver *serial_driver; static int serial_console_setup(struct console *co, char *options); +static void serial_console_write(struct console *c, const char *s, + unsigned count); +static kdev_t serial_console_device(struct console *c); + +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +static unsigned long break_pressed; /* break, really ... */ +#endif + /* * Serial driver configuration section. Here are the various options: */ @@ -208,6 +220,15 @@ cbd_t *tx_cur; } ser_info_t; +static struct console sercons = { + .name = "ttyS", + .write = serial_console_write, + .device = serial_console_device, + .setup = serial_console_setup, + .flags = CON_PRINTBUFFER, + .index = CONFIG_SERIAL_CONSOLE_PORT, +}; + static void change_speed(ser_info_t *info); static void rs_8xx_wait_until_sent(struct tty_struct *tty, int timeout); @@ -328,7 +349,7 @@ schedule_work(&info->tqueue); } -static _INLINE_ void receive_chars(ser_info_t *info) +static _INLINE_ void receive_chars(ser_info_t *info, struct pt_regs *regs) { struct tty_struct *tty = info->tty; unsigned char ch, *cp; @@ -450,6 +471,19 @@ } } } + +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) + if (break_pressed && info->line == sercons.index) { + if (ch != 0 && time_before(jiffies, + break_pressed + HZ*5)) { + handle_sysrq(ch, regs, NULL, NULL); + break_pressed = 0; + goto ignore_char; + } else + break_pressed = 0; + } +#endif + if (tty->flip.count >= TTY_FLIPBUF_SIZE) break; @@ -458,6 +492,10 @@ tty->flip.count++; } +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) + ignore_char: +#endif + /* This BD is ready to be used again. Clear status. * Get next BD. */ @@ -475,7 +513,36 @@ schedule_delayed_work(&tty->flip.work, 1); } -static _INLINE_ void transmit_chars(ser_info_t *info) +static _INLINE_ void receive_break(ser_info_t *info, struct pt_regs *regs) +{ + struct tty_struct *tty = info->tty; + + info->state->icount.brk++; + +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) + if (info->line == sercons.index) { + if (!break_pressed) { + break_pressed = jiffies; + return; + } else + break_pressed = 0; + } +#endif + + /* Check to see if there is room in the tty buffer for + * the break. If not, we exit now, losing the break. FIXME + */ + if ((tty->flip.count + 1) >= TTY_FLIPBUF_SIZE) + return; + *(tty->flip.flag_buf_ptr++) = TTY_BREAK; + *(tty->flip.char_buf_ptr++) = 0; + tty->flip.count++; + + queue_task(&tty->flip.tqueue, &tq_timer); +} + + +static _INLINE_ void transmit_chars(ser_info_t *info, struct pt_regs *regs) { if (info->flags & TX_WAKEUP) { @@ -575,19 +642,23 @@ if ((idx = info->state->smc_scc_num) < SCC_NUM_BASE) { smcp = &immr->im_smc[idx]; events = smcp->smc_smce; + if (events & SMCM_BRKE) + receive_break(info, regs); if (events & SMCM_RX) - receive_chars(info); + receive_chars(info, regs); if (events & SMCM_TX) - transmit_chars(info); + transmit_chars(info, regs); smcp->smc_smce = events; } else { sccp = &immr->im_scc[idx - SCC_IDX_BASE]; events = sccp->scc_scce; + if (events & SMCM_BRKE) + receive_break(info, regs); if (events & SCCM_RX) - receive_chars(info); + receive_chars(info, regs); if (events & SCCM_TX) - transmit_chars(info); + transmit_chars(info, regs); sccp->scc_scce = events; } @@ -2207,7 +2278,7 @@ static void serial_console_write(struct console *c, const char *s, unsigned count) { -#if defined(CONFIG_KGDB) && !defined(CONFIG_USE_SERIAL2_KGDB) +#if defined(CONFIG_KGDB_CONSOLE) && !defined(CONFIG_USE_SERIAL2_KGDB) /* Try to let stub handle output. Returns true if it did. */ if (kgdb_output_string(s, count)) return; @@ -2397,16 +2468,6 @@ return serial_driver; } - -static struct console sercons = { - .name = "ttyS", - .write = serial_console_write, - .device = serial_console_device, - .setup = serial_console_setup, - .flags = CON_PRINTBUFFER, - .index = CONFIG_SERIAL_CONSOLE_PORT, -}; - /* * Register console. */ diff -urN linux-2.5/arch/ppc/8xx_io/uart.c ppc/arch/ppc/8xx_io/uart.c --- linux-2.5/arch/ppc/8xx_io/uart.c 2003-06-12 20:27:46.000000000 +1000 +++ ppc/arch/ppc/8xx_io/uart.c 2003-08-22 09:54:55.000000000 +1000 @@ -1068,7 +1068,7 @@ volatile cbd_t *bdp; unsigned char *cp; -#ifdef CONFIG_KGDB +#ifdef CONFIG_KGDB_CONSOLE /* Try to let stub handle output. Returns true if it did. */ if (kgdb_output_string(buf, count)) return ret; @@ -2271,7 +2271,7 @@ static void serial_console_write(struct console *c, const char *s, unsigned count) { -#ifdef CONFIG_KGDB +#ifdef CONFIG_KGDB_CONSOLE /* Try to let stub handle output. Returns true if it did. */ if (kgdb_output_string(s, count)) return; diff -urN linux-2.5/arch/ppc/Kconfig ppc/arch/ppc/Kconfig --- linux-2.5/arch/ppc/Kconfig 2003-08-06 07:42:19.000000000 +1000 +++ ppc/arch/ppc/Kconfig 2003-08-22 09:54:55.000000000 +1000 @@ -1426,20 +1426,12 @@ config KGDB bool "Include kgdb kernel debugger" depends on DEBUG_KERNEL + select DEBUG_INFO help Include in-kernel hooks for kgdb, the Linux kernel source level debugger. See for more information. Unless you are intending to debug the kernel, say N here. -config DEBUG_INFO - bool "Compile the kernel with debug info" - depends on DEBUG_KERNEL - help - If you say Y here the resulting kernel image will include - debugging info resulting in a larger kernel image. - Say Y here only if you plan to use gdb to debug the kernel. - If you don't debug the kernel, you can say N. - choice prompt "Serial Port" depends on KGDB @@ -1459,6 +1451,14 @@ endchoice +config KGDB_CONSOLE + bool "Enable serial console thru kgdb port" + depends on KGDB && 8xx || 8260 + help + If you enable this, all serial console messages will be sent + over the gdb stub. + If unsure, say N. + config XMON bool "Include xmon kernel debugger" depends on DEBUG_KERNEL @@ -1474,18 +1474,16 @@ Unless you are intending to debug the kernel with one of these machines, say N here. -config MORE_COMPILE_OPTIONS - bool "Add any additional compile options" - depends on DEBUG_KERNEL && (KGDB || XMON || BDI_SWITCH) - help - If you want to add additional CFLAGS to the kernel build, such as -g - for KGDB or the BDI2000, enable this option and then enter what you - would like to add in the next question. - -config COMPILE_OPTIONS - string "Additional compile arguments" - depends on MORE_COMPILE_OPTIONS - default "-g -ggdb" +config DEBUG_INFO + bool "Compile the kernel with debug info" + depends on DEBUG_KERNEL + default y if BDI_SWITCH || XMON + help + If you say Y here the resulting kernel image will include + debugging info resulting in a larger kernel image. + Say Y here only if you plan to use some sort of debugger to + debug the kernel. + If you don't debug the kernel, you can say N. config BOOTX_TEXT bool "Support for early boot text console (BootX or OpenFirmware only)" diff -urN linux-2.5/arch/ppc/Makefile ppc/arch/ppc/Makefile --- linux-2.5/arch/ppc/Makefile 2003-08-02 09:37:29.000000000 +1000 +++ ppc/arch/ppc/Makefile 2003-08-22 09:54:55.000000000 +1000 @@ -22,9 +22,6 @@ cflags-$(CONFIG_4xx) += -Wa,-m405 cflags-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge -# Use sed to remove the quotes. -cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \ - $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g') CFLAGS += $(cflags-y) diff -urN linux-2.5/arch/ppc/boot/common/ns16550.c ppc/arch/ppc/boot/common/ns16550.c --- linux-2.5/arch/ppc/boot/common/ns16550.c 2003-07-06 21:33:45.000000000 +1000 +++ ppc/arch/ppc/boot/common/ns16550.c 2003-08-22 09:54:55.000000000 +1000 @@ -60,7 +60,7 @@ else { /* Input clock. */ outb(com_port + (UART_DLL << shift), - (BASE_BAUD / SERIAL_BAUD)); + (BASE_BAUD / SERIAL_BAUD) & 0xFF); outb(com_port + (UART_DLM << shift), (BASE_BAUD / SERIAL_BAUD) >> 8); /* 8 data, 1 stop, no parity */ diff -urN linux-2.5/arch/ppc/boot/common/util.S ppc/arch/ppc/boot/common/util.S --- linux-2.5/arch/ppc/boot/common/util.S 2003-03-16 22:35:03.000000000 +1100 +++ ppc/arch/ppc/boot/common/util.S 2003-08-22 09:54:55.000000000 +1000 @@ -160,9 +160,22 @@ blr +/* udelay (on non-601 processors) needs to know the period of the + * timebase in nanoseconds. This used to be hardcoded to be 60ns + * (period of 66MHz/4). Now a variable is used that is initialized to + * 60 for backward compatibility, but it can be overridden as necessary + * with code something like this: + * extern unsigned long timebase_period_ns; + * timebase_period_ns = 1000000000 / bd->bi_tbfreq; + */ + .data + .globl timebase_period_ns +timebase_period_ns: + .long 60 + + .text /* * Delay for a number of microseconds - * -- Use the BUS timer (assumes 66MHz) */ .globl udelay udelay: @@ -180,8 +193,13 @@ .udelay_not_601: mulli r4,r3,1000 /* nanoseconds */ - addi r4,r4,59 - li r5,60 + /* Change r4 to be the number of ticks using: + * (nanoseconds + (timebase_period_ns - 1 )) / timebase_period_ns + * timebase_period_ns defaults to 60 (16.6MHz) */ + lis r5,timebase_period_ns@h + lwz r5,timebase_period_ns@l(r5) + addi r4,r4,r5 + addi r4,r4,-1 divw r4,r4,r5 /* BUS ticks */ 1: mftbu r5 mftb r6 diff -urN linux-2.5/arch/ppc/boot/simple/Makefile ppc/arch/ppc/boot/simple/Makefile --- linux-2.5/arch/ppc/boot/simple/Makefile 2003-07-06 21:33:45.000000000 +1000 +++ ppc/arch/ppc/boot/simple/Makefile 2003-08-20 09:13:13.000000000 +1000 @@ -22,7 +22,6 @@ # get_mem_size(), which is memory controller dependent. Add in the correct # XXX_memory.o file for this to work, as well as editing the $(MISC) file. -boot: zImage boot := arch/ppc/boot common := $(boot)/common @@ -32,86 +31,90 @@ # Normally, we use the 'misc.c' file for decompress_kernel and # whatnot. Sometimes we need to override this however. -MISC := misc.o -ifeq ($(CONFIG_IBM_OPENBIOS),y) -ZIMAGE := zImage-TREE -ZIMAGEINITRD := zImage.initrd-TREE -END := treeboot -TFTPIMAGE := /tftpboot/zImage.$(END) -MISC := misc-embedded.o -endif -ifeq ($(CONFIG_EMBEDDEDBOOT),y) -TFTPIMAGE := /tftpboot/zImage.embedded -MISC := misc-embedded.o -endif -ifeq ($(CONFIG_EBONY),y) -ZIMAGE := zImage-TREE -ZIMAGEINITRD := zImage.initrd-TREE -END := ebony -ENTRYPOINT := 0x01000000 -TFTPIMAGE := /tftpboot/zImage.$(END) -endif -ifeq ($(CONFIG_EV64260),y) -EXTRA := misc-ev64260.o -TFTPIMAGE := /tftpboot/zImage.ev64260 -endif -ifeq ($(CONFIG_GEMINI),y) -ZIMAGE := zImage-STRIPELF -ZIMAGEINITRD := zImage.initrd-STRIPELF -END := gemini -TFTPIMAGE := /tftpboot/zImage.$(END) -endif -ifeq ($(CONFIG_K2),y) -EXTRA := legacy.o -TFTPIMAGE := /tftpboot/zImage.k2 -endif -# kbuild-2.4 'feature', only one of these will ever by 'y' at a time. +misc-y := misc.o + +# +# See arch/ppc/kconfig and arch/ppc/platforms/Kconfig +# for definition of what platform each config option refer to. +#---------------------------------------------------------------------------- + zimage-$(CONFIG_IBM_OPENBIOS) := zImage-TREE +zimageinitrd-$(CONFIG_IBM_OPENBIOS) := zImage.initrd-TREE + end-$(CONFIG_IBM_OPENBIOS) := treeboot + tftpimage-$(CONFIG_IBM_OPENBIOS) := /tftpboot/zImage.$(end-y) + misc-$(CONFIG_IBM_OPENBIOS) := misc-embedded.o + + tftpimage-$(CONFIG_EMBEDDEDBOOT) := /tftpboot/zImage.embedded + misc-$(CONFIG_EMBEDDEDBOOT) := misc-embedded.o + + zimage-$(CONFIG_EBONY) := zImage-TREE +zimageinitrd-$(CONFIG_EBONY) := zImage.initrd-TREE + extra.o-$(CONFIG_EBONY) := direct.o + end-$(CONFIG_EBONY) := ebony + entrypoint-$(CONFIG_EBONY) := 0x01000000 + tftpimage-$(CONFIG_EBONY) := /tftpboot/zImage.$(end-y) + + extra.o-$(CONFIG_EV64260) := direct.o misc-ev64260.o + tftpimage-$(CONFIG_EV64260) := /tftpboot/zImage.ev64260 + + zimage-$(CONFIG_GEMINI) := zImage-STRIPELF +zimageinitrd-$(CONFIG_GEMINI) := zImage.initrd-STRIPELF + end-$(CONFIG_GEMINI) := gemini + tftpimage-$(CONFIG_GEMINI) := /tftpboot/zImage.$(end-y) + + extra.o-$(CONFIG_K2) := legacy.o + tftpimage-$(CONFIG_K2) := /tftpboot/zImage.k2 + +# kconfig 'feature', only one of these will ever by 'y' at a time. # The rest will be unset. -ifeq ($(CONFIG_MCPN765)$(CONFIG_MVME5100)$(CONFIG_PRPMC750)$(CONFIG_PRPMC800)$(CONFIG_LOPEC)$(CONFIG_PPLUS),y) -ZIMAGE := zImage-PPLUS -ZIMAGEINITRD := zImage.initrd-PPLUS -TFTPIMAGE := /tftpboot/zImage.pplus -ZNETBOOT := zImage.pplus -ZNETBOOTRD := zImage.initrd.pplus -endif -ifeq ($(CONFIG_PPLUS),y) -EXTRA := legacy.o -endif -ifeq ($(CONFIG_PCORE)$(CONFIG_POWERPMC250),y) -ZIMAGE := zImage-STRIPELF -ZIMAGEINITRD := zImage.initrd-STRIPELF -EXTRA := chrpmap.o -END := pcore -TFTPIMAGE := /tftpboot/zImage.$(END) -endif -ifeq ($(CONFIG_SANDPOINT),y) -TFTPIMAGE := /tftpboot/zImage.sandpoint -endif -ifeq ($(CONFIG_SPRUCE),y) -ZIMAGE := zImage-TREE -ZIMAGEINITRD := zImage.initrd-TREE -END := spruce -ENTRYPOINT := 0x00800000 -MISC := misc-spruce.o -TFTPIMAGE := /tftpboot/zImage.$(END) -endif -ifeq ($(CONFIG_SMP),y) -TFTPIMAGE += .smp -endif -ifeq ($(CONFIG_REDWOOD_4),y) +multi := $(CONFIG_MCPN765)$(CONFIG_MVME5100)$(CONFIG_PRPMC750) \ +$(CONFIG_PRPMC800)$(CONFIG_LOPEC)$(CONFIG_PPLUS) + zimage-$(multi) := zImage-PPLUS +zimageinitrd-$(multi) := zImage.initrd-PPLUS + tftpimage-$(multi) := /tftpboot/zImage.pplus + znetboot-$(multi) := zImage.pplus + znetbootrd-$(multi) := zImage.initrd.pplus + +# Overrides previous assingment + extra.o-$(CONFIG_PPLUS) := legacy.o + + zimage-$(CONFIG_PCORE) := zImage-STRIPELF +zimageinitrd-$(CONFIG_PCORE) := zImage.initrd-STRIPELF + extra.o-$(CONFIG_PCORE) := chrpmap.o + end-$(CONFIG_PCORE) := pcore + tftpimage-$(CONFIG_PCORE) := /tftpboot/zImage.$(end-y) + + zimage-$(CONFIG_POWERPMC250) := zImage-STRIPELF +zimageinitrd-$(CONFIG_POWERPMC250) := zImage.initrd-STRIPELF + extra.o-$(CONFIG_POWERPMC250) := chrpmap.o + end-$(CONFIG_POWERPMC250) := pcore + tftpimage-$(CONFIG_POWERPMC250) := /tftpboot/zImage.$(end-y) + + tftpimage-$(CONFIG_SANDPOINT) := /tftpboot/zImage.sandpoint + + zimage-$(CONFIG_SPRUCE) := zImage-TREE +zimageinitrd-$(CONFIG_SPRUCE) := zImage.initrd-TREE + end-$(CONFIG_SPRUCE) := spruce + entrypoint-$(CONFIG_SPRUCE) := 0x00800000 + misc-$(CONFIG_SPRUCE) := misc-spruce.o + tftpimage-$(CONFIG_SPRUCE) := /tftpboot/zImage.$(end-y) + + +# tftp image is prefixed with .smp if compiled for SMP +tftpimage-$(CONFIG_SMP) += .smp + # This is a treeboot that needs init functions until the # boot rom is sorted out (i.e. this is short lived) -EXTRA_AFLAGS := -Wa,-m405 -EXTRA := rw4/rw4_init.o rw4/rw4_init_brd.o -endif +extra-aflags-$(CONFIG_REDWOOD_4) := -Wa,-m405 +extra.o-$(CONFIG_REDWOOD_4) := rw4/rw4_init.o rw4/rw4_init_brd.o +EXTRA_AFLAGS := $(extra-aflags-y) # Linker args. This specifies where the image will be run at. -LD_ARGS = -T $(boot)/ld.script \ - -Ttext $(CONFIG_BOOT_LOAD) -Bstatic +LD_ARGS := -T $(boot)/ld.script \ + -Ttext $(CONFIG_BOOT_LOAD) -Bstatic OBJCOPY_ARGS := -O elf32-powerpc # head.o and relocate.o must be at the start. -boot-y := head.o relocate.o $(EXTRA) $(MISC) +boot-y := head.o relocate.o $(extra.o-y) $(misc-y) boot-$(CONFIG_40x) += embed_config.o boot-$(CONFIG_8xx) += embed_config.o boot-$(CONFIG_8260) += embed_config.o @@ -160,40 +163,40 @@ -R .stabstr -R .sysmap # Sort-of dummy rules, that let us format the image we want. -zImage: $(images)/$(ZIMAGE) $(obj)/zvmlinux +zImage: $(images)/$(zimage-y) $(obj)/zvmlinux cp -f $(obj)/zvmlinux $(images)/zImage.elf rm -f $(obj)/zvmlinux -zImage.initrd: $(images)/$(ZIMAGEINITRD) $(obj)/zvmlinux.initrd +zImage.initrd: $(images)/$(zimageinitrd-y) $(obj)/zvmlinux.initrd cp -f $(obj)/zvmlinux.initrd $(images)/zImage.initrd.elf rm -f $(obj)/zvmlinux.initrd znetboot: zImage ifneq ($(ZNETBOOT),) - cp $(images)/$(ZNETBOOT) $(TFTPIMAGE) + cp $(images)/$(ZNETBOOT) $(tftpimage-y) else - cp $(images)/zImage.* $(TFTPIMAGE) + cp $(images)/zImage.* $(tftpimage-y) endif znetboot.initrd: zImage.initrd -ifneq ($(ZNETBOOTRD),) - cp $(images)/$(ZNETBOOTRD) $(TFTPIMAGE) +ifneq ($(znetbootrd-y),) + cp $(images)/$(znetbootrd-y) $(tftpimage-y) else - cp $(images)/zImage.* $(TFTPIMAGE) + cp $(images)/zImage.* $(tftpimage-y) endif $(images)/zImage-STRIPELF: $(obj)/zvmlinux - dd if=$(obj)/zvmlinux of=$(images)/zImage.$(END) skip=64 bs=1k + dd if=$(obj)/zvmlinux of=$(images)/zImage.$(end-y) skip=64 bs=1k $(images)/zImage.initrd-STRIPELF: $(obj)/zvmlinux.initrd - dd if=$(obj)/zvmlinux.initrd of=$(images)/zImage.initrd.$(END) \ + dd if=$(obj)/zvmlinux.initrd of=$(images)/zImage.initrd.$(end-y) \ skip=64 bs=1k $(images)/zImage-TREE: $(obj)/zvmlinux $(MKTREE) - $(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(END) $(ENTRYPOINT) + $(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(end-y) $(ENTRYPOINT) $(images)/zImage.initrd-TREE: $(obj)/zvmlinux.initrd $(MKTREE) - $(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(END) \ + $(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(end-y) \ $(ENTRYPOINT) $(images)/zImage-PPLUS: $(obj)/zvmlinux $(MKPREP) $(MKBUGBOOT) diff -urN linux-2.5/arch/ppc/boot/simple/embed_config.c ppc/arch/ppc/boot/simple/embed_config.c --- linux-2.5/arch/ppc/boot/simple/embed_config.c 2003-03-23 18:06:17.000000000 +1100 +++ ppc/arch/ppc/boot/simple/embed_config.c 2003-08-22 09:54:55.000000000 +1000 @@ -20,6 +20,7 @@ #ifdef CONFIG_40x #include #endif +extern unsigned long timebase_period_ns; /* For those boards that don't provide one. */ @@ -768,6 +769,7 @@ #if defined(CONFIG_REDWOOD_5) || defined (CONFIG_REDWOOD_6) bd->bi_tbfreq = 27 * 1000 * 1000; #endif + timebase_period_ns = 1000000000 / bd->bi_tbfreq; } #endif /* CONFIG_BEECH */ #endif /* CONFIG_IBM_OPENBIOS */ diff -urN linux-2.5/arch/ppc/boot/simple/misc-embedded.c ppc/arch/ppc/boot/simple/misc-embedded.c --- linux-2.5/arch/ppc/boot/simple/misc-embedded.c 2003-06-08 08:08:29.000000000 +1000 +++ ppc/arch/ppc/boot/simple/misc-embedded.c 2003-08-22 09:54:55.000000000 +1000 @@ -75,7 +75,7 @@ extern void embed_config(bd_t **bp); unsigned long -decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, bd_t *bp) +load_kernel(unsigned long load_addr, int num_words, unsigned long cksum, bd_t *bp) { char *cp, ch; int timer = 0, zimage_size; diff -urN linux-2.5/arch/ppc/boot/simple/misc-spruce.c ppc/arch/ppc/boot/simple/misc-spruce.c --- linux-2.5/arch/ppc/boot/simple/misc-spruce.c 2003-02-17 12:01:25.000000000 +1100 +++ ppc/arch/ppc/boot/simple/misc-spruce.c 2003-08-22 09:54:55.000000000 +1000 @@ -147,7 +147,7 @@ #define MEM_B2EA 0x60 unsigned long -decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum) +load_kernel(unsigned long load_addr, int num_words, unsigned long cksum) { int timer = 0; char *cp, ch; diff -urN linux-2.5/arch/ppc/boot/simple/misc.c ppc/arch/ppc/boot/simple/misc.c --- linux-2.5/arch/ppc/boot/simple/misc.c 2003-02-17 12:01:25.000000000 +1100 +++ ppc/arch/ppc/boot/simple/misc.c 2003-08-22 09:54:55.000000000 +1000 @@ -252,3 +252,10 @@ return (struct bi_record *)rec_loc; } + +/* Allow decompress_kernel to be hooked into. This is the default. */ +void * __attribute__ ((weak)) +load_kernel(unsigned long load_addr, int num_words, unsigned long cksum) +{ + return decompress_kernel(load_addr, num_words, cksum); +} diff -urN linux-2.5/arch/ppc/boot/simple/relocate.S ppc/arch/ppc/boot/simple/relocate.S --- linux-2.5/arch/ppc/boot/simple/relocate.S 2003-02-17 12:01:25.000000000 +1100 +++ ppc/arch/ppc/boot/simple/relocate.S 2003-08-22 09:54:55.000000000 +1000 @@ -183,7 +183,7 @@ mr r4,r7 /* Program length */ mr r5,r6 /* Checksum */ mr r6,r11 /* Residual data */ - bl decompress_kernel + bl load_kernel /* * Make sure the kernel knows we don't have things set in diff -urN linux-2.5/arch/ppc/boot/utils/mktree.c ppc/arch/ppc/boot/utils/mktree.c --- linux-2.5/arch/ppc/boot/utils/mktree.c 2002-09-16 14:51:58.000000000 +1000 +++ ppc/arch/ppc/boot/utils/mktree.c 2003-08-22 09:54:55.000000000 +1000 @@ -86,7 +86,7 @@ } cksum = 0; - cp = (uint *)&bt; + cp = (void *)&bt; for (i=0; i #include +#include #include #include #include @@ -186,7 +187,7 @@ * return 0. */ static unsigned char * -mem2hex(char *mem, char *buf, int count) +mem2hex(const char *mem, char *buf, int count) { unsigned char ch; unsigned short tmp_s; @@ -828,11 +829,11 @@ return; } - asm(" .globl breakinst - breakinst: .long 0x7d821008 - "); + asm(" .globl breakinst \n\ + breakinst: .long 0x7d821008"); } +#ifdef CONFIG_KGDB_CONSOLE /* Output string in GDB O-packet format if GDB has connected. If nothing output, returns 0 (caller must then handle output). */ int @@ -852,3 +853,4 @@ return 1; } +#endif diff -urN linux-2.5/arch/ppc/kernel/ppc_ksyms.c ppc/arch/ppc/kernel/ppc_ksyms.c --- linux-2.5/arch/ppc/kernel/ppc_ksyms.c 2003-07-06 21:33:45.000000000 +1000 +++ ppc/arch/ppc/kernel/ppc_ksyms.c 2003-08-22 09:54:56.000000000 +1000 @@ -200,6 +200,7 @@ EXPORT_SYMBOL(flush_icache_user_range); EXPORT_SYMBOL(flush_dcache_page); EXPORT_SYMBOL(flush_tlb_kernel_range); +EXPORT_SYMBOL(flush_tlb_page); #ifdef CONFIG_ALTIVEC EXPORT_SYMBOL(last_task_used_altivec); EXPORT_SYMBOL(giveup_altivec); diff -urN linux-2.5/arch/ppc/kernel/smp.c ppc/arch/ppc/kernel/smp.c --- linux-2.5/arch/ppc/kernel/smp.c 2003-08-20 08:58:38.000000000 +1000 +++ ppc/arch/ppc/kernel/smp.c 2003-08-23 12:29:24.000000000 +1000 @@ -47,8 +47,8 @@ DEFINE_PER_CPU(unsigned int, prof_multiplier); DEFINE_PER_CPU(unsigned int, prof_counter); unsigned long cache_decay_ticks = HZ/100; -unsigned long cpu_online_map = cpumask_of_cpu(0); -unsigned long cpu_possible_map = 1UL; +cpumask_t cpu_online_map; +cpumask_t cpu_possible_map; int smp_hw_index[NR_CPUS]; struct thread_info *secondary_ti; @@ -336,7 +336,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) { - int num_cpus; + int num_cpus, i; /* Fixup boot cpu */ smp_store_cpu_info(smp_processor_id()); @@ -350,7 +350,8 @@ /* Probe platform for CPUs: always linear. */ num_cpus = smp_ops->probe(); - cpu_possible_map = (1 << num_cpus)-1; + for (i = 0; i < num_cpus; ++i) + cpu_set(i, cpu_possible_map); /* Backup CPU 0 state */ __save_cpu_setup(); diff -urN linux-2.5/arch/ppc/kernel/syscalls.c ppc/arch/ppc/kernel/syscalls.c --- linux-2.5/arch/ppc/kernel/syscalls.c 2003-07-18 08:18:30.000000000 +1000 +++ ppc/arch/ppc/kernel/syscalls.c 2003-08-23 12:15:18.000000000 +1000 @@ -262,4 +262,14 @@ return error; } +/* + * We put the arguments in a different order so we only use 6 + * registers for arguments, rather than 7 as sys_fadvise64_64 needs + * (because `offset' goes in r5/r6). + */ +long ppc_fadvise64_64(int fd, int advice, loff_t offset, loff_t len) +{ + return sys_fadvise64_64(fd, offset, len, advice); +} + cond_syscall(sys_pciconfig_iobase); diff -urN linux-2.5/arch/ppc/platforms/mcpn765_serial.h ppc/arch/ppc/platforms/mcpn765_serial.h --- linux-2.5/arch/ppc/platforms/mcpn765_serial.h 2003-02-17 12:01:25.000000000 +1100 +++ ppc/arch/ppc/platforms/mcpn765_serial.h 2003-08-22 09:54:56.000000000 +1000 @@ -30,7 +30,8 @@ #endif /* Rate for the 1.8432 Mhz clock for the onboard serial chip */ -#define BASE_BAUD ( 1843200 / 16 ) +#define BASE_BAUD ( 1843200 / 16 ) +#define UART_CLK 1843200 #ifdef CONFIG_SERIAL_DETECT_IRQ #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ) diff -urN linux-2.5/arch/ppc/platforms/mcpn765_setup.c ppc/arch/ppc/platforms/mcpn765_setup.c --- linux-2.5/arch/ppc/platforms/mcpn765_setup.c 2003-04-25 09:17:21.000000000 +1000 +++ ppc/arch/ppc/platforms/mcpn765_setup.c 2003-08-22 09:54:56.000000000 +1000 @@ -31,6 +31,9 @@ #include #include #include +#include +#include /* for linux/serial_core.h */ +#include #include #include @@ -49,36 +52,94 @@ #include #include "mcpn765.h" +#include "mcpn765_serial.h" + static u_char mcpn765_openpic_initsenses[] __initdata = { - 0, /* 16: i8259 cascade (active high) */ - 1, /* 17: COM1,2,3,4 */ - 1, /* 18: Enet 1 (front panel) */ - 1, /* 19: HAWK WDT XXXX */ - 1, /* 20: 21554 PCI-PCI bridge */ - 1, /* 21: cPCI INTA# */ - 1, /* 22: cPCI INTB# */ - 1, /* 23: cPCI INTC# */ - 1, /* 24: cPCI INTD# */ - 1, /* 25: PMC1 INTA#, PMC2 INTB# */ - 1, /* 26: PMC1 INTB#, PMC2 INTC# */ - 1, /* 27: PMC1 INTC#, PMC2 INTD# */ - 1, /* 28: PMC1 INTD#, PMC2 INTA# */ - 1, /* 29: Enet 2 (connected to J3) */ - 1, /* 30: Abort Switch */ - 1, /* 31: RTC Alarm */ + (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE),/* 16: i8259 cascade */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 17: COM1,2,3,4 */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 18: Enet 1 (front) */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 19: HAWK WDT XXXX */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 20: 21554 bridge */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 21: cPCI INTA# */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 22: cPCI INTB# */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 23: cPCI INTC# */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 24: cPCI INTD# */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 25: PMC1 INTA#,PMC2 INTB#*/ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 26: PMC1 INTB#,PMC2 INTC#*/ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 27: PMC1 INTC#,PMC2 INTD#*/ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 28: PMC1 INTD#,PMC2 INTA#*/ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 29: Enet 2 (J3) */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 30: Abort Switch */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 31: RTC Alarm */ }; extern u_int openpic_irq(void); extern char cmd_line[]; +extern void gen550_progress(char *, unsigned short); +extern void gen550_init(int, struct uart_port *); + int use_of_interrupt_tree = 0; static void mcpn765_halt(void); TODC_ALLOC(); +#if defined(CONFIG_SERIAL_8250) && \ + (defined(CONFIG_KGDB) || defined(CONFIG_SERIAL_TEXT_DEBUG)) +static void __init +mcpn765_early_serial_map(void) +{ + struct uart_port serial_req; + + /* Setup serial port access */ + memset(&serial_req, 0, sizeof(serial_req)); + serial_req.uartclk = UART_CLK; + serial_req.irq = 17; + serial_req.flags = STD_COM_FLAGS; + serial_req.iotype = SERIAL_IO_MEM; + serial_req.membase = (u_char *)MCPN765_SERIAL_1; + serial_req.regshift = 4; + + gen550_init(0, &serial_req); + + if (early_serial_setup(&serial_req) != 0) + printk(KERN_ERR "Early serial init of port 0 failed\n"); + + /* Assume early_serial_setup() doesn't modify serial_req */ + serial_req.line = 1; + serial_req.irq = 17; + serial_req.membase = (u_char *)MCPN765_SERIAL_2; + + gen550_init(1, &serial_req); + + if (early_serial_setup(&serial_req) != 0) + printk(KERN_ERR "Early serial init of port 1 failed\n"); + + /* Assume early_serial_setup() doesn't modify serial_req */ + serial_req.line = 2; + serial_req.irq = 17; + serial_req.membase = (u_char *)MCPN765_SERIAL_3; + + gen550_init(2, &serial_req); + + if (early_serial_setup(&serial_req) != 0) + printk(KERN_ERR "Early serial init of port 2 failed\n"); + + /* Assume early_serial_setup() doesn't modify serial_req */ + serial_req.line = 3; + serial_req.irq = 17; + serial_req.membase = (u_char *)MCPN765_SERIAL_4; + + gen550_init(3, &serial_req); + + if (early_serial_setup(&serial_req) != 0) + printk(KERN_ERR "Early serial init of port 3 failed\n"); +} +#endif + static void __init mcpn765_setup_arch(void) { @@ -187,12 +248,12 @@ if ( ppc_md.progress ) ppc_md.progress("init_irq: enter", 0); - openpic_init(1, NUM_8259_INTERRUPTS, NULL, -1); + openpic_init(NUM_8259_INTERRUPTS); for(i=0; i < NUM_8259_INTERRUPTS; i++) irq_desc[i].handler = &i8259_pic; - i8259_init(NULL); + i8259_init(0); if ( ppc_md.progress ) ppc_md.progress("init_irq: exit", 0); @@ -361,65 +422,15 @@ static __inline__ void mcpn765_set_bat(void) { - unsigned long bat3u, bat3l; - static int mapping_set = 0; - - if (!mapping_set) { - - __asm__ __volatile__( - " lis %0,0xf000\n \ - ori %1,%0,0x002a\n \ - ori %0,%0,0x1ffe\n \ - mtspr 0x21e,%0\n \ - mtspr 0x21f,%1\n \ - isync\n \ - sync " - : "=r" (bat3u), "=r" (bat3l)); - - mapping_set = 1; - } - - return; -} - -#ifdef CONFIG_SERIAL_TEXT_DEBUG -#include -#include -#include - -static struct serial_state rs_table[RS_TABLE_SIZE] = { - SERIAL_PORT_DFNS /* Defined in */ -}; - -static void -mcpn765_progress(char *s, unsigned short hex) -{ - volatile char c; - volatile unsigned long com_port; - u16 shift; - - com_port = rs_table[0].port; - shift = rs_table[0].iomem_reg_shift; - - while ((c = *s++) != 0) { - while ((*((volatile unsigned char *)com_port + - (UART_LSR << shift)) & UART_LSR_THRE) == 0) - ; - *(volatile unsigned char *)com_port = c; - - if (c == '\n') { - while ((*((volatile unsigned char *)com_port + - (UART_LSR << shift)) & UART_LSR_THRE) == 0) - ; - *(volatile unsigned char *)com_port = '\r'; - } - } + mb(); + mtspr(DBAT1U, 0xfe8000fe); + mtspr(DBAT1L, 0xfe80002a); + mb(); } -#endif /* CONFIG_SERIAL_TEXT_DEBUG */ void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7) + unsigned long r6, unsigned long r7) { parse_bootinfo(find_bootinfo()); @@ -458,11 +469,13 @@ ppc_md.heartbeat_reset = 0; ppc_md.heartbeat_count = 0; -#ifdef CONFIG_SERIAL_TEXT_DEBUG - ppc_md.progress = mcpn765_progress; -#else /* !CONFIG_SERIAL_TEXT_DEBUG */ - ppc_md.progress = NULL; -#endif /* CONFIG_SERIAL_TEXT_DEBUG */ +#if defined(CONFIG_SERIAL_8250) && \ + (defined(CONFIG_KGDB) || defined(CONFIG_SERIAL_TEXT_DEBUG)) + mcpn765_early_serial_map(); +#ifdef CONFIG_SERIAL_TEXT_DEBUG + ppc_md.progress = gen550_progress; +#endif +#endif #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) ppc_ide_md.default_irq = mcpn765_ide_default_irq; diff -urN linux-2.5/arch/ppc/platforms/sandpoint.c ppc/arch/ppc/platforms/sandpoint.c --- linux-2.5/arch/ppc/platforms/sandpoint.c 2003-07-06 21:33:45.000000000 +1000 +++ ppc/arch/ppc/platforms/sandpoint.c 2003-08-22 09:54:56.000000000 +1000 @@ -357,6 +357,21 @@ } /* + * Fix IDE interrupts. + */ +static int __init +sandpoint_fix_winbond_83553(void) +{ + /* Make all 8259 interrupt level sensitive */ + outb(0xf8, 0x4d0); + outb(0xde, 0x4d1); + + return 0; +} + +arch_initcall(sandpoint_fix_winbond_83553); + +/* * Initialize the ISA devices on the Nat'l PC87308VUL SuperIO chip. */ static int __init @@ -391,21 +406,6 @@ arch_initcall(sandpoint_setup_natl_87308); -/* - * Fix IDE interrupts. - */ -static int __init -sandpoint_fix_winbond_83553(void) -{ - /* Make all 8259 interrupt level sensitive */ - outb(0xf8, 0x4d0); - outb(0xde, 0x4d1); - - return 0; -} - -arch_initcall(sandpoint_fix_winbond_83553); - static int __init sandpoint_request_io(void) { diff -urN linux-2.5/arch/ppc/platforms/sandpoint.h ppc/arch/ppc/platforms/sandpoint.h --- linux-2.5/arch/ppc/platforms/sandpoint.h 2003-07-06 21:33:45.000000000 +1000 +++ ppc/arch/ppc/platforms/sandpoint.h 2003-08-22 09:54:56.000000000 +1000 @@ -61,9 +61,9 @@ #define UART_CLK 1843200 #ifdef CONFIG_SERIAL_DETECT_IRQ -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ) +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ) #else -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST) +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF) #endif #define STD_SERIAL_PORT_DFNS \ diff -urN linux-2.5/drivers/i2c/i2c-keywest.c ppc/drivers/i2c/i2c-keywest.c --- linux-2.5/drivers/i2c/i2c-keywest.c 2003-08-04 09:47:00.000000000 +1000 +++ ppc/drivers/i2c/i2c-keywest.c 2003-08-23 12:01:38.000000000 +1000 @@ -510,7 +510,7 @@ struct keywest_chan* chan = &iface->channels[i]; u8 addr; - sprintf(chan->adapter.dev.name, "%s %d", np->parent->name, i); + sprintf(chan->adapter.name, "%s %d", np->parent->name, i); chan->iface = iface; chan->chan_no = i; chan->adapter.id = I2C_ALGO_SMBUS; @@ -523,7 +523,7 @@ rc = i2c_add_adapter(&chan->adapter); if (rc) { printk("i2c-keywest.c: Adapter %s registration failed\n", - chan->adapter.dev.name); + chan->adapter.name); i2c_set_adapdata(&chan->adapter, NULL); } if (probe) { diff -urN linux-2.5/drivers/ide/ppc/pmac.c ppc/drivers/ide/ppc/pmac.c --- linux-2.5/drivers/ide/ppc/pmac.c 2003-08-17 12:11:31.000000000 +1000 +++ ppc/drivers/ide/ppc/pmac.c 2003-08-23 12:02:11.000000000 +1000 @@ -942,7 +942,7 @@ if (hwif->sg_dma_active) BUG(); - nents = blk_rq_map_sg(&drive->queue, rq, sg); + nents = blk_rq_map_sg(drive->queue, rq, sg); if (rq_data_dir(rq) == READ) pmif->sg_dma_direction = PCI_DMA_FROMDEVICE; @@ -1589,7 +1589,7 @@ HWGROUP(drive)->busy = 1; pmac_ide_dma_check(drive); HWGROUP(drive)->busy = 0; - if (!list_empty(&drive->queue.queue_head)) + if (!list_empty(&drive->queue->queue_head)) ide_do_request(HWGROUP(drive), 0); spin_unlock_irq(&ide_lock); } @@ -1673,7 +1673,7 @@ /* We resume processing on the HW group */ spin_lock_irqsave(&ide_lock, flags); HWGROUP(drive)->busy = 0; - if (!list_empty(&drive->queue.queue_head)) + if (!list_empty(&drive->queue->queue_head)) ide_do_request(HWGROUP(drive), 0); spin_unlock_irqrestore(&ide_lock, flags); } diff -urN linux-2.5/drivers/scsi/mac53c94.c ppc/drivers/scsi/mac53c94.c --- linux-2.5/drivers/scsi/mac53c94.c 2003-08-02 09:37:32.000000000 +1000 +++ ppc/drivers/scsi/mac53c94.c 2003-08-23 15:21:50.000000000 +1000 @@ -37,9 +37,9 @@ }; struct fsc_state { - volatile struct mac53c94_regs *regs; + struct mac53c94_regs *regs; int intr; - volatile struct dbdma_regs *dma; + struct dbdma_regs *dma; int dmaintr; int clk_freq; struct Scsi_Host *host; @@ -62,7 +62,6 @@ static irqreturn_t do_mac53c94_interrupt(int, void *, struct pt_regs *); static void cmd_done(struct fsc_state *, int result); static void set_dma_cmds(struct fsc_state *, Scsi_Cmnd *); -static int data_goes_out(Scsi_Cmnd *); int mac53c94_detect(Scsi_Host_Template *tp) @@ -113,10 +112,10 @@ state->host = host; state->pdev = pdev; - state->regs = (volatile struct mac53c94_regs *) + state->regs = (struct mac53c94_regs *) ioremap(node->addrs[0].address, 0x1000); state->intr = node->intrs[0].line; - state->dma = (volatile struct dbdma_regs *) + state->dma = (struct dbdma_regs *) ioremap(node->addrs[1].address, 0x1000); state->dmaintr = node->intrs[1].line; if (state->regs == NULL || state->dma == NULL) { @@ -196,7 +195,7 @@ struct fsc_state *state; #if 0 - if (data_goes_out(cmd)) { + if (cmd->sc_data_direction == SCSI_DATA_WRITE) { int i; printk(KERN_DEBUG "mac53c94_queue %p: command is", cmd); for (i = 0; i < cmd->cmd_len; ++i) @@ -233,39 +232,35 @@ mac53c94_host_reset(Scsi_Cmnd *cmd) { struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata; - volatile struct mac53c94_regs *regs = state->regs; - volatile struct dbdma_regs *dma = state->dma; + struct mac53c94_regs *regs = state->regs; + struct dbdma_regs *dma = state->dma; st_le32(&dma->control, (RUN|PAUSE|FLUSH|WAKE) << 16); - regs->command = CMD_SCSI_RESET; /* assert RST */ - eieio(); + writeb(CMD_SCSI_RESET, ®s->command); /* assert RST */ udelay(100); /* leave it on for a while (>= 25us) */ - regs->command = CMD_RESET; - eieio(); + writeb(CMD_RESET, ®s->command); udelay(20); mac53c94_init(state); - regs->command = CMD_NOP; - eieio(); + writeb(CMD_NOP, ®s->command); return SUCCESS; } static void mac53c94_init(struct fsc_state *state) { - volatile struct mac53c94_regs *regs = state->regs; - volatile struct dbdma_regs *dma = state->dma; + struct mac53c94_regs *regs = state->regs; + struct dbdma_regs *dma = state->dma; int x; - regs->config1 = state->host->this_id | CF1_PAR_ENABLE; - regs->sel_timeout = TIMO_VAL(250); /* 250ms */ - regs->clk_factor = CLKF_VAL(state->clk_freq); - regs->config2 = CF2_FEATURE_EN; - regs->config3 = 0; - regs->sync_period = 0; - regs->sync_offset = 0; - eieio(); - x = regs->interrupt; - st_le32(&dma->control, (RUN|PAUSE|FLUSH|WAKE) << 16); + writeb(state->host->this_id | CF1_PAR_ENABLE, ®s->config1); + writeb(TIMO_VAL(250), ®s->sel_timeout); /* 250ms */ + writeb(CLKF_VAL(state->clk_freq), ®s->clk_factor); + writeb(CF2_FEATURE_EN, ®s->config2); + writeb(0, ®s->config3); + writeb(0, ®s->sync_period); + writeb(0, ®s->sync_offset); + x = readb(®s->interrupt); + writel((RUN|PAUSE|FLUSH|WAKE) << 16, &dma->control); } /* @@ -276,7 +271,7 @@ mac53c94_start(struct fsc_state *state) { Scsi_Cmnd *cmd; - volatile struct mac53c94_regs *regs = state->regs; + struct mac53c94_regs *regs = state->regs; int i; if (state->phase != idle || state->current_req != NULL) @@ -287,29 +282,23 @@ state->request_q = (Scsi_Cmnd *) cmd->host_scribble; /* Off we go */ - regs->count_lo = 0; - regs->count_mid = 0; - regs->count_hi = 0; - eieio(); - regs->command = CMD_NOP + CMD_DMA_MODE; + writeb(0, ®s->count_lo); + writeb(0, ®s->count_mid); + writeb(0, ®s->count_hi); + writeb(CMD_NOP + CMD_DMA_MODE, ®s->command); udelay(1); - eieio(); - regs->command = CMD_FLUSH; + writeb(CMD_FLUSH, ®s->command); udelay(1); - eieio(); - regs->dest_id = cmd->device->id; - regs->sync_period = 0; - regs->sync_offset = 0; - eieio(); + writeb(cmd->device->id, ®s->dest_id); + writeb(0, ®s->sync_period); + writeb(0, ®s->sync_offset); /* load the command into the FIFO */ - for (i = 0; i < cmd->cmd_len; ++i) { - regs->fifo = cmd->cmnd[i]; - eieio(); - } + for (i = 0; i < cmd->cmd_len; ++i) + writeb(cmd->cmnd[i], ®s->fifo); /* do select without ATN XXX */ - regs->command = CMD_SELECT; + writeb(CMD_SELECT, ®s->command); state->phase = selecting; if (cmd->use_sg > 0 || cmd->request_bufflen != 0) @@ -332,8 +321,8 @@ mac53c94_interrupt(int irq, void *dev_id, struct pt_regs *ptregs) { struct fsc_state *state = (struct fsc_state *) dev_id; - volatile struct mac53c94_regs *regs = state->regs; - volatile struct dbdma_regs *dma = state->dma; + struct mac53c94_regs *regs = state->regs; + struct dbdma_regs *dma = state->dma; Scsi_Cmnd *cmd = state->current_req; int nb, stat, seq, intr; static int mac53c94_errors; @@ -343,9 +332,9 @@ * Apparently, reading the interrupt register unlatches * the status and sequence step registers. */ - seq = regs->seqstep; - stat = regs->status; - intr = regs->interrupt; + seq = readb(®s->seqstep); + stat = readb(®s->status); + intr = readb(®s->interrupt); #if 0 printk(KERN_DEBUG "mac53c94_intr, intr=%x stat=%x seq=%x phase=%d\n", @@ -355,8 +344,8 @@ if (intr & INTR_RESET) { /* SCSI bus was reset */ printk(KERN_INFO "external SCSI bus reset detected\n"); - regs->command = CMD_NOP; - st_le32(&dma->control, RUN << 16); /* stop dma */ + writeb(CMD_NOP, ®s->command); + writel(RUN << 16, &dma->control); /* stop dma */ cmd_done(state, DID_RESET << 16); return; } @@ -373,8 +362,7 @@ intr, stat, seq, state->phase); #endif ++mac53c94_errors; - regs->command = CMD_NOP + CMD_DMA_MODE; - eieio(); + writeb(CMD_NOP + CMD_DMA_MODE, ®s->command); } if (cmd == 0) { printk(KERN_DEBUG "53c94: interrupt with no command active?\n"); @@ -402,7 +390,7 @@ cmd_done(state, DID_ERROR << 16); return; } - regs->command = CMD_NOP; + writeb(CMD_NOP, ®s->command); /* set DMA controller going if any data to transfer */ if ((stat & (STAT_MSG|STAT_CD)) == 0 && (cmd->use_sg > 0 || cmd->request_bufflen != 0)) { @@ -410,20 +398,17 @@ if (nb > 0xfff0) nb = 0xfff0; cmd->SCp.this_residual -= nb; - regs->count_lo = nb; - regs->count_mid = nb >> 8; - eieio(); - regs->command = CMD_DMA_MODE + CMD_NOP; - eieio(); - st_le32(&dma->cmdptr, virt_to_phys(state->dma_cmds)); - st_le32(&dma->control, (RUN << 16) | RUN); - eieio(); - regs->command = CMD_DMA_MODE + CMD_XFER_DATA; + writeb(nb, ®s->count_lo); + writeb(nb >> 8, ®s->count_mid); + writeb(CMD_DMA_MODE + CMD_NOP, ®s->command); + writel(virt_to_phys(state->dma_cmds), &dma->cmdptr); + writel((RUN << 16) | RUN, &dma->control); + writeb(CMD_DMA_MODE + CMD_XFER_DATA, ®s->command); state->phase = dataing; break; } else if ((stat & STAT_PHASE) == STAT_CD + STAT_IO) { /* up to status phase already */ - regs->command = CMD_I_COMPLETE; + writeb(CMD_I_COMPLETE, ®s->command); state->phase = completing; } else { printk(KERN_DEBUG "in unexpected phase %x after cmd\n", @@ -446,18 +431,16 @@ if (nb > 0xfff0) nb = 0xfff0; cmd->SCp.this_residual -= nb; - regs->count_lo = nb; - regs->count_mid = nb >> 8; - eieio(); - regs->command = CMD_DMA_MODE + CMD_NOP; - eieio(); - regs->command = CMD_DMA_MODE + CMD_XFER_DATA; + writeb(nb, ®s->count_lo); + writeb(nb >> 8, ®s->count_mid); + writeb(CMD_DMA_MODE + CMD_NOP, ®s->command); + writeb(CMD_DMA_MODE + CMD_XFER_DATA, ®s->command); break; } if ((stat & STAT_PHASE) != STAT_CD + STAT_IO) { printk(KERN_DEBUG "intr %x before data xfer complete\n", intr); } - out_le32(&dma->control, RUN << 16); /* stop dma */ + writel(RUN << 16, &dma->control); /* stop dma */ dma_dir = scsi_to_pci_dma_dir(cmd->sc_data_direction); if (cmd->use_sg != 0) { pci_unmap_sg(state->pdev, @@ -468,7 +451,7 @@ cmd->request_bufflen, dma_dir); } /* should check dma status */ - regs->command = CMD_I_COMPLETE; + writeb(CMD_I_COMPLETE, ®s->command); state->phase = completing; break; case completing: @@ -477,10 +460,10 @@ cmd_done(state, DID_ERROR << 16); return; } - cmd->SCp.Status = regs->fifo; eieio(); - cmd->SCp.Message = regs->fifo; eieio(); - cmd->result = - regs->command = CMD_ACCEPT_MSG; + cmd->SCp.Status = readb(®s->fifo); + cmd->SCp.Message = readb(®s->fifo); + cmd->result = CMD_ACCEPT_MSG; + writeb(CMD_ACCEPT_MSG, ®s->command); state->phase = busfreeing; break; case busfreeing: @@ -523,7 +506,8 @@ u32 dma_len; int dma_dir = scsi_to_pci_dma_dir(cmd->sc_data_direction); - dma_cmd = data_goes_out(cmd)? OUTPUT_MORE: INPUT_MORE; + dma_cmd = cmd->sc_data_direction == SCSI_DATA_WRITE? OUTPUT_MORE: + INPUT_MORE; dcmds = state->dma_cmds; if (cmd->use_sg > 0) { int nseg; @@ -562,58 +546,6 @@ cmd->SCp.this_residual = total; } -/* - * Work out whether data will be going out from the host adaptor or into it. - */ -static int -data_goes_out(Scsi_Cmnd *cmd) -{ - switch (cmd->sc_data_direction) { - case SCSI_DATA_WRITE: - return 1; - case SCSI_DATA_READ: - return 0; - } - - /* for SCSI_DATA_UNKNOWN or SCSI_DATA_NONE, fall back on the - old method for now... */ - switch (cmd->cmnd[0]) { - case CHANGE_DEFINITION: - case COMPARE: - case COPY: - case COPY_VERIFY: - case FORMAT_UNIT: - case LOG_SELECT: - case MEDIUM_SCAN: - case MODE_SELECT: - case MODE_SELECT_10: - case REASSIGN_BLOCKS: - case RESERVE: - case SEARCH_EQUAL: - case SEARCH_EQUAL_12: - case SEARCH_HIGH: - case SEARCH_HIGH_12: - case SEARCH_LOW: - case SEARCH_LOW_12: - case SEND_DIAGNOSTIC: - case SEND_VOLUME_TAG: - case SET_WINDOW: - case UPDATE_BLOCK: - case WRITE_BUFFER: - case WRITE_6: - case WRITE_10: - case WRITE_12: - case WRITE_LONG: - case WRITE_LONG_2: /* alternate code for WRITE_LONG */ - case WRITE_SAME: - case WRITE_VERIFY: - case WRITE_VERIFY_12: - return 1; - default: - return 0; - } -} - static Scsi_Host_Template driver_template = { .proc_name = "53c94", .name = "53C94", @@ -630,3 +562,7 @@ }; #include "scsi_module.c" + +MODULE_DESCRIPTION(""); +MODULE_AUTHOR("Paul Mackerras "); +MODULE_LICENSE("GPL"); diff -urN linux-2.5/drivers/scsi/mesh.c ppc/drivers/scsi/mesh.c --- linux-2.5/drivers/scsi/mesh.c 2003-07-18 08:18:31.000000000 +1000 +++ ppc/drivers/scsi/mesh.c 2003-08-23 15:21:54.000000000 +1000 @@ -218,7 +218,6 @@ static void mesh_completed(struct mesh_state *, Scsi_Cmnd *); static void set_dma_cmds(struct mesh_state *, Scsi_Cmnd *); static void halt_dma(struct mesh_state *); -static int data_goes_out(Scsi_Cmnd *); static void do_abort(struct mesh_state *ms); static void set_mesh_power(struct mesh_state *ms, int state); @@ -682,7 +681,7 @@ id = cmd->device->id; ms->current_req = cmd; - ms->tgts[id].data_goes_out = data_goes_out(cmd); + ms->tgts[id].data_goes_out = cmd->sc_data_direction == SCSI_DATA_WRITE; ms->tgts[id].current_req = cmd; #if 1 @@ -1899,58 +1898,6 @@ ms->dma_started = 0; } -/* - * Work out whether we expect data to go out from the host adaptor or into it. - */ -static int -data_goes_out(Scsi_Cmnd *cmd) -{ - switch (cmd->sc_data_direction) { - case SCSI_DATA_WRITE: - return 1; - case SCSI_DATA_READ: - return 0; - } - - /* for SCSI_DATA_UNKNOWN or SCSI_DATA_NONE, fall back on the - old method for now... */ - switch (cmd->cmnd[0]) { - case CHANGE_DEFINITION: - case COMPARE: - case COPY: - case COPY_VERIFY: - case FORMAT_UNIT: - case LOG_SELECT: - case MEDIUM_SCAN: - case MODE_SELECT: - case MODE_SELECT_10: - case REASSIGN_BLOCKS: - case RESERVE: - case SEARCH_EQUAL: - case SEARCH_EQUAL_12: - case SEARCH_HIGH: - case SEARCH_HIGH_12: - case SEARCH_LOW: - case SEARCH_LOW_12: - case SEND_DIAGNOSTIC: - case SEND_VOLUME_TAG: - case SET_WINDOW: - case UPDATE_BLOCK: - case WRITE_BUFFER: - case WRITE_6: - case WRITE_10: - case WRITE_12: - case WRITE_LONG: - case WRITE_LONG_2: /* alternate code for WRITE_LONG */ - case WRITE_SAME: - case WRITE_VERIFY: - case WRITE_VERIFY_12: - return 1; - default: - return 0; - } -} - #ifdef MESH_DBG static inline u32 readtb(void) { diff -urN linux-2.5/drivers/video/controlfb.c ppc/drivers/video/controlfb.c --- linux-2.5/drivers/video/controlfb.c 2003-04-25 21:40:55.000000000 +1000 +++ ppc/drivers/video/controlfb.c 2003-08-23 14:51:40.000000000 +1000 @@ -475,7 +475,7 @@ /* Apply default var */ var.activate = FB_ACTIVATE_NOW; - rc = fb_set_var(&var, &p->info); + rc = fb_set_var(&p->info, &var); if (rc && (vmode != VMODE_640_480_60 || cmode != CMODE_8)) goto try_again; diff -urN linux-2.5/drivers/video/matrox/matroxfb_base.h ppc/drivers/video/matrox/matroxfb_base.h --- linux-2.5/drivers/video/matrox/matroxfb_base.h 2003-08-09 09:33:06.000000000 +1000 +++ ppc/drivers/video/matrox/matroxfb_base.h 2003-08-23 12:02:19.000000000 +1000 @@ -55,7 +55,7 @@ #if defined(CONFIG_PPC_PMAC) #include #include -#include