[OpenBIOS] r376 - in openbios-devel: arch/sparc64 config/examples include/sparc64

svn at openbios.org svn at openbios.org
Fri Jan 9 22:00:38 CET 2009


Author: blueswirl
Date: 2009-01-09 22:00:38 +0100 (Fri, 09 Jan 2009)
New Revision: 376

Modified:
   openbios-devel/arch/sparc64/build.xml
   openbios-devel/arch/sparc64/console.c
   openbios-devel/arch/sparc64/init.fs
   openbios-devel/arch/sparc64/openbios.c
   openbios-devel/arch/sparc64/tree.fs
   openbios-devel/config/examples/cross-sparc64_config.xml
   openbios-devel/config/examples/sparc64_config.xml
   openbios-devel/include/sparc64/io.h
Log:
Enable Sparc64 PCI probing, use probed display but not IDE

Modified: openbios-devel/arch/sparc64/build.xml
===================================================================
--- openbios-devel/arch/sparc64/build.xml	2009-01-09 20:58:23 UTC (rev 375)
+++ openbios-devel/arch/sparc64/build.xml	2009-01-09 21:00:38 UTC (rev 376)
@@ -41,8 +41,9 @@
   <external-object source="target/arch/sparc64/entry.o"/>
   <external-object source="libsparc64.a"/>
   <external-object source="libbootstrap.a"/>
+  <external-object source="libdrivers.a"/>
+  <!-- Needs to be after drivers to avoid missing symbols -->
   <external-object source="libmodules.a"/>
-  <external-object source="libdrivers.a"/>
   <external-object source="liblibc.a"/>
   <external-object source="libfs.a"/>
   <external-object source="libgcc.a"/>
@@ -78,8 +79,9 @@
   <external-object source="target/arch/sparc64/builtin.o"/>
   <external-object source="libsparc64.a"/>
   <external-object source="libbootstrap.a"/>
+  <external-object source="libdrivers.a"/>
+  <!-- Needs to be after drivers to avoid missing symbols -->
   <external-object source="libmodules.a"/>
-  <external-object source="libdrivers.a"/>
   <external-object source="liblibc.a"/>
   <external-object source="libfs.a"/>
   <external-object source="libgcc.a"/>

Modified: openbios-devel/arch/sparc64/console.c
===================================================================
--- openbios-devel/arch/sparc64/console.c	2009-01-09 20:58:23 UTC (rev 375)
+++ openbios-devel/arch/sparc64/console.c	2009-01-09 21:00:38 UTC (rev 376)
@@ -122,141 +122,6 @@
  *          simple polling video/keyboard console functions
  * ****************************************************************** */
 
