diff options
Diffstat (limited to 'arch/ppc/kernel/chrp_setup.c')
-rw-r--r-- | arch/ppc/kernel/chrp_setup.c | 105 |
1 files changed, 67 insertions, 38 deletions
diff --git a/arch/ppc/kernel/chrp_setup.c b/arch/ppc/kernel/chrp_setup.c index 1653ef0d7..7faa1ed4b 100644 --- a/arch/ppc/kernel/chrp_setup.c +++ b/arch/ppc/kernel/chrp_setup.c @@ -71,6 +71,8 @@ void chrp_calibrate_decr(void); void chrp_time_init(void); void chrp_setup_pci_ptrs(void); +extern void chrp_progress(char *, unsigned short); +void chrp_event_scan(void); extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pckbd_getkeycode(unsigned int scancode); @@ -189,20 +191,20 @@ chrp_get_cpuinfo(char *buffer) * for keyboard and mouse */ -__initfunc(static inline void sio_write(u8 val, u8 index)) +static inline void __init sio_write(u8 val, u8 index) { outb(index, 0x15c); outb(val, 0x15d); } -__initfunc(static inline u8 sio_read(u8 index)) +static inline u8 __init sio_read(u8 index) { outb(index, 0x15c); return inb(0x15d); } -__initfunc(static void sio_fixup_irq(const char *name, u8 device, u8 level, - u8 type)) +static void __init sio_fixup_irq(const char *name, u8 device, u8 level, + u8 type) { u8 level0, type0, active; @@ -224,7 +226,7 @@ __initfunc(static void sio_fixup_irq(const char *name, u8 device, u8 level, } -__initfunc(static void sio_init(void)) +static void __init sio_init(void) { /* logical device 0 (KBC/Keyboard) */ sio_fixup_irq("keyboard", 0, 1, 2); @@ -233,8 +235,8 @@ __initfunc(static void sio_init(void)) } -__initfunc(void - chrp_setup_arch(unsigned long * memory_start_p, unsigned long * memory_end_p)) +void __init + chrp_setup_arch(unsigned long * memory_start_p, unsigned long * memory_end_p) { extern char cmd_line[]; struct device_node *device; @@ -313,7 +315,10 @@ void chrp_event_scan(void) { unsigned char log[1024]; - call_rtas( "event-scan", 4, 1, NULL, 0x0, 1, __pa(log), 1024 ); + unsigned long ret = 0; + /* XXX: we should loop until the hardware says no more error logs -- Cort */ + call_rtas( "event-scan", 4, 1, &ret, 0xffffffff, 0, + __pa(log), 1024 ); ppc_md.heartbeat_count = ppc_md.heartbeat_reset; } @@ -329,12 +334,8 @@ void chrp_power_off(void) { /* allow power on only with power button press */ -#define PWR_FIELD(x) (0x8000000000000000ULL >> ((x)-96)) printk("RTAS power-off returned %d\n", - call_rtas("power-off", 2, 1, NULL, - ((PWR_FIELD(96)|PWR_FIELD(97))>>32)&0xffffffff, - (PWR_FIELD(96)|PWR_FIELD(97))&0xffffffff)); -#undef PWR_FIELD + call_rtas("power-off", 2, 1, NULL,0xffffffff,0xffffffff)); for (;;); } @@ -432,8 +433,8 @@ out: openpic_eoi(0); } -__initfunc(void - chrp_init_IRQ(void)) +void __init + chrp_init_IRQ(void) { struct device_node *np; int i; @@ -446,12 +447,9 @@ __initfunc(void (*(unsigned long *)get_property(np, "8259-interrupt-acknowledge", NULL)); } + open_pic.irq_offset = 16; for ( i = 16 ; i < NR_IRQS ; i++ ) irq_desc[i].ctl = &open_pic; - /* openpic knows that it's at irq 16 offset - * so we don't need to set it in the pic structure - * -- Cort - */ openpic_init(1); for ( i = 0 ; i < 16 ; i++ ) irq_desc[i].ctl = &i8259_pic; @@ -466,8 +464,8 @@ __initfunc(void #endif /* __SMP__ */ } -__initfunc(void - chrp_init2(void)) +void __init + chrp_init2(void) { adb_init(); @@ -491,12 +489,9 @@ void chrp_ide_probe(void) { chrp_ide_ports_known = 1; if(pdev) { - chrp_ide_regbase[0]=pdev->base_address[0] & - PCI_BASE_ADDRESS_IO_MASK; - chrp_ide_regbase[1]=pdev->base_address[2] & - PCI_BASE_ADDRESS_IO_MASK; - chrp_idedma_regbase=pdev->base_address[4] & - PCI_BASE_ADDRESS_IO_MASK; + chrp_ide_regbase[0]=pdev->resource[0].start; + chrp_ide_regbase[1]=pdev->resource[2].start; + chrp_idedma_regbase=pdev->resource[4].start; chrp_ide_irq=pdev->irq; } } @@ -582,17 +577,17 @@ EXPORT_SYMBOL(chrp_ide_probe); #endif -__initfunc(void +void __init chrp_init(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7)) + unsigned long r6, unsigned long r7) { chrp_setup_pci_ptrs(); #ifdef CONFIG_BLK_DEV_INITRD /* take care of initrd if we have one */ - if ( r3 ) + if ( r6 ) { - initrd_start = r3 + KERNELBASE; - initrd_end = r3 + r4 + KERNELBASE; + initrd_start = r6 + KERNELBASE; + initrd_end = r6 + r7 + KERNELBASE; } #endif /* CONFIG_BLK_DEV_INITRD */ @@ -658,6 +653,8 @@ __initfunc(void ppc_md.ppc_kbd_sysrq_xlate = pckbd_sysrq_xlate; SYSRQ_KEY = 0x54; #endif + if ( rtas_data ) + ppc_md.progress = chrp_progress; #endif #endif @@ -678,16 +675,48 @@ __initfunc(void * Print the banner, then scroll down so boot progress * can be printed. -- Cort */ - chrp_progress("Linux/PPC "UTS_RELEASE"\n"); + if ( ppc_md.progress ) ppc_md.progress("Linux/PPC "UTS_RELEASE"\n", 0x0); } -void chrp_progress(char *s) +void chrp_progress(char *s, unsigned short hex) { extern unsigned int rtas_data; - + int max_width, width; + struct device_node *root; + char *os = s; + unsigned long *p; + + if ( (root = find_path_device("/rtas")) && + (p = (unsigned long *)get_property(root, + "ibm,display-line-length", + NULL)) ) + max_width = *p; + else + max_width = 0x10; + if ( (_machine != _MACH_chrp) || !rtas_data ) return; - call_rtas( "display-character", 1, 1, NULL, '\r' ); - while ( *s ) - call_rtas( "display-character", 1, 1, NULL, *s++ ); + if ( call_rtas( "display-character", 1, 1, NULL, '\r' ) ) + { + /* assume no display-character RTAS method - use hex display */ + return; + } + + width = max_width; + while ( *os ) + { + if ( (*os == '\n') || (*os == '\r') ) + width = max_width; + else + width--; + call_rtas( "display-character", 1, 1, NULL, *os++ ); + /* if we overwrite the screen length */ + if ( width == 0 ) + while ( (*os != 0) && (*os != '\n') && (*os != '\r') ) + os++; + } + + /*while ( width-- > 0 )*/ + call_rtas( "display-character", 1, 1, NULL, ' ' ); } + |