[OpenBIOS] r332 - in openbios-devel: arch/ppc/qemu drivers

svn at openbios.org svn at openbios.org
Wed Dec 31 17:18:34 CET 2008


Author: blueswirl
Date: 2008-12-31 17:18:34 +0100 (Wed, 31 Dec 2008)
New Revision: 332

Modified:
   openbios-devel/arch/ppc/qemu/tree.fs
   openbios-devel/drivers/ide.c
Log:
Remove unused definition from qemu/tree.fs and move cd and hd alias
definition to ide.c (Laurent Vivier)


Modified: openbios-devel/arch/ppc/qemu/tree.fs
===================================================================
--- openbios-devel/arch/ppc/qemu/tree.fs	2008-12-31 15:43:34 UTC (rev 331)
+++ openbios-devel/arch/ppc/qemu/tree.fs	2008-12-31 16:18:34 UTC (rev 332)
@@ -1,7 +1,5 @@
 \   Qemu specific initialization code
 \
-\   Copyright (C) 2005 Stefan Reinauer
-\
 \   This program is free software; you can redistribute it and/or
 \   modify it under the terms of the GNU General Public License
 \   as published by the Free Software Foundation
@@ -13,13 +11,23 @@
 
 " /" find-device
 
-" chrp" device-type
-" OpenSource,QEMU" model
-" Power Macintosh" encode-string " compatible" property
-1 encode-int " #interrupt-cells" property
+" bootrom" device-type
+" PowerMac1,1" model
+" PowerMac1,1" encode-string
+" MacRisc" encode-string encode+
+" Power Macintosh" encode-string encode+ " compatible" property
+" 0000000000000" encode-string " system-id" property
+1 encode-int " #address-cells" property
 1 encode-int " #size-cells" property
+h# 0x05f5e100 encode-int " clock-frequency" property
 
 new-device
+	" cpus" device-name
+	1 encode-int " #address-cells" property
+	0 encode-int " #size-cells" property
+finish-device
+
+new-device
 	" memory" device-name
 	" memory" device-type
 	external
@@ -34,222 +42,6 @@
 	0 encode-int " #size-cells" property
 finish-device
 
