Update of /cvsroot/linuxconsole/ruby/linux/arch/ppc/kernel In directory usw-pr-cvs1:/tmp/cvs-serv14110/linux/arch/ppc/kernel Added Files: m8260_setup.c m8xx_setup.c ppc4xx_setup.c ppc_ksyms.c Removed Files: apus_setup.c chrp_setup.c pmac_setup.c prep_setup.c Log Message: synced to 2.5.5 --- NEW FILE: m8260_setup.c --- /* * BK Id: %F% %I% %G% %U% %#% */ /* * linux/arch/ppc/kernel/setup.c * * Copyright (C) 1995 Linus Torvalds * Adapted from 'alpha' version by Gary Thomas * Modified by Cort Dougan (co...@cs...) * Modified for MBX using prep/chrp/pmac functions by Dan (dm...@jl...) * Further modified for generic 8xx and 8260 by Dan. */ /* * bootup setup stuff.. */ #include <linux/config.h> #include <linux/errno.h> #include <linux/sched.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/stddef.h> #include <linux/unistd.h> #include <linux/ptrace.h> #include <linux/slab.h> #include <linux/user.h> #include <linux/a.out.h> #include <linux/tty.h> #include <linux/major.h> #include <linux/interrupt.h> #include <linux/reboot.h> #include <linux/init.h> #include <linux/blk.h> #include <linux/ioport.h> #include <linux/ide.h> #include <linux/seq_file.h> #include <asm/mmu.h> #include <asm/processor.h> #include <asm/residual.h> #include <asm/io.h> #include <asm/pgtable.h> #include <asm/ide.h> #include <asm/mpc8260.h> #include <asm/immap_8260.h> #include <asm/machdep.h> #include <asm/bootinfo.h> #include <asm/time.h> #include "ppc8260_pic.h" static int m8260_set_rtc_time(unsigned long time); static unsigned long m8260_get_rtc_time(void); static void m8260_calibrate_decr(void); unsigned char __res[sizeof(bd_t)]; extern void m8260_cpm_reset(void); static void __init m8260_setup_arch(void) { /* Reset the Communication Processor Module. */ m8260_cpm_reset(); } static void abort(void) { #ifdef CONFIG_XMON extern void xmon(void *); xmon(0); #endif machine_restart(NULL); } /* The decrementer counts at the system (internal) clock frequency * divided by four. */ static void __init m8260_calibrate_decr(void) { bd_t *binfo = (bd_t *)__res; int freq, divisor; freq = binfo->bi_busfreq; divisor = 4; tb_ticks_per_jiffy = freq / HZ / divisor; tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000); } /* The 8260 has an internal 1-second timer update register that * we should use for this purpose. */ static uint rtc_time; static static int m8260_set_rtc_time(unsigned long time) { #ifdef CONFIG_TQM8260 ((immap_t *)IMAP_ADDR)->im_sit.sit_tmcnt = time; ((immap_t *)IMAP_ADDR)->im_sit.sit_tmcntsc = 0x3; #else rtc_time = time; #endif return(0); } static unsigned long m8260_get_rtc_time(void) { #ifdef CONFIG_TQM8260 return ((immap_t *)IMAP_ADDR)->im_sit.sit_tmcnt; #else /* Get time from the RTC. */ return((unsigned long)rtc_time); #endif } static void m8260_restart(char *cmd) { extern void m8260_gorom(bd_t *bi, uint addr); uint startaddr; /* Most boot roms have a warmstart as the second instruction * of the reset vector. If that doesn't work for you, change this * or the reboot program to send a proper address. */ #ifdef CONFIG_TQM8260 startaddr = 0x40000104; #else startaddr = 0xff000104; #endif if (cmd != NULL) { if (!strncmp(cmd, "startaddr=", 10)) startaddr = simple_strtoul(&cmd[10], NULL, 0); } m8260_gorom((unsigned int)__pa(__res), startaddr); } static void m8260_power_off(void) { m8260_restart(NULL); } static void m8260_halt(void) { m8260_restart(NULL); } static int m8260_show_percpuinfo(struct seq_file *m, int i) { bd_t *bp; bp = (bd_t *)__res; seq_printf(m, "core clock\t: %d MHz\n" "CPM clock\t: %d MHz\n" "bus clock\t: %d MHz\n", bp->bi_intfreq / 1000000, bp->bi_cpmfreq / 1000000, bp->bi_busfreq / 1000000); return 0; } /* Initialize the internal interrupt controller. The number of * interrupts supported can vary with the processor type, and the * 8260 family can have up to 64. * External interrupts can be either edge or level triggered, and * need to be initialized by the appropriate driver. */ static void __init m8260_init_IRQ(void) { int i; void cpm_interrupt_init(void); #if 0 ppc8260_pic.irq_offset = 0; #endif for ( i = 0 ; i < NR_SIU_INTS ; i++ ) irq_desc[i].handler = &ppc8260_pic; /* Initialize the default interrupt mapping priorities, * in case the boot rom changed something on us. */ immr->im_intctl.ic_sicr = 0; immr->im_intctl.ic_siprr = 0x05309770; immr->im_intctl.ic_scprrh = 0x05309770; immr->im_intctl.ic_scprrl = 0x05309770; } /* * Same hack as 8xx */ static unsigned long __init m8260_find_end_of_memory(void) { bd_t *binfo; extern unsigned char __res[]; binfo = (bd_t *)__res; return binfo->bi_memsize; } /* Map the IMMR, plus anything else we can cover * in that upper space according to the memory controller * chip select mapping. Grab another bunch of space * below that for stuff we can't cover in the upper. */ static void __init m8260_map_io(void) { io_block_mapping(0xf0000000, 0xf0000000, 0x10000000, _PAGE_IO); io_block_mapping(0xe0000000, 0xe0000000, 0x10000000, _PAGE_IO); } void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7) { parse_bootinfo(find_bootinfo()); if ( r3 ) memcpy( (void *)__res,(void *)(r3+KERNELBASE), sizeof(bd_t) ); #ifdef CONFIG_BLK_DEV_INITRD /* take care of initrd if we have one */ if ( r4 ) { initrd_start = r4 + KERNELBASE; initrd_end = r5 + KERNELBASE; } #endif /* CONFIG_BLK_DEV_INITRD */ /* take care of cmd line */ if ( r6 ) { *(char *)(r7+KERNELBASE) = 0; strcpy(cmd_line, (char *)(r6+KERNELBASE)); } ppc_md.setup_arch = m8260_setup_arch; ppc_md.show_percpuinfo = m8260_show_percpuinfo; ppc_md.irq_cannonicalize = NULL; ppc_md.init_IRQ = m8260_init_IRQ; ppc_md.get_irq = m8260_get_irq; ppc_md.init = NULL; ppc_md.restart = m8260_restart; ppc_md.power_off = m8260_power_off; ppc_md.halt = m8260_halt; ppc_md.time_init = NULL; ppc_md.set_rtc_time = m8260_set_rtc_time; ppc_md.get_rtc_time = m8260_get_rtc_time; ppc_md.calibrate_decr = m8260_calibrate_decr; ppc_md.find_end_of_memory = m8260_find_end_of_memory; ppc_md.setup_io_mappings = m8260_map_io; ppc_md.kbd_setkeycode = NULL; ppc_md.kbd_getkeycode = NULL; ppc_md.kbd_translate = NULL; ppc_md.kbd_unexpected_up = NULL; ppc_md.kbd_leds = NULL; ppc_md.kbd_init_hw = NULL; ppc_md.ppc_kbd_sysrq_xlate = NULL; } /* Mainly for ksyms. */ int request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flag, const char *naem, void *dev) { panic("request IRQ\n"); } --- NEW FILE: m8xx_setup.c --- /* * BK Id: %F% %I% %G% %U% %#% * * linux/arch/ppc/kernel/setup.c * * Copyright (C) 1995 Linus Torvalds * Adapted from 'alpha' version by Gary Thomas * Modified by Cort Dougan (co...@cs...) * Modified for MBX using prep/chrp/pmac functions by Dan (dm...@jl...) * Further modified for generic 8xx by Dan. */ /* * bootup setup stuff.. */ #include <linux/config.h> #include <linux/errno.h> #include <linux/sched.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/stddef.h> #include <linux/unistd.h> #include <linux/ptrace.h> #include <linux/slab.h> #include <linux/user.h> #include <linux/a.out.h> #include <linux/tty.h> #include <linux/major.h> #include <linux/interrupt.h> #include <linux/reboot.h> #include <linux/init.h> #include <linux/blk.h> #include <linux/ioport.h> #include <linux/bootmem.h> #include <linux/seq_file.h> #include <asm/mmu.h> #include <asm/processor.h> #include <asm/residual.h> #include <asm/io.h> #include <asm/pgtable.h> #include <asm/mpc8xx.h> #include <asm/8xx_immap.h> #include <asm/machdep.h> #include <asm/bootinfo.h> #include <asm/time.h> #include "ppc8xx_pic.h" static int m8xx_set_rtc_time(unsigned long time); static unsigned long m8xx_get_rtc_time(void); void m8xx_calibrate_decr(void); unsigned char __res[sizeof(bd_t)]; extern void m8xx_ide_init(void); extern unsigned long find_available_memory(void); extern void m8xx_cpm_reset(uint); extern void rpxfb_alloc_pages(void); void __init m8xx_setup_arch(void) { int cpm_page; cpm_page = (int) alloc_bootmem_pages(PAGE_SIZE); /* Reset the Communication Processor Module. */ m8xx_cpm_reset(cpm_page); #ifdef CONFIG_FB_RPX rpxfb_alloc_pages(); #endif #ifdef notdef ROOT_DEV = to_kdev_t(0x0301); /* hda1 */ #endif #ifdef CONFIG_BLK_DEV_INITRD #if 0 ROOT_DEV = to_kdev_t(0x0200); /* floppy */ rd_prompt = 1; rd_doload = 1; rd_image_start = 0; #endif #if 0 /* XXX this may need to be updated for the new bootmem stuff, or possibly just deleted (see set_phys_avail() in init.c). - paulus. */ /* initrd_start and size are setup by boot/head.S and kernel/head.S */ if ( initrd_start ) { if (initrd_end > *memory_end_p) { printk("initrd extends beyond end of memory " "(0x%08lx > 0x%08lx)\ndisabling initrd\n", initrd_end,*memory_end_p); initrd_start = 0; } } #endif #endif } void abort(void) { #ifdef CONFIG_XMON xmon(0); #endif machine_restart(NULL); /* not reached */ for (;;); } /* A place holder for time base interrupts, if they are ever enabled. */ void timebase_interrupt(int irq, void * dev, struct pt_regs * regs) { printk ("timebase_interrupt()\n"); } /* The decrementer counts at the system (internal) clock frequency divided by * sixteen, or external oscillator divided by four. We force the processor * to use system clock divided by sixteen. */ void __init m8xx_calibrate_decr(void) { bd_t *binfo = (bd_t *)__res; int freq, fp, divisor; /* Unlock the SCCR. */ ((volatile immap_t *)IMAP_ADDR)->im_clkrstk.cark_sccrk = ~KAPWR_KEY; ((volatile immap_t *)IMAP_ADDR)->im_clkrstk.cark_sccrk = KAPWR_KEY; /* Force all 8xx processors to use divide by 16 processor clock. */ ((volatile immap_t *)IMAP_ADDR)->im_clkrst.car_sccr |= 0x02000000; /* Processor frequency is MHz. * The value 'fp' is the number of decrementer ticks per second. */ fp = binfo->bi_intfreq / 16; freq = fp*60; /* try to make freq/1e6 an integer */ divisor = 60; printk("Decrementer Frequency = %d/%d\n", freq, divisor); tb_ticks_per_jiffy = freq / HZ / divisor; tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000); /* Perform some more timer/timebase initialization. This used * to be done elsewhere, but other changes caused it to get * called more than once....that is a bad thing. * * First, unlock all of the registers we are going to modify. * To protect them from corruption during power down, registers * that are maintained by keep alive power are "locked". To * modify these registers we have to write the key value to * the key location associated with the register. * Some boards power up with these unlocked, while others * are locked. Writing anything (including the unlock code?) * to the unlocked registers will lock them again. So, here * we guarantee the registers are locked, then we unlock them * for our use. */ ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_tbscrk = ~KAPWR_KEY; ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_rtcsck = ~KAPWR_KEY; ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_tbk = ~KAPWR_KEY; ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_tbscrk = KAPWR_KEY; ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_rtcsck = KAPWR_KEY; ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_tbk = KAPWR_KEY; /* Disable the RTC one second and alarm interrupts. */ ((volatile immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc &= ~(RTCSC_SIE | RTCSC_ALE); /* Enable the RTC */ ((volatile immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc |= (RTCSC_RTF | RTCSC_RTE); /* Enabling the decrementer also enables the timebase interrupts * (or from the other point of view, to get decrementer interrupts * we have to enable the timebase). The decrementer interrupt * is wired into the vector table, nothing to do here for that. */ ((volatile immap_t *)IMAP_ADDR)->im_sit.sit_tbscr = ((mk_int_int_mask(DEC_INTERRUPT) << 8) | (TBSCR_TBF | TBSCR_TBE)); if (request_8xxirq(DEC_INTERRUPT, timebase_interrupt, 0, "tbint", NULL) != 0) panic("Could not allocate timer IRQ!"); } /* The RTC on the MPC8xx is an internal register. * We want to protect this during power down, so we need to unlock, * modify, and re-lock. */ static int m8xx_set_rtc_time(unsigned long time) { ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_rtck = KAPWR_KEY; ((volatile immap_t *)IMAP_ADDR)->im_sit.sit_rtc = time; ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_rtck = ~KAPWR_KEY; return(0); } static unsigned long m8xx_get_rtc_time(void) { /* Get time from the RTC. */ return((unsigned long)(((immap_t *)IMAP_ADDR)->im_sit.sit_rtc)); } static void m8xx_restart(char *cmd) { __volatile__ unsigned char dummy; uint msr; cli(); ((immap_t *)IMAP_ADDR)->im_clkrst.car_plprcr |= 0x00000080; /* Clear the ME bit in MSR to cause checkstop on machine check */ __asm__("mfmsr %0" : "=r" (msr) ); msr &= ~0x1000; __asm__("mtmsr %0" : : "r" (msr) ); dummy = ((immap_t *)IMAP_ADDR)->im_clkrst.res[0]; printk("Restart failed\n"); while(1); } static void m8xx_power_off(void) { m8xx_restart(NULL); } static void m8xx_halt(void) { m8xx_restart(NULL); } static int m8xx_show_percpuinfo(struct seq_file *m, int i) { bd_t *bp; bp = (bd_t *)__res; seq_printf(m, "clock\t\t: %dMHz\n" "bus clock\t: %dMHz\n", bp->bi_intfreq / 1000000, bp->bi_busfreq / 1000000); return 0; } /* Initialize the internal interrupt controller. The number of * interrupts supported can vary with the processor type, and the * 82xx family can have up to 64. * External interrupts can be either edge or level triggered, and * need to be initialized by the appropriate driver. */ static void __init m8xx_init_IRQ(void) { int i; void cpm_interrupt_init(void); for ( i = 0 ; i < NR_SIU_INTS ; i++ ) irq_desc[i].handler = &ppc8xx_pic; /* We could probably incorporate the CPM into the multilevel * interrupt structure. */ cpm_interrupt_init(); unmask_irq(CPM_INTERRUPT); #if defined(CONFIG_PCI) for ( i = NR_SIU_INTS ; i < (NR_SIU_INTS + NR_8259_INTS) ; i++ ) irq_desc[i].handler = &i8259_pic; i8259_pic.irq_offset = NR_SIU_INTS; i8259_init(); request_8xxirq(ISA_BRIDGE_INT, mbx_i8259_action, 0, "8259 cascade", NULL); enable_irq(ISA_BRIDGE_INT); #endif } /* -------------------------------------------------------------------- */ /* * This is a big hack right now, but it may turn into something real * someday. * * For the 8xx boards (at this time anyway), there is nothing to initialize * associated the PROM. Rather than include all of the prom.c * functions in the image just to get prom_init, all we really need right * now is the initialization of the physical memory region. */ static unsigned long __init m8xx_find_end_of_memory(void) { bd_t *binfo; extern unsigned char __res[]; binfo = (bd_t *)__res; return binfo->bi_memsize; } /* * Now map in some of the I/O space that is generically needed * or shared with multiple devices. * All of this fits into the same 4Mbyte region, so it only * requires one page table page. (or at least it used to -- paulus) */ static void __init m8xx_map_io(void) { io_block_mapping(IMAP_ADDR, IMAP_ADDR, IMAP_SIZE, _PAGE_IO); #ifdef CONFIG_MBX io_block_mapping(NVRAM_ADDR, NVRAM_ADDR, NVRAM_SIZE, _PAGE_IO); io_block_mapping(MBX_CSR_ADDR, MBX_CSR_ADDR, MBX_CSR_SIZE, _PAGE_IO); io_block_mapping(PCI_CSR_ADDR, PCI_CSR_ADDR, PCI_CSR_SIZE, _PAGE_IO); /* Map some of the PCI/ISA I/O space to get the IDE interface. */ io_block_mapping(PCI_ISA_IO_ADDR, PCI_ISA_IO_ADDR, 0x4000, _PAGE_IO); io_block_mapping(PCI_IDE_ADDR, PCI_IDE_ADDR, 0x4000, _PAGE_IO); #endif #if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC) io_block_mapping(RPX_CSR_ADDR, RPX_CSR_ADDR, RPX_CSR_SIZE, _PAGE_IO); #if !defined(CONFIG_PCI) io_block_mapping(_IO_BASE,_IO_BASE,_IO_BASE_SIZE, _PAGE_IO); #endif #endif #ifdef CONFIG_HTDMSOUND io_block_mapping(HIOX_CSR_ADDR, HIOX_CSR_ADDR, HIOX_CSR_SIZE, _PAGE_IO); #endif #ifdef CONFIG_FADS io_block_mapping(BCSR_ADDR, BCSR_ADDR, BCSR_SIZE, _PAGE_IO); #endif #ifdef CONFIG_PCI io_block_mapping(PCI_CSR_ADDR, PCI_CSR_ADDR, PCI_CSR_SIZE, _PAGE_IO); #endif } void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7) { parse_bootinfo(find_bootinfo()); if ( r3 ) memcpy( (void *)__res,(void *)(r3+KERNELBASE), sizeof(bd_t) ); #ifdef CONFIG_PCI m8xx_setup_pci_ptrs(); #endif #ifdef CONFIG_BLK_DEV_INITRD /* take care of initrd if we have one */ if ( r4 ) { initrd_start = r4 + KERNELBASE; initrd_end = r5 + KERNELBASE; } #endif /* CONFIG_BLK_DEV_INITRD */ /* take care of cmd line */ if ( r6 ) { *(char *)(r7+KERNELBASE) = 0; strcpy(cmd_line, (char *)(r6+KERNELBASE)); } ppc_md.setup_arch = m8xx_setup_arch; ppc_md.show_percpuinfo = m8xx_show_percpuinfo; ppc_md.irq_cannonicalize = NULL; ppc_md.init_IRQ = m8xx_init_IRQ; ppc_md.get_irq = m8xx_get_irq; ppc_md.init = NULL; ppc_md.restart = m8xx_restart; ppc_md.power_off = m8xx_power_off; ppc_md.halt = m8xx_halt; ppc_md.time_init = NULL; ppc_md.set_rtc_time = m8xx_set_rtc_time; ppc_md.get_rtc_time = m8xx_get_rtc_time; ppc_md.calibrate_decr = m8xx_calibrate_decr; ppc_md.find_end_of_memory = m8xx_find_end_of_memory; ppc_md.setup_io_mappings = m8xx_map_io; ppc_md.kbd_setkeycode = NULL; ppc_md.kbd_getkeycode = NULL; ppc_md.kbd_translate = NULL; ppc_md.kbd_unexpected_up = NULL; ppc_md.kbd_leds = NULL; ppc_md.kbd_init_hw = NULL; ppc_md.ppc_kbd_sysrq_xlate = NULL; #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) m8xx_ide_init(); #endif } --- NEW FILE: ppc4xx_setup.c --- /* * * Copyright (c) 1999-2000 Grant Erickson <gr...@lc...> * * Copyright 2000-2001 MontaVista Software Inc. * Completed implementation. * Author: MontaVista Software, Inc. <so...@mv...> * Frank Rowand <fra...@mv...> * Debbie Chu <deb...@mv...> * * Module name: ppc4xx_setup.c * * Description: * Architecture- / platform-specific boot-time initialization code for * IBM PowerPC 4xx based boards. Adapted from original * code by Gary Thomas, Cort Dougan <co...@fs...>, and Dan Malek * <da...@ne...>. * * History: 11/09/2001 - armin * rename board_setup_nvram_access to board_init. board_init is * used for all other board specific instructions needed during * platform_init. * moved RTC to board.c files * moved VT/FB to board.c files * moved r/w4 ide to redwood.c * */ #include <linux/config.h> #include <linux/init.h> #include <linux/smp.h> #include <linux/threads.h> #include <linux/spinlock.h> #include <linux/irq.h> #include <linux/reboot.h> #include <linux/param.h> #include <linux/string.h> #include <linux/blk.h> #include <linux/pci.h> #include <linux/rtc.h> #include <linux/console.h> #include <linux/ide.h> #include <linux/serial_reg.h> #include <linux/seq_file.h> #include <asm/system.h> #include <asm/processor.h> #include <asm/machdep.h> #include <asm/page.h> #include <asm/kgdb.h> #include <asm/ibm4xx.h> #include <asm/time.h> #include <asm/todc.h> #include <asm/ppc4xx_pic.h> #include <asm/pci-bridge.h> #include <asm/bootinfo.h> /* Function Prototypes */ extern void abort(void); extern void ppc4xx_find_bridges(void); extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pckbd_getkeycode(unsigned int scancode); extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, char raw_mode); extern char pckbd_unexpected_up(unsigned char keycode); extern void pckbd_leds(unsigned char leds); extern void pckbd_init_hw(void); extern int nonpci_ide_default_irq(ide_ioreg_t base); extern void nonpci_ide_init_hwif_ports(hw_regs_t * hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq); extern void ppc4xx_wdt_heartbeat(void); extern int wdt_enable; extern unsigned long wdt_period; /* Board specific functions */ extern void board_setup_arch(void); extern void board_io_mapping(void); extern void board_setup_irq(void); extern void board_init(void); /* Global Variables */ unsigned char __res[sizeof (bd_t)]; static void __init ppc4xx_setup_arch(void) { /* Setup PCI host bridges */ #ifdef CONFIG_PCI ppc4xx_find_bridges(); #endif #if defined(CONFIG_FB) conswitchp = &dummy_con; #endif board_setup_arch(); } /* * This routine pretty-prints the platform's internal CPU clock * frequencies into the buffer for usage in /proc/cpuinfo. */ static int ppc4xx_show_percpuinfo(struct seq_file *m, int i) { bd_t *bip = (bd_t *) __res; seq_printf(m, "clock\t\t: %ldMHz\n", (long) bip->bi_intfreq / 1000000); return 0; } /* * This routine pretty-prints the platform's internal bus clock * frequencies into the buffer for usage in /proc/cpuinfo. */ static int ppc4xx_show_cpuinfo(struct seq_file *m) { bd_t *bip = (bd_t *) __res; seq_printf(m, "machine\t\t: %s\n", PPC4xx_MACHINE_NAME); seq_printf(m, "plb bus clock\t: %ldMHz\n", (long) bip->bi_busfreq / 1000000); #ifdef CONFIG_PCI seq_printf(m, "pci bus clock\t: %dMHz\n", bip->bi_pci_busfreq / 1000000); #endif return 0; } /* * Return the virtual address representing the top of physical RAM. */ static unsigned long __init ppc4xx_find_end_of_memory(void) { bd_t *bip = (bd_t *) __res; return ((unsigned long) bip->bi_memsize); } static void __init m4xx_map_io(void) { io_block_mapping(PPC4xx_ONB_IO_VADDR, PPC4xx_ONB_IO_PADDR, PPC4xx_ONB_IO_SIZE, _PAGE_IO); #ifdef CONFIG_PCI io_block_mapping(PPC4xx_PCI_IO_VADDR, PPC4xx_PCI_IO_PADDR, PPC4xx_PCI_IO_SIZE, _PAGE_IO); io_block_mapping(PPC4xx_PCI_CFG_VADDR, PPC4xx_PCI_CFG_PADDR, PPC4xx_PCI_CFG_SIZE, _PAGE_IO); io_block_mapping(PPC4xx_PCI_LCFG_VADDR, PPC4xx_PCI_LCFG_PADDR, PPC4xx_PCI_LCFG_SIZE, _PAGE_IO); #endif board_io_mapping(); } static void __init ppc4xx_init_IRQ(void) { int i; ppc4xx_pic_init(); for (i = 0; i < NR_IRQS; i++) irq_desc[i].handler = ppc4xx_pic; /* give board specific code a chance to setup things */ board_setup_irq(); return; } static void ppc4xx_restart(char *cmd) { printk("%s\n", cmd); abort(); } static void ppc4xx_power_off(void) { printk("System Halted\n"); __cli(); while (1) ; } static void ppc4xx_halt(void) { printk("System Halted\n"); __cli(); while (1) ; } /* * This routine retrieves the internal processor frequency from the board * information structure, sets up the kernel timer decrementer based on * that value, enables the 4xx programmable interval timer (PIT) and sets * it up for auto-reload. */ static void __init ppc4xx_calibrate_decr(void) { unsigned int freq; bd_t *bip = (bd_t *) __res; #if defined(CONFIG_WALNUT) || defined(CONFIG_CEDER) /* Walnut boot rom sets DCR CHCR1 (aka CPC0_CR1) bit CETE to 1 */ mtdcr(DCRN_CHCR1, mfdcr(DCRN_CHCR1) & ~CHR1_CETE); #endif #ifdef CONFIG_REDWOOD_5 freq = bip->bi_tbfreq; #else freq = bip->bi_intfreq; #endif tb_ticks_per_jiffy = freq / HZ; tb_to_us = mulhwu_scale_factor(freq, 1000000); /* Set the time base to zero. ** At 200 Mhz, time base will rollover in ~2925 years. */ mtspr(SPRN_TBWL, 0); mtspr(SPRN_TBWU, 0); /* Clear any pending timer interrupts */ mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_PIS | TSR_FIS); mtspr(SPRN_TCR, TCR_PIE | TCR_ARE); /* Set the PIT reload value and just let it run. */ mtspr(SPRN_PIT, tb_ticks_per_jiffy); } #ifdef CONFIG_DEBUG_TEXT static void ppc4xx_progress(char *s, unsigned short hex) { printk("%s\n\r", s); } #endif /* * IDE stuff. * should be generic for every IDE PCI chipset */ #if defined(CONFIG_BLK_DEV_IDE) static int ppc4xx_ide_check_region(ide_ioreg_t from, unsigned int extent) { return check_region(from, extent); } static void ppc4xx_ide_request_region(ide_ioreg_t from, unsigned int extent, const char *name) { request_region(from, extent, name); return; } static void ppc4xx_ide_release_region(ide_ioreg_t from, unsigned int extent) { release_region(from, extent); return; } #endif #if defined(CONFIG_BLK_DEV_IDEPCI) static void ppc4xx_ide_init_hwif_ports(hw_regs_t * hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq) { int i; for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; ++i) hw->io_ports[i] = data_port + i - IDE_DATA_OFFSET; hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; } #endif TODC_ALLOC(); /* * Input(s): * r3 - Optional pointer to a board information structure. * r4 - Optional pointer to the physical starting address of the init RAM * disk. * r5 - Optional pointer to the physical ending address of the init RAM * disk. * r6 - Optional pointer to the physical starting address of any kernel * command-line parameters. * r7 - Optional pointer to the physical ending address of any kernel * command-line parameters. */ void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7) { parse_bootinfo(find_bootinfo()); /* * If we were passed in a board information, copy it into the * residual data area. */ if (r3) { memcpy((void *) __res, (void *) (r3 + KERNELBASE), sizeof (bd_t)); } #if defined(CONFIG_BLK_DEV_INITRD) /* * If the init RAM disk has been configured in, and there's a valid * starting address for it, set it up. */ if (r4) { initrd_start = r4 + KERNELBASE; initrd_end = r5 + KERNELBASE; } #endif /* CONFIG_BLK_DEV_INITRD */ /* Copy the kernel command line arguments to a safe place. */ if (r6) { *(char *) (r7 + KERNELBASE) = 0; strcpy(cmd_line, (char *) (r6 + KERNELBASE)); } #if defined(CONFIG_PPC405_WDT) /* Look for wdt= option on command line */ if (strstr(cmd_line, "wdt=")) { int valid_wdt = 0; char *p, *q; for (q = cmd_line; (p = strstr(q, "wdt=")) != 0;) { q = p + 4; if (p > cmd_line && p[-1] != ' ') continue; wdt_period = simple_strtoul(q, &q, 0); valid_wdt = 1; ++q; } wdt_enable = valid_wdt; } #endif /* Initialize machine-dependency vectors */ ppc_md.setup_arch = ppc4xx_setup_arch; ppc_md.show_percpuinfo = ppc4xx_show_percpuinfo; ppc_md.show_cpuinfo = ppc4xx_show_cpuinfo; ppc_md.init_IRQ = ppc4xx_init_IRQ; ppc_md.restart = ppc4xx_restart; ppc_md.power_off = ppc4xx_power_off; ppc_md.halt = ppc4xx_halt; ppc_md.calibrate_decr = ppc4xx_calibrate_decr; #ifdef CONFIG_PPC405_WDT ppc_md.heartbeat = ppc4xx_wdt_heartbeat; #endif ppc_md.heartbeat_count = 0; ppc_md.find_end_of_memory = ppc4xx_find_end_of_memory; ppc_md.setup_io_mappings = m4xx_map_io; #ifdef CONFIG_DEBUG_TEXT ppc_md.progress = ppc4xx_progress; #endif #if defined(CONFIG_VT) && defined(CONFIG_PC_KEYBOARD) #if defined(CONFIG_REDWOOD_4) && defined(CONFIG_STB_KB) redwood_irkb_init(); #else ppc_md.kbd_setkeycode = pckbd_setkeycode; ppc_md.kbd_getkeycode = pckbd_getkeycode; ppc_md.kbd_translate = pckbd_translate; ppc_md.kbd_unexpected_up = pckbd_unexpected_up; ppc_md.kbd_leds = pckbd_leds; ppc_md.kbd_init_hw = pckbd_init_hw; #endif #endif /* ** m8xx_setup.c, prep_setup.c use ** defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */ #if defined (CONFIG_IDE) ppc_ide_md.ide_request_region = ppc4xx_ide_request_region; ppc_ide_md.ide_release_region = ppc4xx_ide_release_region; ppc_ide_md.ide_check_region = ppc4xx_ide_check_region; #if defined(CONFIG_BLK_DEV_IDEPCI) ppc_ide_md.ide_init_hwif = ppc4xx_ide_init_hwif_ports; #elif defined (CONFIG_DMA_NONPCI) /* ON board IDE */ ppc_ide_md.default_irq = nonpci_ide_default_irq; ppc_ide_md.ide_init_hwif = nonpci_ide_init_hwif_ports; #endif #endif board_init(); return; } --- apus_setup.c DELETED --- --- chrp_setup.c DELETED --- --- pmac_setup.c DELETED --- --- prep_setup.c DELETED --- |