[OpenBIOS] [commit] r685 - in trunk/openbios-devel: . arch/amd64 arch/ia64 arch/ppc arch/ppc/mol arch/ppc/pearpc arch/sparc32 arch/sparc64 arch/unix arch/x86 arch/x86/xbox config/scripts include libopenbios m...

repository service svn at openbios.org
Sat Mar 13 11:58:19 CET 2010


Author: mcayland
Date: Sat Mar 13 11:58:19 2010
New Revision: 685
URL: http://tracker.coreboot.org/trac/openbios/changeset/685

Log:
Refactoring of the OpenBIOS source code, as discussed on the mailing list. The primary aim of this process is to try and arrange 
the source files into a structure whereby it is easier to find the relationship between a forth package word and its C 
implementation, while also creating a libopenbios library into which more common code from the arch/ tree can eventually be 
moved.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>

Added:
   trunk/openbios-devel/libopenbios/   (props changed)
      - copied from r683, trunk/openbios-devel/modules/
   trunk/openbios-devel/packages/
   trunk/openbios-devel/packages/bootinfo-loader.c   (contents, props changed)
      - copied, changed from r683, trunk/openbios-devel/modules/bootinfo-loader.c
   trunk/openbios-devel/packages/cmdline.c   (contents, props changed)
      - copied, changed from r683, trunk/openbios-devel/modules/cmdline.c
   trunk/openbios-devel/packages/deblocker.c   (contents, props changed)
      - copied, changed from r683, trunk/openbios-devel/modules/deblocker.c
   trunk/openbios-devel/packages/disk-label.c   (contents, props changed)
      - copied, changed from r683, trunk/openbios-devel/modules/disk-label.c
   trunk/openbios-devel/packages/elf-loader.c   (contents, props changed)
      - copied, changed from r683, trunk/openbios-devel/modules/elf-loader.c
   trunk/openbios-devel/packages/init.c   (contents, props changed)
      - copied, changed from r683, trunk/openbios-devel/modules/init.c
   trunk/openbios-devel/packages/mac-parts.c   (contents, props changed)
      - copied, changed from r683, trunk/openbios-devel/modules/mac-parts.c
   trunk/openbios-devel/packages/mac-parts.h   (props changed)
      - copied unchanged from r683, trunk/openbios-devel/modules/mac-parts.h
   trunk/openbios-devel/packages/misc-files.c   (contents, props changed)
      - copied, changed from r683, trunk/openbios-devel/modules/filesystems.c
   trunk/openbios-devel/packages/nvram.c   (props changed)
      - copied unchanged from r683, trunk/openbios-devel/modules/nvram.c
   trunk/openbios-devel/packages/packages.h   (contents, props changed)
      - copied, changed from r683, trunk/openbios-devel/modules/modules.h
   trunk/openbios-devel/packages/pc-parts.c   (contents, props changed)
      - copied, changed from r683, trunk/openbios-devel/modules/pc-parts.c
   trunk/openbios-devel/packages/sun-parts.c   (contents, props changed)
      - copied, changed from r683, trunk/openbios-devel/modules/sun-parts.c
   trunk/openbios-devel/packages/video.c   (props changed)
      - copied unchanged from r683, trunk/openbios-devel/modules/video.c
   trunk/openbios-devel/packages/xcoff-loader.c   (contents, props changed)
      - copied, changed from r683, trunk/openbios-devel/modules/xcoff-loader.c
Deleted:
   trunk/openbios-devel/libopenbios/bootinfo-loader.c
   trunk/openbios-devel/libopenbios/cmdline.c
   trunk/openbios-devel/libopenbios/deblocker.c
   trunk/openbios-devel/libopenbios/disk-label.c
   trunk/openbios-devel/libopenbios/elf-loader.c
   trunk/openbios-devel/libopenbios/filesystems.c
   trunk/openbios-devel/libopenbios/init.c
   trunk/openbios-devel/libopenbios/mac-parts.c
   trunk/openbios-devel/libopenbios/mac-parts.h
   trunk/openbios-devel/libopenbios/modules.h
   trunk/openbios-devel/libopenbios/nvram.c
   trunk/openbios-devel/libopenbios/pc-parts.c
   trunk/openbios-devel/libopenbios/sun-parts.c
   trunk/openbios-devel/libopenbios/support.fs
   trunk/openbios-devel/libopenbios/video.c
   trunk/openbios-devel/libopenbios/xcoff-loader.c
   trunk/openbios-devel/modules/
Modified:
   trunk/openbios-devel/arch/amd64/Kconfig
   trunk/openbios-devel/arch/ia64/Kconfig
   trunk/openbios-devel/arch/ppc/Kconfig
   trunk/openbios-devel/arch/ppc/build.xml
   trunk/openbios-devel/arch/ppc/mol/console.c
   trunk/openbios-devel/arch/ppc/pearpc/console.c
   trunk/openbios-devel/arch/sparc32/build.xml
   trunk/openbios-devel/arch/sparc64/build.xml
   trunk/openbios-devel/arch/unix/build.xml
   trunk/openbios-devel/arch/x86/Kconfig
   trunk/openbios-devel/arch/x86/build.xml
   trunk/openbios-devel/arch/x86/xbox/console.c
   trunk/openbios-devel/build.xml
   trunk/openbios-devel/config/scripts/switch-arch
   trunk/openbios-devel/include/video_subr.h
   trunk/openbios-devel/libopenbios/build.xml

Modified: trunk/openbios-devel/arch/amd64/Kconfig
==============================================================================
--- trunk/openbios-devel/arch/amd64/Kconfig	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/arch/amd64/Kconfig	Sat Mar 13 11:58:19 2010	(r685)
@@ -44,5 +44,5 @@
 
 source "kernel/Kconfig"
 source "forth/Kconfig"
-source "modules/Kconfig"
+source "libopenbios/Kconfig"
 source "drivers/Kconfig"

Modified: trunk/openbios-devel/arch/ia64/Kconfig
==============================================================================
--- trunk/openbios-devel/arch/ia64/Kconfig	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/arch/ia64/Kconfig	Sat Mar 13 11:58:19 2010	(r685)
@@ -18,5 +18,5 @@
 
 source "kernel/Kconfig"
 source "forth/Kconfig"
-source "modules/Kconfig"
+source "libopenbios/Kconfig"
 source "drivers/Kconfig"

