patch-2.3.16 linux/arch/ppc/kernel/chrp_setup.c

Next file: linux/arch/ppc/kernel/chrp_time.c
Previous file: linux/arch/ppc/kernel/chrp_pci.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.15/linux/arch/ppc/kernel/chrp_setup.c linux/arch/ppc/kernel/chrp_setup.c
@@ -191,20 +191,20 @@
      *  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;
 
@@ -226,7 +226,7 @@
 
 }
 
-__initfunc(static void sio_init(void))
+static void __init sio_init(void)
 {
 	/* logical device 0 (KBC/Keyboard) */
 	sio_fixup_irq("keyboard", 0, 1, 2);
@@ -235,8 +235,8 @@
 }
 
 
-__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;
@@ -315,7 +315,10 @@
 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;
 }
 	
@@ -331,12 +334,8 @@
 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 (;;);
 }
 
@@ -434,8 +433,8 @@
                 openpic_eoi(0);
 }
 
-__initfunc(void
-	   chrp_init_IRQ(void))
+void __init
+	   chrp_init_IRQ(void)
 {
 	struct device_node *np;
 	int i;
@@ -448,12 +447,9 @@
 			(*(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;
@@ -468,8 +464,8 @@
 #endif	/* __SMP__ */
 }
 
-__initfunc(void
-	   chrp_init2(void))
+void __init
+	   chrp_init2(void)
 {
 	adb_init();
 
@@ -493,12 +489,9 @@
         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;
         }
 }
@@ -584,9 +577,9 @@
 
 #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
@@ -688,14 +681,18 @@
 void chrp_progress(char *s, unsigned short hex)
 {
 	extern unsigned int rtas_data;
-	unsigned long width;
+	int max_width, width;
 	struct device_node *root;
 	char *os = s;
-	
-	if ( (root = find_path_device("/rtas")) )
-		width = *(unsigned long *)get_property(root, "ibm,display-line-length", NULL);
+	unsigned long *p;
+
+	if ( (root = find_path_device("/rtas")) &&
+	     (p = (unsigned long *)get_property(root,
+						"ibm,display-line-length",
+						NULL)) )
+		max_width = *p;
 	else
-		width = 0x10;
+		max_width = 0x10;
 
 	if ( (_machine != _MACH_chrp) || !rtas_data )
 		return;
@@ -704,11 +701,22 @@
 		/* 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++ );
-	/* scan back for the last newline or carriage return */
-	for ( os-- ; (*os != '\n') && (*os != '\r') && (os > s) ; os--, width-- )
-		/* nothing */ ;
-	/*while ( width-- )*/
+		/* 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, ' ' );
 }
+

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)