-#ifdef CONFIG_DEBUG_CONSOLE_VGA
-
-/* raw vga text mode */
-#define COLUMNS			80	/* The number of columns.  */
-#define LINES			25	/* The number of lines.  */
-#define ATTRIBUTE		7	/* The attribute of an character.  */
-
-#define APB_MEM_BASE	     0x1ff00000000ULL
-#define VGA_BASE	     (APB_MEM_BASE + 0x4a0000ULL) /* Beginning of video memory address.  */
-#define TEXT_BASE	     (VGA_BASE + 0x18000ULL) /* The text memory address.  */
-
-/* VGA Index and Data Registers */
-#define VGA_REG_INDEX    0x03D4	/* VGA index register */
-#define VGA_REG_DATA     0x03D5	/* VGA data register */
-
-#define VGA_IDX_CURMSL   0x09	/* cursor maximum scan line */
-#define VGA_IDX_CURSTART 0x0A	/* cursor start */
-#define VGA_IDX_CUREND   0x0B	/* cursor end */
-#define VGA_IDX_CURLO    0x0F	/* cursor position (low 8 bits) */
-#define VGA_IDX_CURHI    0x0E	/* cursor position (high 8 bits) */
-
-/* Save the X and Y position.  */
-static int xpos, ypos;
-/* Point to the video memory.  */
-static unsigned char *video = (unsigned char *) TEXT_BASE;
-
-static void video_initcursor(void)
-{
-	u8 val;
-	outb(VGA_IDX_CURMSL, VGA_REG_INDEX);
-	val = inb(VGA_REG_DATA) & 0x1f;	/* maximum scan line -1 */
-
-	outb(VGA_IDX_CURSTART, VGA_REG_INDEX);
-	outb(0, VGA_REG_DATA);
-
-	outb(VGA_IDX_CUREND, VGA_REG_INDEX);
-	outb(val, VGA_REG_DATA);
-}
-
-
-
-static void video_poscursor(unsigned int x, unsigned int y)
-{
-	unsigned short pos;
-
-	/* Calculate new cursor position as a function of x and y */
-	pos = (y * COLUMNS) + x;
-
-	/* Output the new position to VGA card */
-	outb(VGA_IDX_CURLO, VGA_REG_INDEX);	/* output low 8 bits */
-	outb((u8) (pos), VGA_REG_DATA);
-	outb(VGA_IDX_CURHI, VGA_REG_INDEX);	/* output high 8 bits */
-	outb((u8) (pos >> 8), VGA_REG_DATA);
-
-};
-
-
-static void video_newline(void)
-{
-	xpos = 0;
-
-	if (ypos < LINES - 1) {
-		ypos++;
-	} else {
-		int i;
-		memmove((void *) video, (void *) (video + 2 * COLUMNS),
-			(LINES - 1) * COLUMNS * 2);
-
-		for (i = ((LINES - 1) * 2 * COLUMNS);
-		     i < 2 * COLUMNS * LINES;) {
-			video[i++] = 0;
-			video[i++] = ATTRIBUTE;
-		}
-	}
-
-}
-
-/* Put the character C on the screen.  */
-static void video_putchar(int c)
-{
-	int p=1;
-
-	if (c == '\n' || c == '\r') {
-		video_newline();
-		return;
-	}
-
-	if (c == '\b') {
-		if (xpos) xpos--;
-		c=' ';
-		p=0;
-	}
-
-
-	if (xpos >= COLUMNS)
-		video_newline();
-
-	*(video + (xpos + ypos * COLUMNS) * 2) = c & 0xFF;
-	*(video + (xpos + ypos * COLUMNS) * 2 + 1) = ATTRIBUTE;
-
-	if (p)
-		xpos++;
-
-	video_poscursor(xpos, ypos);
-}
-
-static void video_cls(void)
-{
-	int i;
-
-	for (i = 0; i < 2 * COLUMNS * LINES;) {
-		video[i++] = 0;
-		video[i++] = ATTRIBUTE;
-	}
-
-
-	xpos = 0;
-	ypos = 0;
-
-	video_initcursor();
-	video_poscursor(xpos, ypos);
-}
-
-void video_init(void)
-{
-	video=(unsigned char *)TEXT_BASE;
-
-#ifdef CONFIG_DRIVER_VGA
-        vga_load_regs();
-        vga_font_load((unsigned char *)VGA_BASE, fontdata_8x16,
-                      FONT_HEIGHT_8X16, 256);
-        vga_set_amode();
-#endif
-}
-
 /*
  *  keyboard driver
  */
@@ -373,9 +238,7 @@
 	last_key = 0;
 	return tmp;
 }
-#endif
 
-
 /* ******************************************************************
  *      common functions, implementing simple concurrent console
  * ****************************************************************** */
@@ -385,9 +248,6 @@
 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
 	serial_putchar(c);
 #endif
-#ifdef CONFIG_DEBUG_CONSOLE_VGA
-	video_putchar(c);
-#endif
 	return c;
 }
 
@@ -422,9 +282,6 @@
 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
 	serial_cls();
 #endif
-#ifdef CONFIG_DEBUG_CONSOLE_VGA
-	video_cls();
-#endif
 }
 
 #endif // CONFIG_DEBUG_CONSOLE

Modified: openbios-devel/arch/sparc64/init.fs
===================================================================
--- openbios-devel/arch/sparc64/init.fs	2009-01-09 20:58:23 UTC (rev 375)
+++ openbios-devel/arch/sparc64/init.fs	2009-01-09 21:00:38 UTC (rev 376)
@@ -36,12 +36,12 @@
 ; SYSTEM-initializer
 
 \ use the tty interface if available