Modified: trunk/openbios-devel/arch/ppc/Kconfig
==============================================================================
--- trunk/openbios-devel/arch/ppc/Kconfig	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/arch/ppc/Kconfig	Sat Mar 13 11:58:19 2010	(r685)
@@ -44,5 +44,5 @@
 
 source "kernel/Kconfig"
 source "forth/Kconfig"
-source "modules/Kconfig"
+source "libopenbios/Kconfig"
 source "drivers/Kconfig"

Modified: trunk/openbios-devel/arch/ppc/build.xml
==============================================================================
--- trunk/openbios-devel/arch/ppc/build.xml	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/arch/ppc/build.xml	Sat Mar 13 11:58:19 2010	(r685)
@@ -153,7 +153,8 @@
   <object source="timebase.S"/>
   <external-object source="libbriq.a"/>
   <external-object source="libbootstrap.a"/>
-  <external-object source="libmodules.a"/>
+  <external-object source="libopenbios.a"/>
+  <external-object source="libpackages.a"/>
   <external-object source="libdrivers.a"/>
   <external-object source="libfs.a"/>
   <external-object source="liblibc.a"/>
@@ -168,7 +169,8 @@
   <object source="timebase.S"/>
   <external-object source="libpearpc.a"/>
   <external-object source="libbootstrap.a"/>
-  <external-object source="libmodules.a"/>
+  <external-object source="libopenbios.a"/>
+  <external-object source="libpackages.a"/>
   <external-object source="libdrivers.a"/>
   <external-object source="libfs.a"/>
   <external-object source="liblibc.a"/>
@@ -183,7 +185,8 @@
   <object source="timebase.S"/>
   <external-object source="libqemu.a"/>
   <external-object source="libbootstrap.a"/>
-  <external-object source="libmodules.a"/>
+  <external-object source="libopenbios.a"/>
+  <external-object source="libpackages.a"/>
   <external-object source="libdrivers.a"/>
   <external-object source="libfs.a"/>
   <external-object source="liblibc.a"/>
@@ -198,7 +201,8 @@
   <object source="start.S"/>
   <external-object source="libmol.a"/>
   <external-object source="libbootstrap.a"/>
-  <external-object source="libmodules.a"/>
+  <external-object source="libopenbios.a"/>
+  <external-object source="libpackages.a"/>
   <external-object source="libdrivers.a"/>
   <external-object source="libfs.a"/>
   <external-object source="liblibc.a"/>

Modified: trunk/openbios-devel/arch/ppc/mol/console.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/mol/console.c	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/arch/ppc/mol/console.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -26,5 +26,5 @@
 
 #define openbios_GetFBInfo(x) OSI_GetFBInfo(x)
 
-#include "../../../modules/video.c"
-#include "../../../modules/console.c"
+#include "../../../packages/video.c"
+#include "../../../libopenbios/console_common.c"

Modified: trunk/openbios-devel/arch/ppc/pearpc/console.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/pearpc/console.c	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/arch/ppc/pearpc/console.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -39,6 +39,5 @@
 
 #define openbios_GetFBInfo(x) PearPC_GetFBInfo(x)
 
-#include "../../../modules/video.c"
-
-#include "../../../modules/console.c"
+#include "../../../packages/video.c"
+#include "../../../libopenbios/console_common.c"

Modified: trunk/openbios-devel/arch/sparc32/build.xml
==============================================================================
--- trunk/openbios-devel/arch/sparc32/build.xml	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/arch/sparc32/build.xml	Sat Mar 13 11:58:19 2010	(r685)
@@ -32,7 +32,8 @@
   <object source="plainboot.c"/>
   <external-object source="libsparc32.a"/>
   <external-object source="libbootstrap.a"/>
-  <external-object source="libmodules.a"/>
+  <external-object source="libopenbios.a"/>
+  <external-object source="libpackages.a"/>
   <external-object source="libdrivers.a"/>
   <external-object source="libfs.a"/>
   <external-object source="liblibc.a"/>
@@ -66,7 +67,8 @@
   <external-object source="target/arch/sparc32/builtin.o"/>
   <external-object source="libsparc32.a"/>
   <external-object source="libbootstrap.a"/>
-  <external-object source="libmodules.a"/>
+  <external-object source="libopenbios.a"/>
+  <external-object source="libpackages.a"/>
   <external-object source="libdrivers.a"/>
   <external-object source="libfs.a"/>
   <external-object source="liblibc.a"/>

Modified: trunk/openbios-devel/arch/sparc64/build.xml
==============================================================================
--- trunk/openbios-devel/arch/sparc64/build.xml	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/arch/sparc64/build.xml	Sat Mar 13 11:58:19 2010	(r685)
@@ -33,7 +33,8 @@
   <object source="plainboot.c"/>
   <external-object source="libsparc64.a"/>
   <external-object source="libbootstrap.a"/>
-  <external-object source="libmodules.a"/>
+  <external-object source="libopenbios.a"/>
+  <external-object source="libpackages.a"/>
   <external-object source="libdrivers.a"/>
   <external-object source="libfs.a"/>
   <external-object source="liblibc.a"/>
@@ -68,7 +69,8 @@
   <external-object source="target/arch/sparc64/builtin.o"/>
   <external-object source="libsparc64.a"/>
   <external-object source="libbootstrap.a"/>
-  <external-object source="libmodules.a"/>
+  <external-object source="libopenbios.a"/>
+  <external-object source="libpackages.a"/>
   <external-object source="libdrivers.a"/>
   <external-object source="libfs.a"/>
   <external-object source="liblibc.a"/>

Modified: trunk/openbios-devel/arch/unix/build.xml
==============================================================================
--- trunk/openbios-devel/arch/unix/build.xml	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/arch/unix/build.xml	Sat Mar 13 11:58:19 2010	(r685)
@@ -13,7 +13,8 @@
   <object source="blk.c"  flags="-DBOOTSTRAP"/>
   <object source="plugins.c" flags="-DBOOTSTRAP" condition="PLUGINS"/>
   <external-object source="libbootstrap.a"/>
-  <external-object source="libmodules.a"/>
+  <external-object source="libopenbios.a"/>
+  <external-object source="libpackages.a"/>
   <external-object source="libdrivers.a"/>
   <external-object source="libfs.a"/>
   <external-object source="liblibc.a"/>