-" /pci" find-device
-	h# 01000000 encode-int 0 encode-int encode+ 0 encode-int encode+
-	  h# 80000000 encode-int encode+ 0 encode-int encode+
-	  h# 01000000 encode-int encode+
-	h# 02000000 encode-int encode+ 0 encode-int encode+ 0 encode-int encode+
-	  h# C0000000 encode-int encode+ 0 encode-int encode+
-	  h# 08000000 encode-int encode+
-	" ranges" property
-	" IBM,CPC710" model
-	h# FF5F7700 encode-int " 8259-interrupt-acknowledge" property
-	h# 0000F800 encode-int 0 encode-int encode+ 0 encode-int encode+
-	  7 encode-int encode+
-	  " interrupt-map-mask" property
-	1 encode-int " #interrupt-cells" property
-	h# 80000000 encode-int " system-dma-base" property
-	d# 33333333 encode-int " clock-frequency" property
-	" " encode-string " primary-bridge" property
-	0 encode-int " pci-bridge-number" property
-	h# FEC00000 encode-int h# 100000 encode-int encode+ " reg" property
-	0 encode-int 0 encode-int encode+ " bus-range" property
-
-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
-
-: ?devalias ( alias-str alias-len device-str device-len --
-  \		alias-str alias-len false | true )
-  active-package >r
-  " /aliases" find-device
-  \ 2dup ." Checking " type
-  2dup find-dev if     \ check if device exists
-    drop
-    2over find-dev if  \ do we already have an alias?
-      \ ." alias exists" cr
-      drop 2drop false
-    else
-      \ ." device exists" cr
-      encode-string
-      2swap property
-      true
-    then
-  else
-    \ ." device doesn't exist" cr
-    2drop false
-  then
-  r> active-package!
-  ;
-
-:noname
-  " hd"
-  " /pci/pci-ata/ata-1/disk at 0" ?devalias not if
-    " /pci/pci-ata/ata-1/disk at 1" ?devalias not if
-      " /pci/pci-ata/ata-2/disk at 0" ?devalias not if
-        " /pci/pci-ata/ata-2/disk at 1" ?devalias not if
-	  2drop ." No disk found." cr
-	then
-      then
-    then
-  then
-
-  " cd"
-  " /pci/pci-ata/ata-1/cdrom at 0" ?devalias not if
-    " /pci/pci-ata/ata-1/cdrom at 1" ?devalias not if
-      " /pci/pci-ata/ata-2/cdrom at 0" ?devalias not if
-        " /pci/pci-ata/ata-2/cdrom at 1" ?devalias not if
-	  2drop ." No cdrom found" cr
-	then
-      then
-    then
-  then
-; SYSTEM-initializer
-
-new-device
-	" ide" device-name
-	" ide" device-type
-	" WINBOND,82C553" model
-	h# 28 encode-int " max-latency" property
-	h# 2 encode-int " min-grant" property
-	h# 1 encode-int " devsel-speed" property
-	h# 0 encode-int " subsystem-vendor-id" property
-	h# 0 encode-int " subsystem-id" property
-	h# 1018A encode-int " class-code" property
-	h# 5 encode-int " revision-id" property
-	h# 105 encode-int " device-id" property
-	h# 10AD encode-int " vendor-id" property
-	h# 1003110 encode-int 0 encode-int encode+ h# 10020 encode-int encode+
-	  h# 10 encode-int encode+ 0 encode-int encode+
-	  h# 1003114 encode-int 0 encode-int encode+ h# 10030 encode-int encode+
-	  h# 4 encode-int encode+ 0 encode-int encode+
-	  h# 1003118 encode-int 0 encode-int encode+ h# 10040 encode-int encode+
-	  h# 10 encode-int encode+ 0 encode-int encode+
-	  h# 100311C encode-int 0 encode-int encode+ h# 10034 encode-int encode+
-	  h# 4 encode-int encode+ 0 encode-int encode+
-	  h# 1003120 encode-int 0 encode-int encode+ h# 10050 encode-int encode+
-	  h# 10 encode-int encode+ 0 encode-int encode+
-	  h# 1003124 encode-int 0 encode-int encode+ h# 10060 encode-int encode+
-	  h# 10 encode-int encode+ 0 encode-int encode+
-	  " assigned-addresses" property
-	h# 3100 encode-int 0 encode-int encode+ 0 encode-int encode+
-	  0 encode-int encode+ 0 encode-int encode+
-	  h# 1003110 encode-int 0 encode-int encode+ h# 0 encode-int encode+
-	  h# 10 encode-int encode+ 0 encode-int encode+
-	  h# 1003114 encode-int 0 encode-int encode+ h# 0 encode-int encode+
-	  h# 4 encode-int encode+ 0 encode-int encode+
-	  h# 1003118 encode-int 0 encode-int encode+ h# 0 encode-int encode+
-	  h# 10 encode-int encode+ 0 encode-int encode+
-	  h# 100311C encode-int 0 encode-int encode+ h# 0 encode-int encode+
-	  h# 4 encode-int encode+ 0 encode-int encode+
-	  h# 1003120 encode-int 0 encode-int encode+ h# 0 encode-int encode+
-	  h# 10 encode-int encode+ 0 encode-int encode+
-	  h# 1003124 encode-int 0 encode-int encode+ h# 0 encode-int encode+
-	  h# 10 encode-int encode+ 0 encode-int encode+
-	  " reg" property
-finish-device
-
-new-device
-	" ethernet" device-name
-	" network" device-type
-	" AMD,79C973" model
-	h# 3800 encode-int 0 encode-int encode+ 0 encode-int encode+
-	  0 encode-int encode+ 0 encode-int encode+
-	  " reg" property
-finish-device
-
-" /pci/isa" find-device
-	0 0 " assigned-addresses" property
-	0 0 " ranges" property
-	0 encode-int " slot-names" property
-	d# 8333333 encode-int " clock-frequency" property
-	0 encode-int " eisa-slots" property
-	2 encode-int " #interrupt-cells" property
-	" W83C553F" encode-string " compatible" property
-	" WINBOND,82C553" model
-	0 encode-int " max-latency" property
-	0 encode-int " min-grant" property
-	1 encode-int " devsel-speed" property
-	0 encode-int " subsystem-vendor-id" property
-	0 encode-int " subsystem-id" property
-	h# 60100 encode-int " class-code" property
-	h# 10 encode-int " revision-id" property
-	h# 565 encode-int " device-id" property
-	h# 10AD encode-int " vendor-id" property
-	h# 3000 encode-int 0 encode-int encode+ 0 encode-int encode+
-	  0 encode-int encode+ 0 encode-int encode+ " reg" property
-
-new-device
-	" rtc" device-name
-	" rtc" device-type
-	" DS17285S" model
-	" MC146818" encode-string
-	" DS17285S" encode-string encode+
-	" pnpPNP,b00" encode-string encode+ " compatible" property
-	8 encode-int 0 encode-int encode+ " interrupts" property
-	h# 70 encode-int 1 encode-int encode+
-	  2 encode-int encode+ " reg" property
-finish-device
-
-new-device
-	" interrupt-controller" device-name
-	" interrupt-controller" device-type
-	" 8259" model
-	" " encode-string " interrupt-controller" property
-	2 encode-int " #interrupt-cells" property
-	1 encode-int
-	2 encode-int encode+
-	3 encode-int encode+
-	6 encode-int encode+
-	  " reserved-interrupts" property
-	" 8259" encode-string
-	  " chrp,iic" encode-string encode+
-	  " compatible" property
-	h# 20 encode-int 1 encode-int encode+
-	  2 encode-int encode+ " reg" property
-finish-device
-
-new-device
-	" serial" device-name
-	" serial" device-type
-	" no" encode-string " ctsrts" property
-	" no" encode-string " xon" property
-	" no" encode-string " parity" property
-	d# 115200 encode-int " bps" property
-	1 encode-int " stop-bits" property
-	8 encode-int " data-bits" property
-	h# 70800 encode-int " divisor" property
-	h# 708000 encode-int " clock-frequency" property
-	4 encode-int 0 encode-int encode+ " interrupts" property
-	h# 3F8 encode-int 1 encode-int encode+
-	  8 encode-int encode+ " reg" property
-finish-device
-
-" /pci" find-device
-	" /pci/isa/interrupt-controller" find-dev if
-		encode-int " interrupt-parent" property
-	then
-	h# 3800 encode-int 0 encode-int encode+
-	  0 encode-int encode+ 1 encode-int encode+
-	  " /pci/isa/interrupt-controller" find-dev if
-		encode-int encode+
-	  then
-	  h# 0C encode-int encode+ 1 encode-int encode+
-	  " interrupt-map" property
-
-" /pci/isa" find-device
-	" /pci/isa/interrupt-controller" find-dev if
-		encode-int " interrupt-parent" property
-	then
-
 \ -------------------------------------------------------------
 \ /packages
 \ -------------------------------------------------------------