-:noname
-  " /builtin/console" find-dev if drop
-    " /builtin/console" " input-device" $setenv
-    " /builtin/console" " output-device" $setenv
+: activate-tty-interface
+  " /packages/terminal-emulator" find-dev if drop
+    " keyboard" " input-device" $setenv
+    " screen" " output-device" $setenv
   then
-; SYSTEM-initializer
+;
 
 :noname
   " keyboard" input

Modified: openbios-devel/arch/sparc64/openbios.c
===================================================================
--- openbios-devel/arch/sparc64/openbios.c	2009-01-09 20:58:23 UTC (rev 375)
+++ openbios-devel/arch/sparc64/openbios.c	2009-01-09 21:00:38 UTC (rev 376)
@@ -34,7 +34,6 @@
 #define NVRAM_DATA    0x77
 
 #define APB_SPECIAL_BASE     0x1fe00000000ULL
-#define PCI_CONFIG           (APB_SPECIAL_BASE + 0x1000000ULL)
 #define APB_MEM_BASE         0x1ff00000000ULL
 
 #define MEMORY_SIZE     (512*1024)      /* 512K ram for hosted system */
@@ -64,11 +63,18 @@
 static const struct hwdef hwdefs[] = {
     {
         .pci = {
-            .cfg_addr = PCI_CONFIG,
-            .cfg_data = 0,
+            .name = "SUNW,sabre",
+            .vendor_id = 0x108e,
+            .device_id = 0xa000,
+            .cfg_addr = APB_SPECIAL_BASE + 0x1000000ULL,
+            .cfg_data = APB_MEM_BASE,
             .cfg_base = 0x80000000ULL,
             .cfg_len = 0,
-            .irqs = { 1, 2, 3, 4 },
+            .mem_base = APB_MEM_BASE + 0x400000ULL,
+            .mem_len = 0x10000000,
+            .io_base = APB_SPECIAL_BASE + 0x2000000ULL,
+            .io_len = 0x10000,
+            .irqs = { 0, 1, 2, 3 },
         },
         .machine_id_low = 0,
         .machine_id_high = 255,
@@ -243,7 +249,7 @@
 {
     unsigned int i;
 
-    outw(__cpu_to_le16(cmd), BIOS_CFG_CMD);
+    outw(cmd, BIOS_CFG_CMD);
     for (i = 0; i < nbytes; i++)
         buf[i] = inb(BIOS_CFG_DATA);
 }
@@ -457,36 +463,16 @@
 static void
 arch_init( void )
 {
-        unsigned int i;
-        uint16_t machine_id;
-        const struct hwdef *hwdef = NULL;
-
-        machine_id = fw_cfg_read_i16(FW_CFG_MACHINE_ID);
-
-        for (i = 0; i < sizeof(hwdefs) / sizeof(struct hwdef); i++) {
-            if (hwdefs[i].machine_id_low <= machine_id &&
-                hwdefs[i].machine_id_high >= machine_id) {
-                hwdef = &hwdefs[i];
-                break;
-            }
-        }
-        if (!hwdef)
-            for(;;); // Internal inconsistency, hang
-
 	modules_init();
-#ifdef CONFIG_DRIVER_PCI
-        //ob_pci_init();
-#endif
-#ifdef CONFIG_DRIVER_IDE
+        // XXX use PCI IDE
 	setup_timers();
 	ob_ide_init("/pci/isa", 0x1f0, 0x3f4, 0x170, 0x374);
+#ifdef CONFIG_DRIVER_PCI
+        ob_pci_init();
 #endif
 #ifdef CONFIG_DRIVER_FLOPPY
 	ob_floppy_init();
 #endif
-#ifdef CONFIG_DEBUG_CONSOLE_VIDEO
-	init_video();
-#endif
 
         nvconf_init();
         ob_su_init(0x1fe02000000ULL, 0x3f8ULL, 0);
@@ -494,18 +480,34 @@
         device_end();
 
 	bind_func("platform-boot", boot );
-        printk("\n"); // XXX needed for boot, why?
 }
 
+unsigned long isa_io_base;
+
 int openbios(void)
 {
+        unsigned int i;
+        uint16_t machine_id;
+        const struct hwdef *hwdef = NULL;
+
+
+        for (i = 0; i < sizeof(hwdefs) / sizeof(struct hwdef); i++) {
+            isa_io_base = hwdefs[i].pci.io_base;
+            machine_id = fw_cfg_read_i16(FW_CFG_MACHINE_ID);
+            if (hwdefs[i].machine_id_low <= machine_id &&
+                hwdefs[i].machine_id_high >= machine_id) {
+                hwdef = &hwdefs[i];
+                arch = &hwdefs[i].pci;
+                break;
+            }
+        }
+        if (!hwdef)
+            for(;;); // Internal inconsistency, hang
+
 #ifdef CONFIG_DEBUG_CONSOLE
 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
 	uart_init(CONFIG_SERIAL_PORT, CONFIG_SERIAL_SPEED);
 #endif
-#ifdef CONFIG_DEBUG_CONSOLE_VGA
-	video_init();
-#endif
 	/* Clear the screen.  */
 	cls();
         printk("OpenBIOS for Sparc64\n");

Modified: openbios-devel/arch/sparc64/tree.fs
===================================================================
--- openbios-devel/arch/sparc64/tree.fs	2009-01-09 20:58:23 UTC (rev 375)
+++ openbios-devel/arch/sparc64/tree.fs	2009-01-09 21:00:38 UTC (rev 376)
@@ -33,54 +33,16 @@
 " /openprom" find-device
   " OBP 3.10.24 1999/01/01 01:01" encode-string " version" property
 
-device-end
-
-\ we only implement DD and DD,F
-: encode-unit-pci ( phys.lo phy.mid phys.hi -- str len )
-  nip nip ff00 and 8 >> dup 3 >>
-  swap 7 and
-  ( ddddd fff )
-
-  ?dup if
-    pocket tohexstr
-    " ," pocket tmpstrcat
-  else
-    0 0 pocket tmpstrcpy
-  then
-  >r
-  rot pocket tohexstr r> tmpstrcat drop
-;
-
 dev /
 
 \ simple pci bus node
 new-device
   " pci" device-name
-	3 encode-int " #address-cells" property
-	2 encode-int " #size-cells" property
-	0 encode-int 0 encode-int encode+ " bus-range" property
-	" pci" encode-string " device_type" property
-
-  external
-  : open ( cr ." opening PCI" cr ) true ;
-  : close ;
-  : decode-unit 0 decode-unit-pci-bus ;
-  : encode-unit encode-unit-pci ;
 finish-device
 
-device-end
-
 dev /pci
 
 \ simple isa bus node
 new-device
   " isa" device-name
-  " isa" device-type
-	2 encode-int " #address-cells" property
-	1 encode-int " #size-cells" property
-
-  external
-  : open true ;
-  : close ;
-
 finish-device

Modified: openbios-devel/config/examples/cross-sparc64_config.xml
===================================================================
--- openbios-devel/config/examples/cross-sparc64_config.xml	2009-01-09 20:58:23 UTC (rev 375)
+++ openbios-devel/config/examples/cross-sparc64_config.xml	2009-01-09 21:00:38 UTC (rev 376)
@@ -35,8 +35,8 @@
   <!-- Module Configuration -->
   <option name="CONFIG_CMDLINE" type="boolean" value="true"/>
   <option name="CONFIG_DEBLOCKER" type="boolean" value="true"/>
-  <option name="CONFIG_FONT_8X8" type="boolean" value="false"/>
-  <option name="CONFIG_FONT_8X16" type="boolean" value="true"/>
+  <option name="CONFIG_FONT_8X8" type="boolean" value="true"/>
+  <option name="CONFIG_FONT_8X16" type="boolean" value="false"/>
 
   <!-- Filesystem Configuration -->
   <option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
@@ -67,7 +67,7 @@
 
   <!-- Drivers -->
   <option name="CONFIG_DRIVER_PCI" type="boolean" value="true"/>
-  <option name="CONFIG_DEBUG_PCI" type="boolean" value="true"/>
+  <option name="CONFIG_DEBUG_PCI" type="boolean" value="false"/>
   <option name="CONFIG_DRIVER_IDE" type="boolean" value="true"/>
   <option name="CONFIG_IDE_NUM_CHANNELS" type="integer" value="4"/>
   <option name="CONFIG_DEBUG_IDE" type="boolean" value="false"/>

Modified: openbios-devel/config/examples/sparc64_config.xml
===================================================================
--- openbios-devel/config/examples/sparc64_config.xml	2009-01-09 20:58:23 UTC (rev 375)
+++ openbios-devel/config/examples/sparc64_config.xml	2009-01-09 21:00:38 UTC (rev 376)
@@ -35,8 +35,8 @@
   <!-- Module Configuration -->
   <option name="CONFIG_CMDLINE" type="boolean" value="true"/>
   <option name="CONFIG_DEBLOCKER" type="boolean" value="true"/>
-  <option name="CONFIG_FONT_8X8" type="boolean" value="false"/>
-  <option name="CONFIG_FONT_8X16" type="boolean" value="true"/>
+  <option name="CONFIG_FONT_8X8" type="boolean" value="true"/>
+  <option name="CONFIG_FONT_8X16" type="boolean" value="false"/>
 
   <!-- Filesystem Configuration -->
   <option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
@@ -67,7 +67,7 @@
 
   <!-- Drivers -->
   <option name="CONFIG_DRIVER_PCI" type="boolean" value="true"/>
-  <option name="CONFIG_DEBUG_PCI" type="boolean" value="true"/>
+  <option name="CONFIG_DEBUG_PCI" type="boolean" value="false"/>
   <option name="CONFIG_DRIVER_IDE" type="boolean" value="true"/>
   <option name="CONFIG_IDE_NUM_CHANNELS" type="integer" value="4"/>
   <option name="CONFIG_DEBUG_IDE" type="boolean" value="false"/>

Modified: openbios-devel/include/sparc64/io.h
===================================================================
--- openbios-devel/include/sparc64/io.h	2009-01-09 20:58:23 UTC (rev 375)
+++ openbios-devel/include/sparc64/io.h	2009-01-09 21:00:38 UTC (rev 376)
@@ -33,9 +33,7 @@
 
 #ifndef BOOTSTRAP
 
-#ifndef _IO_BASE
-#define _IO_BASE	0x1fe02000000ULL
-#endif
+extern unsigned long isa_io_base;
 
 /*
  * The insw/outsw/insl/outsl macros don't do byte-swapping.
@@ -43,15 +41,15 @@
  * are arrays of bytes, and byte-swapping is not appropriate in
  * that case.  - paulus
  */
-#define insw(port, buf, ns)	_insw_ns((uint16_t *)((port)+_IO_BASE), (buf), (ns))
-#define outsw(port, buf, ns)	_outsw_ns((uint16_t *)((port)+_IO_BASE), (buf), (ns))
+#define insw(port, buf, ns)	_insw_ns((uint16_t *)((port)+isa_io_base), (buf), (ns))
+#define outsw(port, buf, ns)	_outsw_ns((uint16_t *)((port)+isa_io_base), (buf), (ns))
 
-#define inb(port)		in_8((uint8_t *)((port)+_IO_BASE))
-#define outb(val, port)		out_8((uint8_t *)((port)+_IO_BASE), (val))
-#define inw(port)		in_le16((uint16_t *)((port)+_IO_BASE))
-#define outw(val, port)		out_le16((uint16_t *)((port)+_IO_BASE), (val))
-#define inl(port)		in_le32((uint32_t *)((port)+_IO_BASE))
-#define outl(val, port)		out_le32((uint32_t *)((port)+_IO_BASE), (val))
+#define inb(port)		in_8((uint8_t *)((port)+isa_io_base))
+#define outb(val, port)		out_8((uint8_t *)((port)+isa_io_base), (val))
+#define inw(port)		in_be16((uint16_t *)((port)+isa_io_base))
+#define outw(val, port)		out_be16((uint16_t *)((port)+isa_io_base), (val))
+#define inl(port)		in_be32((uint32_t *)((port)+isa_io_base))
+#define outl(val, port)		out_be32((uint32_t *)((port)+isa_io_base), (val))
 
 /*
  * 8, 16 and 32 bit, big and little endian I/O operations, with barrier.




More information about the OpenBIOS mailing list