Modified: trunk/openbios-devel/arch/x86/Kconfig
==============================================================================
--- trunk/openbios-devel/arch/x86/Kconfig	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/arch/x86/Kconfig	Sat Mar 13 11:58:19 2010	(r685)
@@ -43,5 +43,5 @@
 
 source "kernel/Kconfig"
 source "forth/Kconfig"
-source "modules/Kconfig"
+source "libopenbios/Kconfig"
 source "drivers/Kconfig"

Modified: trunk/openbios-devel/arch/x86/build.xml
==============================================================================
--- trunk/openbios-devel/arch/x86/build.xml	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/arch/x86/build.xml	Sat Mar 13 11:58:19 2010	(r685)
@@ -30,7 +30,8 @@
   <object source="multiboot.c"/>
   <external-object source="libx86.a"/>
   <external-object source="libbootstrap.a"/>
-  <external-object source="libmodules.a"/>
+  <external-object source="libopenbios.a"/>
+  <external-object source="libpackages.a"/>
   <external-object source="libdrivers.a"/>
   <external-object source="liblibc.a"/>
   <external-object source="libfs.a"/>
@@ -45,7 +46,8 @@
   <object source="plainboot.c"/>
   <external-object source="libx86.a"/>
   <external-object source="libbootstrap.a"/>
-  <external-object source="libmodules.a"/>
+  <external-object source="libopenbios.a"/>
+  <external-object source="libpackages.a"/>
   <external-object source="libdrivers.a"/>
   <external-object source="liblibc.a"/>
   <external-object source="libfs.a"/>
@@ -79,7 +81,8 @@
   <external-object source="target/arch/x86/builtin.o"/>
   <external-object source="libx86.a"/>
   <external-object source="libbootstrap.a"/>
-  <external-object source="libmodules.a"/>
+  <external-object source="libopenbios.a"/>
+  <external-object source="libpackages.a"/>
   <external-object source="libdrivers.a"/>
   <external-object source="liblibc.a"/>
   <external-object source="libfs.a"/>

Modified: trunk/openbios-devel/arch/x86/xbox/console.c
==============================================================================
--- trunk/openbios-devel/arch/x86/xbox/console.c	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/arch/x86/xbox/console.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -19,5 +19,5 @@
 	int		rb, w, h, depth;
 } osi_fb_info_t;
 
-#include "../../../modules/video.c"
-#include "../../../modules/console.c"
+#include "../../../packages/video.c"
+#include "../../../libopenbios/console_common.c"

Modified: trunk/openbios-devel/build.xml
==============================================================================
--- trunk/openbios-devel/build.xml	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/build.xml	Sat Mar 13 11:58:19 2010	(r685)
@@ -5,7 +5,8 @@
   <include href="forth/build.xml"/>
   <include href="libc/build.xml"/>
   <include href="libgcc/build.xml"/>
-  <include href="modules/build.xml"/>
+  <include href="libopenbios/build.xml"/>
+  <include href="packages/build.xml"/>
   <include href="drivers/build.xml"/>
   <include href="fs/build.xml"/>
   <include href="arch/build.xml"/>

Modified: trunk/openbios-devel/config/scripts/switch-arch
==============================================================================
--- trunk/openbios-devel/config/scripts/switch-arch	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/config/scripts/switch-arch	Sat Mar 13 11:58:19 2010	(r685)
@@ -177,7 +177,8 @@
     mkdir -p $OBJDIR/target/arch/x86/xbox
     mkdir -p $OBJDIR/target/libgcc
     mkdir -p $OBJDIR/target/kernel
-    mkdir -p $OBJDIR/target/modules
+    mkdir -p $OBJDIR/target/libopenbios
+    mkdir -p $OBJDIR/target/packages
     mkdir -p $OBJDIR/target/fs
     mkdir -p $OBJDIR/target/fs/grubfs
     mkdir -p $OBJDIR/target/fs/hfs

Modified: trunk/openbios-devel/include/video_subr.h
==============================================================================
--- trunk/openbios-devel/include/video_subr.h	Sun Mar  7 17:36:30 2010	(r684)
+++ trunk/openbios-devel/include/video_subr.h	Sat Mar 13 11:58:19 2010	(r685)
@@ -15,14 +15,14 @@
 void vga_vbe_init(const char *path, unsigned long fb, uint32_t fb_size,
                   unsigned long rom, uint32_t rom_size);
 
-/* modules/video.c */
+/* packages/video.c */
 int video_get_res(int *w, int *h);
 void draw_pixel(int x, int y, int colind);
 void set_color(int ind, unsigned long color);
 void video_scroll(int height);
 void init_video(unsigned long fb, int width, int height, int depth, int rb);
 
-/* modules/console_common.c */
+/* libopenbios/console_common.c */
 int console_draw_str(const char *str);
 int console_init(void);
 void console_close(void);

Modified: trunk/openbios-devel/libopenbios/build.xml
==============================================================================
--- trunk/openbios-devel/modules/build.xml	Mon Feb 22 19:52:34 2010	(r683)
+++ trunk/openbios-devel/libopenbios/build.xml	Sat Mar 13 11:58:19 2010	(r685)
@@ -1,38 +1,24 @@
 <build>
 
- <library name="modules" type="static" target="target">
-  <object source="nvram.c"/>
-  <object source="init.c"/>
+ <library name="openbios" type="static" target="target">
   <object source="bindings.c"/>
+  <object source="bootinfo-loader.c" condition="PPC"/>
   <object source="client.c"/>
-  <object source="ipchecksum.c"/>
-  <object source="video.c"/>
   <object source="console_common.c"/>
   <object source="elfnote.c" condition="X86"/>
   <object source="elfnote.c" condition="AMD64"/>
   <object source="elfnote.c" condition="SPARC32"/>
   <object source="elfnote.c" condition="SPARC64"/>
   <object source="elfload.c" condition="PPC"/>
-  <object source="linuxbios.c" condition="LINUXBIOS"/>
-  <object source="cmdline.c" condition="CMDLINE"/>
-  <object source="deblocker.c" condition="DEBLOCKER"/>
-  <object source="disk-label.c" condition="DISK_LABEL"/>
-  <object source="filesystems.c" condition="FS"/>
-  <object source="mac-parts.c" condition="MAC_PARTS"/>
-  <object source="pc-parts.c" condition="PC_PARTS"/>
-  <object source="sun-parts.c" condition="SUN_PARTS"/>
   <object source="font_8x8.c" condition="FONT_8X8"/>
   <object source="font_8x16.c" condition="FONT_8X16"/>