Modified: openbios-devel/drivers/ide.c
===================================================================
--- openbios-devel/drivers/ide.c	2008-12-31 15:43:34 UTC (rev 331)
+++ openbios-devel/drivers/ide.c	2008-12-31 16:18:34 UTC (rev 332)
@@ -1314,8 +1314,13 @@
 {
 	int i, j;
 	char nodebuff[32];
-	phandle_t dnode;
+	phandle_t dnode, aliases;
+	int hd_found, cd_found;
 
+	aliases = find_dev("/aliases");
+	hd_found = 0;
+	cd_found = 0;
+
 	io_ports[0] = io_port0;
 	ctl_ports[0] = ctl_port0 + 2;
 	io_ports[1] = io_port1;
@@ -1404,6 +1409,19 @@
 			REGISTER_NAMED_NODE(ob_ide, nodebuff);
 			dnode=find_dev(nodebuff);
 			set_int_property(dnode, "reg", j);
+
+			/* create aliases */
+
+			if (drive->media == ide_media_cdrom && !cd_found) {
+				cd_found = 1;
+				set_property(aliases, "cd",
+					     nodebuff, strlen(nodebuff) + 1);
+			}
+			if (drive->media == ide_media_disk && !hd_found) {
+				hd_found = 1;
+				set_property(aliases, "hd",
+					     nodebuff, strlen(nodebuff) + 1);
+			}
 		}
 	}
 




More information about the OpenBIOS mailing list