+  <object source="ipchecksum.c"/>
+  <object source="linuxbios.c" condition="LINUXBIOS"/>
   <object source="ofmem_common.c" condition="OFMEM"/>
-  <object source="elf-loader.c" condition="PPC"/>
-  <object source="elf-loader.c" condition="SPARC64"/>
-  <object source="xcoff-loader.c" condition="PPC"/>
-  <object source="bootinfo-loader.c" condition="PPC"/>
  </library>
 
  <dictionary name="openbios" target="forth">
   <object source="clib.fs"/>
-  <object source="support.fs"/>
   <object source="helpers.fs"/>
  </dictionary>
 

Copied and modified: trunk/openbios-devel/packages/bootinfo-loader.c (from r683, trunk/openbios-devel/modules/bootinfo-loader.c)
==============================================================================
--- trunk/openbios-devel/modules/bootinfo-loader.c	Mon Feb 22 19:52:34 2010	(r683, copy source)
+++ trunk/openbios-devel/packages/bootinfo-loader.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -16,7 +16,7 @@
 
 #include "openbios/config.h"
 #include "openbios/bindings.h"
-#include "modules.h"
+#include "packages.h"
 #include "ofmem.h"
 #include "libc/vsprintf.h"
 

Copied and modified: trunk/openbios-devel/packages/cmdline.c (from r683, trunk/openbios-devel/modules/cmdline.c)
==============================================================================
--- trunk/openbios-devel/modules/cmdline.c	Mon Feb 22 19:52:34 2010	(r683, copy source)
+++ trunk/openbios-devel/packages/cmdline.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -16,7 +16,7 @@
 
 #include "openbios/config.h"
 #include "openbios/bindings.h"
-#include "modules.h"
+#include "packages.h"
 #include "libc/vsprintf.h"
 
 typedef struct {

Copied and modified: trunk/openbios-devel/packages/deblocker.c (from r683, trunk/openbios-devel/modules/deblocker.c)
==============================================================================
--- trunk/openbios-devel/modules/deblocker.c	Mon Feb 22 19:52:34 2010	(r683, copy source)
+++ trunk/openbios-devel/packages/deblocker.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -17,7 +17,7 @@
 #include "openbios/config.h"
 #include "openbios/bindings.h"
 #include "libc/diskio.h"
-#include "modules.h"
+#include "packages.h"
 
 typedef struct {
         ucell   mark_hi, mark_lo;

Copied and modified: trunk/openbios-devel/packages/disk-label.c (from r683, trunk/openbios-devel/modules/disk-label.c)
==============================================================================
--- trunk/openbios-devel/modules/disk-label.c	Mon Feb 22 19:52:34 2010	(r683, copy source)
+++ trunk/openbios-devel/packages/disk-label.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -17,7 +17,7 @@
 #include "openbios/config.h"
 #include "openbios/bindings.h"
 #include "libc/diskio.h"
-#include "modules.h"
+#include "packages.h"
 
 //#define DEBUG_DISK_LABEL
 

Copied and modified: trunk/openbios-devel/packages/elf-loader.c (from r683, trunk/openbios-devel/modules/elf-loader.c)
==============================================================================
--- trunk/openbios-devel/modules/elf-loader.c	Mon Feb 22 19:52:34 2010	(r683, copy source)
+++ trunk/openbios-devel/packages/elf-loader.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -16,7 +16,7 @@
 
 #include "openbios/config.h"
 #include "openbios/bindings.h"
-#include "modules.h"
+#include "packages.h"
 #include "ofmem.h"
 
 #include "openbios/elf.h"

Copied and modified: trunk/openbios-devel/packages/init.c (from r683, trunk/openbios-devel/modules/init.c)
==============================================================================
--- trunk/openbios-devel/modules/init.c	Mon Feb 22 19:52:34 2010	(r683, copy source)
+++ trunk/openbios-devel/packages/init.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -16,7 +16,7 @@
 
 #include "openbios/config.h"
 #include "openbios/kernel.h"
-#include "modules.h"
+#include "packages.h"
 
 void
 modules_init( void )
@@ -31,7 +31,7 @@
 	disklabel_init();
 #endif
 #ifdef CONFIG_FS
-	filesystem_init();
+	files_init();
 #endif
 #ifdef CONFIG_MAC_PARTS
 	macparts_init();

Copied and modified: trunk/openbios-devel/packages/mac-parts.c (from r683, trunk/openbios-devel/modules/mac-parts.c)
==============================================================================
--- trunk/openbios-devel/modules/mac-parts.c	Mon Feb 22 19:52:34 2010	(r683, copy source)
+++ trunk/openbios-devel/packages/mac-parts.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -17,7 +17,7 @@
 #include "openbios/config.h"
 #include "openbios/bindings.h"
 #include "mac-parts.h"
-#include "modules.h"
+#include "packages.h"
 
 #ifdef CONFIG_DEBUG_MAC_PARTS
 #define DPRINTF(fmt, args...) \

Copied: trunk/openbios-devel/packages/mac-parts.h (from r683, trunk/openbios-devel/modules/mac-parts.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/openbios-devel/packages/mac-parts.h	Sat Mar 13 11:58:19 2010	(r685, copy of r683, trunk/openbios-devel/modules/mac-parts.h)
@@ -0,0 +1,88 @@
+/*
+ *   Creation Date: <1999/07/06 15:45:12 samuel>
+ *   Time-stamp: <2002/10/20 16:31:48 samuel>
+ *
+ *	<partition_table.h>
+ *
+ *	Headers describing the partition table
+ *
+ *   Copyright (C) 1999, 2002 Samuel Rydh (samuel at ibrium.se)
+ *
+ *   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
+ *
+ */
+
+#ifndef _H_PARTITION_TABLE
+#define _H_PARTITION_TABLE
+
+/* This information is based upon IM vol V. */
+
+#define DESC_MAP_SIGNATURE	0x4552
+#define DESC_PART_SIGNATURE	0x504d
+
+enum {
+	kPartitionAUXIsValid         = 0x00000001,
+	kPartitionAUXIsAllocated     = 0x00000002,
+	kPartitionAUXIsInUse         = 0x00000004,
+	kPartitionAUXIsBootValid     = 0x00000008,
+	kPartitionAUXIsReadable      = 0x00000010,
+	kPartitionAUXIsWriteable     = 0x00000020,
+	kPartitionAUXIsBootCodePositionIndependent = 0x00000040,
+	kPartitionISMountedAtStartup = 0x40000000,
+	kPartitionIsStartup          = 0x80000000,
+	kPartitionIsChainCompatible  = 0x00000100,
+	kPartitionIsRealDeviceDriver = 0x00000200,
+	kPartitionCanChainToNext     = 0x00000400,
+};
+
+typedef struct {
+	long		ddBlock;		/* first block of driver */
+	short		ddSize;			/* driver size in blocks */
+	short		ddType;			/* 1 & -1 for SCSI */
+} driver_entry_t;
+
+typedef struct { /* Block 0 of a device */
+	short		sbSig;			/* always 0x4552 */
+	short		sbBlockSize;		/* 512 */
+	long		sbBlkCount;		/* #blocks on device */
+	short		sbDevType;    		/* 0 */
+	short		sbDevID;      		/* 0 */
+	long		sbData;      		/* 0 */
+	short		sbDrvrCount;		/* #driver descriptors */
+
+	/* driver entries goes here */
+	driver_entry_t	drivers[61] __attribute__ ((packed));
+
+	short		filler1;
+	long		filler2;
+} desc_map_t;
+
+typedef struct { /* Partition descriptor */
+	short		pmSig;			/* always 0x504d 'PM' */
+	short		pmSigPad;		/* 0 */
+	ulong		pmMapBlkCnt;		/* #blocks in partition map */
+	ulong		pmPyPartStart;		/* first physical block of part. */
+	ulong		pmPartBlkCnt;		/* #blocks in partition */
+	char		pmPartName[32];		/* partition name */
+	char		pmPartType[32];		/* partition type */
+
+	/* these fields may or may not be used */
+	ulong		pmLgDataStart;
+	ulong		pmDataCnt;
+	ulong		pmPartStatus;
+	ulong		pmLgBootStart;
+	ulong		pmBootSize;
+	ulong		pmBootLoad;
+	ulong		pmBootLoad2;
+	ulong		pmBootEntry;
+	ulong		pmBootEntry2;
+	ulong		pmBootCksum;
+	char		pmProcessor[16];
+
+	char		filler[376];		/* might contain extra information */
+} part_entry_t;
+
+
+#endif   /* _H_PARTITION_TABLE */

Copied and modified: trunk/openbios-devel/packages/misc-files.c (from r683, trunk/openbios-devel/modules/filesystems.c)
==============================================================================
--- trunk/openbios-devel/modules/filesystems.c	Mon Feb 22 19:52:34 2010	(r683, copy source)
+++ trunk/openbios-devel/packages/misc-files.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -19,7 +19,7 @@
 #include "openbios/bindings.h"
 #include "openbios/fs.h"
 #include "libc/diskio.h"
-#include "modules.h"
+#include "packages.h"
 
 #define PATHBUF_SIZE	256
 #define VOLNAME_SIZE	64
@@ -331,7 +331,7 @@
 
 
 void
-filesystem_init( void )
+files_init( void )
 {
 	REGISTER_NODE( files );
 }

Copied: trunk/openbios-devel/packages/nvram.c (from r683, trunk/openbios-devel/modules/nvram.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/openbios-devel/packages/nvram.c	Sat Mar 13 11:58:19 2010	(r685, copy of r683, trunk/openbios-devel/modules/nvram.c)
@@ -0,0 +1,305 @@
+/*
+ *   Creation Date: <2003/12/01 00:26:13 samuel>
+ *   Time-stamp: <2004/01/07 19:59:53 samuel>
+ *
+ *	<nvram.c>
+ *
+ *	medium-level NVRAM handling
+ *
+ *   Copyright (C) 2003, 2004 Samuel Rydh (samuel at ibrium.se)
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   version 2
+ *
+ */
+
+#include "openbios/config.h"
+#include "openbios/bindings.h"
+#include "openbios/nvram.h"
+
+#ifdef CONFIG_DEBUG_NVRAM
+#define DPRINTF(fmt, args...) \
+do { printk("NVRAM: " fmt , ##args); } while (0)
+#else
+#define DPRINTF(fmt, args...) do {} while(0)
+#endif
+
+#define DEF_SYSTEM_SIZE	0xc10
+
+#define NV_SIG_SYSTEM	0x70
+#define NV_SIG_FREE	0x7f
+
+
+typedef struct {
+	uchar		signature;
+	uchar		checksum;
+	uchar		len_hi;
+	uchar		len_lo;
+	char		name[12];
+	char		data[0];
+} nvpart_t;
+
+static struct {
+	char		*data;
+	int		size;
+
+	nvpart_t	*config;
+	int		config_size;
+} nvram;
+
+
+/************************************************************************/
+/*	generic								*/
+/************************************************************************/
+
+static unsigned int
+nvpart_checksum( nvpart_t* hdr )
+{
+	unsigned char *p = (unsigned char*)hdr;
+	int i, val = p[0];
+
+	for( i=2; i<16; i++ ) {
+		val += p[i];
+		if( val > 255 )
+			val = (val - 256 + 1) & 0xff;
+	}
+	return val;
+}
+
+static inline int
+nvpart_size( nvpart_t *p )
+{
+	return (p->len_lo | ((int)p->len_hi<<8)) * 16;
+}
+
+static int
+next_nvpart( nvpart_t **p )
+{
+	nvpart_t *end = (nvpart_t*)(nvram.data + nvram.size);
+	int len;
+
+	if( !*p ) {
+		*p = (nvpart_t*)nvram.data;
+		return 1;
+	}
+
+	if( !(len=nvpart_size(*p)) ) {
+		printk("invalid nvram partition length\n");
+		return -1;
+	}
+	*p = (nvpart_t*)((char*)*p + len);
+	if( *p < end )
+		return 1;
+	if( *p == end )
+		return 0;
+	return -1;
+}
+
+static void
+create_free_part( char *ptr, int size )
+{
+	nvpart_t *nvp = (nvpart_t*)ptr;
+	memset( nvp, 0, size );
+
+	strncpy( nvp->name, "777777777777", sizeof(nvp->name) );
+	nvp->signature = NV_SIG_FREE;
+	nvp->len_hi = (size /16) >> 8;
+	nvp->len_lo = size /16;
+	nvp->checksum = nvpart_checksum(nvp);
+}
+
+static int
+create_nv_part( int signature, const char *name, int size )
+{
+	nvpart_t *p = NULL;
+	int fs;
+
+	while( next_nvpart(&p) > 0 ) {
+		if( p->signature != NV_SIG_FREE )
+			continue;
+
+		fs = nvpart_size( p );
+		if( fs < size )
+			size = fs;
+		p->signature = signature;
+		memset( p->name, 0, sizeof(p->name) );
+		strncpy( p->name, name, sizeof(p->name) );
+		p->len_hi = (size>>8)/16;
+		p->len_lo = size/16;
+		p->checksum = nvpart_checksum(p);
+		if( fs > size ) {
+			char *fp = (char*)p + size;
+			create_free_part( fp, fs-size );
+		}
+		return size;
+	}
+	printk("create-failed\n");
+	return -1;
+}
+
+static void
+zap_nvram( void )
+{
+	create_free_part( nvram.data, nvram.size );
+	create_nv_part( NV_SIG_SYSTEM, "common", DEF_SYSTEM_SIZE );
+}
+
+#if 0
+static void
+show_partitions( void )
+{
+	nvpart_t *p = NULL;
+	char buf[13];
+
+	while( next_nvpart(&p) > 0 ) {
+		memcpy( buf, p->name, sizeof(p->name) );
+		buf[12] = 0;
+		printk("[%02x] %-13s:  %03x\n",
+		       p->signature, buf, nvpart_size(p));
+	}
+}
+#endif
+
+void
+update_nvram( void )
+{
+	PUSH( (ucell)nvram.config->data );
+	PUSH( nvram.config_size );
+	fword("nvram-store-configs");
+	arch_nvram_put( nvram.data );
+}
+
+void
+nvconf_init( void )
+{
+	int once=0;
+
+	/* initialize nvram structure completely */
+	nvram.config = NULL;
+	nvram.config_size = 0;
+
+	nvram.size = arch_nvram_size();
+	nvram.data = malloc( nvram.size );
+	arch_nvram_get( nvram.data );
+
+	bind_func( "update-nvram", update_nvram );
+
+	for( ;; ) {
+		nvpart_t *p = NULL;
+		int err;
+
+		while( (err=next_nvpart(&p)) > 0 ) {
+			if( nvpart_checksum(p) != p->checksum ) {
+				err = -1;
+				break;
+			}
+			if( p->signature == NV_SIG_SYSTEM ) {
+				nvram.config = p;
+				nvram.config_size = nvpart_size(p) - 0x10;
+
+				if( !once++ ) {
+					PUSH( (ucell)p->data );
+					PUSH( nvram.config_size );
+					fword("nvram-load-configs");
+				}
+			}
+		}
+		if( err || !nvram.config ) {
+			printk("nvram error detected, zapping pram\n");
+			zap_nvram();
+			if( !once++ )
+				fword("set-defaults");
+			continue;
+		}
+		break;
+	}
+}
+
+
+/************************************************************************/
+/*	nvram								*/
+/************************************************************************/
+
+typedef struct {
+	uint   mark_hi;
+	uint   mark_lo;
+} nvram_ibuf_t;
+
+DECLARE_UNNAMED_NODE( nvram, INSTALL_OPEN, sizeof(nvram_ibuf_t ));
+
+/* ( pos_lo pos_hi -- status ) */
+static void
+nvram_seek( nvram_ibuf_t *nd )
+{
+	int pos_hi = POP();
+	int pos_lo = POP();
+
+	DPRINTF("seek %08x %08x\n", pos_hi, pos_lo );
+	nd->mark_lo = pos_lo;
+	nd->mark_hi = pos_hi;
+
+	if( nd->mark_lo >= nvram.size ) {
+		PUSH(-1);
+		return;
+	}
+
+	/* 0=success, -1=failure (1=legacy success) */
+	PUSH(0);
+}
+
+/* ( addr len -- actual ) */
+static void
+nvram_read( nvram_ibuf_t *nd )
+{
+	int len = POP();
+	char *p = (char*)POP();
+	int n=0;
+
+	while( nd->mark_lo < nvram.size && n < len ) {
+		*p++ = nvram.data[nd->mark_lo++];
+		n++;
+	}
+	PUSH(n);
+	DPRINTF("read %08x %x -- %x\n", (int)p, len, n);
+}
+
+/* ( addr len -- actual ) */
+static void
+nvram_write( nvram_ibuf_t *nd )
+{
+	int len = POP();
+	char *p = (char*)POP();
+	int n=0;
+
+	while( nd->mark_lo < nvram.size && n < len ) {
+		nvram.data[nd->mark_lo++] = *p++;
+		n++;
+	}
+	PUSH(n);
+	DPRINTF("write %08x %x -- %x\n", (int)p, len, n );
+}
+
+/* ( -- size ) */
+static void
+nvram_size( __attribute__((unused)) nvram_ibuf_t *nd )
+{
+	DPRINTF("nvram_size %d\n", nvram.size);
+	PUSH( nvram.size );
+}
+
+NODE_METHODS( nvram ) = {
+	{ "size",	(void*)nvram_size	},
+	{ "read",	(void*)nvram_read	},
+	{ "write",	(void*)nvram_write	},
+	{ "seek",	(void*)nvram_seek	},
+};
+
+
+void
+nvram_init( const char *path )
+{
+	nvconf_init();
+
+	REGISTER_NAMED_NODE( nvram, path );
+}

Copied and modified: trunk/openbios-devel/packages/packages.h (from r683, trunk/openbios-devel/modules/modules.h)
==============================================================================
--- trunk/openbios-devel/modules/modules.h	Mon Feb 22 19:52:34 2010	(r683, copy source)
+++ trunk/openbios-devel/packages/packages.h	Sat Mar 13 11:58:19 2010	(r685)
@@ -2,9 +2,9 @@
  *   Creation Date: <2003/12/23 00:32:12 samuel>
  *   Time-stamp: <2003/12/28 14:47:02 samuel>
  *
- *	<modules.h>
+ *	<packages.h>
  *
- *	Module initialization
+ *	Package initialization
  *
  *   Copyright (C) 2003 Samuel Rydh (samuel at ibrium.se)
  *
@@ -19,7 +19,7 @@
 
 extern void	deblocker_init( void );
 extern void	disklabel_init( void );
-extern void	filesystem_init( void );
+extern void	files_init( void );
 extern void	macparts_init( void );
 extern void	pcparts_init( void );
 extern void	sunparts_init( void );

Copied and modified: trunk/openbios-devel/packages/pc-parts.c (from r683, trunk/openbios-devel/modules/pc-parts.c)
==============================================================================
--- trunk/openbios-devel/modules/pc-parts.c	Mon Feb 22 19:52:34 2010	(r683, copy source)
+++ trunk/openbios-devel/packages/pc-parts.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -15,7 +15,7 @@
 #include "openbios/config.h"
 #include "openbios/bindings.h"
 #include "libc/byteorder.h"
-#include "modules.h"
+#include "packages.h"
 
 typedef struct {
 	ullong		offs;

Copied and modified: trunk/openbios-devel/packages/sun-parts.c (from r683, trunk/openbios-devel/modules/sun-parts.c)
==============================================================================
--- trunk/openbios-devel/modules/sun-parts.c	Mon Feb 22 19:52:34 2010	(r683, copy source)
+++ trunk/openbios-devel/packages/sun-parts.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -15,7 +15,7 @@
 #include "openbios/config.h"
 #include "openbios/bindings.h"
 #include "libc/byteorder.h"
-#include "modules.h"
+#include "packages.h"
 
 #ifdef CONFIG_DEBUG_SUN_PARTS
 #define DPRINTF(fmt, args...)                   \

Copied: trunk/openbios-devel/packages/video.c (from r683, trunk/openbios-devel/modules/video.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/openbios-devel/packages/video.c	Sat Mar 13 11:58:19 2010	(r685, copy of r683, trunk/openbios-devel/modules/video.c)
@@ -0,0 +1,347 @@
+/*
+ *   Creation Date: <2002/10/23 20:26:40 samuel>
+ *   Time-stamp: <2004/01/07 19:39:15 samuel>
+ *
+ *	<video.c>
+ *
+ *	Mac-on-Linux display node
+ *
+ *   Copyright (C) 2002, 2003, 2004 Samuel Rydh (samuel at ibrium.se)
+ *
+ *   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
+ *
+ */
+
+#include "openbios/config.h"
+#include "openbios/bindings.h"
+#include "libc/diskio.h"
+#include "ofmem.h"
+#include "openbios/drivers.h"
+#include "video_subr.h"
+
+typedef struct osi_fb_info {
+    unsigned long mphys;
+    int rb, w, h, depth;
+} osi_fb_info_t;
+
+static struct {
+	int		has_video;
+	osi_fb_info_t	fb;
+	ulong		*pal;		/* 256 elements */
+} video;
+
+
+int
+video_get_res( int *w, int *h )
+{
+	if( !video.has_video ) {
+		*w = *h = 0;
+		return -1;
+	}
+	*w = video.fb.w;
+	*h = video.fb.h;
+	return 0;
+}
+
+static void
+startup_splash( void )
+{
+#ifdef CONFIG_MOL
+	int fd, s, i, y, x, dx, dy;
+	int width, height;
+	char *pp, *p;
+	char buf[64];
+#endif
+
+	/* only draw logo in 24-bit mode (for now) */
+	if( video.fb.depth < 15 )
+		return;
+#ifdef CONFIG_MOL
+	for( i=0; i<2; i++ ) {
+		if( !BootHGetStrResInd("bootlogo", buf, sizeof(buf), 0, i) )
+			return;
+		*(!i ? &width : &height) = atol(buf);
+	}
+
+	if( (s=width * height * 3) > 0x20000 )
+		return;
+
+	if( (fd=open_io("pseudo:,bootlogo")) >= 0 ) {
+		p = malloc( s );
+		if( read_io(fd, p, s) != s )
+			printk("bootlogo size error\n");
+		close_io( fd );
+
+		dx = (video.fb.w - width)/2;
+		dy = (video.fb.h - height)/3;
+
+		pp = (char*)video.fb.mphys + dy * video.fb.rb + dx * (video.fb.depth >= 24 ? 4 : 2);
+
+		for( y=0 ; y<height; y++, pp += video.fb.rb ) {
+			if( video.fb.depth >= 24 ) {
+				ulong *d = (ulong*)pp;
+				for( x=0; x<width; x++, p+=3, d++ )
+					*d = ((int)p[0] << 16) | ((int)p[1] << 8) | p[2];
+			} else if( video.fb.depth == 15 ) {
+				ushort *d = (ushort*)pp;
+				for( x=0; x<width; x++, p+=3, d++ ) {
+					int col = ((int)p[0] << 16) | ((int)p[1] << 8) | p[2];
+					*d = ((col>>9) & 0x7c00) | ((col>>6) & 0x03e0) | ((col>>3) & 0x1f);
+				}
+			}
+		}
+		free( p );
+	}
+#else
+	/* No bootlogo support yet on other platforms */
+	return;
+#endif
+}
+
+static ulong
+get_color( int col_ind )
+{
+	ulong col;
+	if( !video.has_video || col_ind < 0 || col_ind > 255 )
+		return 0;
+	if( video.fb.depth == 8 )
+		return col_ind;
+	col = video.pal[col_ind];
+	if( video.fb.depth == 24 || video.fb.depth == 32 )
+		return col;
+	if( video.fb.depth == 15 )
+		return ((col>>9) & 0x7c00) | ((col>>6) & 0x03e0) | ((col>>3) & 0x1f);
+	return 0;
+}
+
+void
+draw_pixel( int x, int y, int colind )
+{
+	char *p = (char*)video.fb.mphys + video.fb.rb * y;
+	int color, d = video.fb.depth;
+
+	if( x < 0 || y < 0 || x >= video.fb.w || y >=video.fb.h )
+		return;
+	color = get_color( colind );
+
+	if( d >= 24 )
+		*((ulong*)p + x) = color;
+	else if( d >= 15 )
+		*((short*)p + x) = color;
+	else
+		*(p + x) = color;
+}
+
+static void
+fill_rect( int col_ind, int x, int y, int w, int h )
+{
+	char *pp;
+	ulong col = get_color(col_ind);
+
+	if( !video.has_video || x < 0 || y < 0 || x+w > video.fb.w || y+h > video.fb.h )
+		return;
+
+	pp = (char*)video.fb.mphys + video.fb.rb * y;
+	for( ; h--; pp += video.fb.rb ) {
+		int ww = w;
+		if( video.fb.depth == 24 || video.fb.depth == 32 ) {
+			ulong *p = (ulong*)pp + x;
+			while( ww-- )
+				*p++ = col;
+		} else if( video.fb.depth == 16 || video.fb.depth == 15 ) {
+			ushort *p = (ushort*)pp + x;
+			while( ww-- )
+				*p++ = col;
+		} else {
+                        char *p = (char *)((ushort*)pp + x);
+
+			while( ww-- )
+				*p++ = col;
+		}
+	}
+}
+
+static void
+refresh_palette( void )
+{
+#ifdef CONFIG_MOL
+	if( video.fb.depth == 8 )
+		OSI_RefreshPalette();
+#endif
+}
+
+void
+set_color( int ind, ulong color )
+{
+	if( !video.has_video || ind < 0 || ind > 255 )
+		return;
+	video.pal[ind] = color;
+
+#ifdef CONFIG_MOL
+	if( video.fb.depth == 8 )
+		OSI_SetColor( ind, color );
+#elif defined(CONFIG_SPARC32)
+	if( video.fb.depth == 8 ) {
+            dac[0] = ind << 24;
+            dac[1] = ((color >> 16) & 0xff) << 24; // Red
+            dac[1] = ((color >> 8) & 0xff) << 24; // Green
+            dac[1] = (color & 0xff) << 24; // Blue
+        }
+#else
+	vga_set_color(ind, ((color >> 16) & 0xff),
+			   ((color >> 8) & 0xff),
+			   (color & 0xff));
+#endif
+}
+
+void
+video_scroll( int height )
+{
+	int i, offs, size, *dest, *src;
+
+	offs = video.fb.rb * height;
+	size = (video.fb.h * video.fb.rb - offs)/16;
+	dest = (int*)video.fb.mphys;
+	src = (int*)(video.fb.mphys + offs);
+
+	for( i=0; i<size; i++ ) {
+		dest[0] = src[0];
+		dest[1] = src[1];
+		dest[2] = src[2];
+		dest[3] = src[3];
+		dest += 4;
+		src += 4;
+	}
+}
+
+/************************************************************************/
+/*	OF methods							*/
+/************************************************************************/
+
+DECLARE_NODE( video, INSTALL_OPEN, 0, "Tdisplay" );
+
+/* ( -- width height ) (?) */
+static void
+video_dimensions( void )
+{
+	int w, h;
+	(void) video_get_res( &w, &h );
+	PUSH( w );
+	PUSH( h );
+}
+
+/* ( table start count -- ) (?) */
+static void
+video_set_colors( void )
+{
+	int count = POP();
+	int start = POP();
+	uchar *p = (uchar*)POP();
+	int i;
+
+	for( i=0; i<count; i++, p+=3 ) {
+		ulong col = (p[0] << 16) | (p[1] << 8) | p[2];
+		set_color( i + start, col );
+	}
+	refresh_palette();
+}
+
+/* ( r g b index -- ) */
+static void
+video_color_bang( void )
+{
+	int index = POP();
+	int b = POP();
+	int g = POP();
+	int r = POP();
+	ulong col = ((r << 16) & 0xff0000) | ((g << 8) & 0x00ff00) | (b & 0xff);
+	/* printk("color!: %08lx %08lx %08lx %08lx\n", r, g, b, index ); */
+	set_color( index, col );
+	refresh_palette();
+}
+
+/* ( color_ind x y width height -- ) (?) */
+static void
+video_fill_rect( void )
+{
+	int h = POP();
+	int w = POP();
+	int y = POP();
+	int x = POP();
+	int color_ind = POP();
+
+	fill_rect( color_ind, x, y, w, h );
+}
+
+/* ( addr len -- actual ) */
+static void
+video_write(void)
+{
+    char *addr;
+    int len;
+
+    len = GETTOS();
+    addr = pop_fstr_copy();
+
+    console_draw_str(addr);
+    free(addr);
+    PUSH(len);
+}
+
+NODE_METHODS( video ) = {
+	{"dimensions",		video_dimensions	},
+	{"set-colors",		video_set_colors	},
+	{"fill-rectangle",	video_fill_rect		},
+	{"color!",		video_color_bang	},
+	{"write",		video_write		},
+};
+
+
+/************************************************************************/
+/*	init 								*/
+/************************************************************************/
+
+void
+init_video( unsigned long fb,  int width, int height, int depth, int rb )
+{
+	int i, s, size;
+	phandle_t ph=0;
+
+	video.fb.mphys = fb;
+	video.fb.w = width;
+	video.fb.h = height;
+	video.fb.depth = depth;
+	video.fb.rb = rb;
+	while( (ph=dt_iterate_type(ph, "display")) ) {
+		set_property( ph, "width", (char*)&video.fb.w, 4 );
+		set_property( ph, "height", (char*)&video.fb.h, 4 );
+		set_property( ph, "depth", (char*)&video.fb.depth, 4 );
+		set_property( ph, "linebytes", (char*)&video.fb.rb, 4 );
+		set_property( ph, "address", (char*)&video.fb.mphys, 4 );
+	}
+	video.has_video = 1;
+	video.pal = malloc( 256 * sizeof(ulong) );
+
+	s = (video.fb.mphys & 0xfff);
+	size = ((video.fb.h * video.fb.rb + s) + 0xfff) & ~0xfff;
+	s = video.fb.mphys - s;
+
+#ifdef CONFIG_PPC
+	ofmem_claim_phys( video.fb.mphys, size, 0 );
+	ofmem_claim_virt( video.fb.mphys, size, 0 );
+	ofmem_map( video.fb.mphys, video.fb.mphys, size, -1 );
+#endif
+
+	for( i=0; i<256; i++ )
+		set_color( i, i * 0x010101 );
+
+	set_color( 254, 0xffffcc );
+	fill_rect( 254, 0, 0, video.fb.w, video.fb.h );
+
+	refresh_palette();
+	startup_splash();
+
+	REGISTER_NODE( video );
+}

Copied and modified: trunk/openbios-devel/packages/xcoff-loader.c (from r683, trunk/openbios-devel/modules/xcoff-loader.c)
==============================================================================
--- trunk/openbios-devel/modules/xcoff-loader.c	Mon Feb 22 19:52:34 2010	(r683, copy source)
+++ trunk/openbios-devel/packages/xcoff-loader.c	Sat Mar 13 11:58:19 2010	(r685)
@@ -16,7 +16,7 @@
 
 #include "openbios/config.h"
 #include "openbios/bindings.h"
-#include "modules.h"
+#include "packages.h"
 #include "ofmem.h"
 
 #include "openbios/xcoff.h"



More information about the OpenBIOS mailing list