mirror of
				https://gitlab.com/qemu-project/openbios.git
				synced 2024-02-13 08:34:06 +08:00 
			
		
		
		
	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@siriusit.co.uk> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@685 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
		 Mark Cave-Ayland
					Mark Cave-Ayland
				
			
				
					committed by
					
						 Mark Cave-Ayland
						Mark Cave-Ayland
					
				
			
			
				
	
			
			
			 Mark Cave-Ayland
						Mark Cave-Ayland
					
				
			
						parent
						
							0d5f749065
						
					
				
				
					commit
					dbf16392cc
				
			| @ -44,5 +44,5 @@ endmenu | ||||
|  | ||||
| source "kernel/Kconfig" | ||||
| source "forth/Kconfig" | ||||
| source "modules/Kconfig" | ||||
| source "libopenbios/Kconfig" | ||||
| source "drivers/Kconfig" | ||||
|  | ||||
| @ -18,5 +18,5 @@ endmenu | ||||
|  | ||||
| source "kernel/Kconfig" | ||||
| source "forth/Kconfig" | ||||
| source "modules/Kconfig" | ||||
| source "libopenbios/Kconfig" | ||||
| source "drivers/Kconfig" | ||||
|  | ||||
| @ -44,5 +44,5 @@ endmenu | ||||
|  | ||||
| source "kernel/Kconfig" | ||||
| source "forth/Kconfig" | ||||
| source "modules/Kconfig" | ||||
| source "libopenbios/Kconfig" | ||||
| source "drivers/Kconfig" | ||||
|  | ||||
| @ -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"/> | ||||
|  | ||||
| @ -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" | ||||
|  | ||||
| @ -39,6 +39,5 @@ int PearPC_GetFBInfo( osi_fb_info_t *fb ) | ||||
|  | ||||
| #define openbios_GetFBInfo(x) PearPC_GetFBInfo(x) | ||||
|  | ||||
| #include "../../../modules/video.c" | ||||
|  | ||||
| #include "../../../modules/console.c" | ||||
| #include "../../../packages/video.c" | ||||
| #include "../../../libopenbios/console_common.c" | ||||
|  | ||||
| @ -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"/> | ||||
|  | ||||
| @ -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"/> | ||||
|  | ||||
| @ -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"/> | ||||
|  | ||||
| @ -43,5 +43,5 @@ endmenu | ||||
|  | ||||
| source "kernel/Kconfig" | ||||
| source "forth/Kconfig" | ||||
| source "modules/Kconfig" | ||||
| source "libopenbios/Kconfig" | ||||
| source "drivers/Kconfig" | ||||
|  | ||||
| @ -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"/> | ||||
|  | ||||
| @ -19,5 +19,5 @@ typedef struct osi_fb_info { | ||||
| 	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" | ||||
|  | ||||
| @ -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"/> | ||||
|  | ||||
| @ -177,7 +177,8 @@ for RULES_ARCH in $*; do | ||||
|     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 | ||||
|  | ||||
| @ -15,14 +15,14 @@ void vga_vbe_set_mode(int width, int height, int depth); | ||||
| 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); | ||||
|  | ||||
| @ -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> | ||||
| 
 | ||||
| @ -1,124 +0,0 @@ | ||||
| \ tag: Utility functions | ||||
| \  | ||||
| \ deblocker / filesystem support | ||||
| \  | ||||
| \ Copyright (C) 2003, 2004 Samuel Rydh | ||||
| \  | ||||
| \ See the file "COPYING" for further information about | ||||
| \ the copyright and warranty status of this work. | ||||
| \  | ||||
|  | ||||
| dev /packages | ||||
|  | ||||
| \ ------------------------------------------------------------- | ||||
| \ /packages/disk-label (partition handling) | ||||
| \ ------------------------------------------------------------- | ||||
|  | ||||
| [IFDEF] CONFIG_DISK_LABEL | ||||
|    | ||||
| new-device | ||||
|   " disk-label" device-name | ||||
|   external | ||||
|  | ||||
|   variable part-handlers      \ list with (probe-xt, phandle) elements | ||||
|   variable fs-handlers        \ list with (fs-probe-xt, phandle) elements | ||||
|    | ||||
|   : find-part-handler ( block0 -- phandle | 0 ) | ||||
|     >r part-handlers | ||||
|     begin list-get while | ||||
|       ( nextlist dictptr ) | ||||
|       r@ over @ execute if | ||||
|         ( nextlist dictptr ) | ||||
|         na1+ @ r> rot 2drop exit | ||||
|       then | ||||
|       drop | ||||
|     repeat | ||||
|     r> drop 0 | ||||
|   ; | ||||
|  | ||||
|   : find-filesystem ( ih -- ph | 0 ) | ||||
|     >r fs-handlers | ||||
|     begin list-get while | ||||
|       ( nextlist dictptr ) | ||||
|       r@ over @ execute if | ||||
|         ( nextlist dictptr ) | ||||
|         na1+ @ r> rot 2drop exit | ||||
|       then | ||||
|       drop | ||||
|     repeat | ||||
|     r> drop 0 | ||||
|   ; | ||||
|  | ||||
|   : register-part-handler ( handler-ph -- ) | ||||
|     dup " probe" rot find-method | ||||
|     0= abort" Missing probe method!" | ||||
|     ( phandle probe-xt ) | ||||
|     part-handlers list-add , , | ||||
|   ; | ||||
|  | ||||
|   : register-fs-handler ( handler-ph -- ) | ||||
|     dup " probe" rot find-method | ||||
|     0= abort" Missing probe method!" | ||||
|     ( phandle probe-xt ) | ||||
|     fs-handlers list-add , , | ||||
|   ; | ||||
| finish-device | ||||
|  | ||||
| \ --------------------------------------------------------------------------- | ||||
| \ methods to register partion and filesystem packages used by disk-label | ||||
| \ --------------------------------------------------------------------------- | ||||
|  | ||||
| device-end | ||||
| : register-partition-package ( -- ) | ||||
|   " register-part-handler" " disk-label" $find-package-method ?dup if | ||||
|     active-package swap execute | ||||
|   else | ||||
|     ." [disk-label] internal error" cr | ||||
|   then | ||||
| ; | ||||
|  | ||||
| : register-fs-package ( -- ) | ||||
|   " register-fs-handler" " disk-label" $find-package-method ?dup if   | ||||
|     active-package swap execute | ||||
|   else | ||||
|     ." [misc-files] internal error" cr | ||||
|   then | ||||
| ; | ||||
|  | ||||
| [THEN] | ||||
| device-end | ||||
|  | ||||
|  | ||||
| \ ------------------------------------------------------------- | ||||
| \ command line editor (/packages/cmdline) | ||||
| \ ------------------------------------------------------------- | ||||
|  | ||||
| [IFDEF] CONFIG_CMDLINE | ||||
|  | ||||
| dev /packages | ||||
| new-device | ||||
|   " cmdline" device-name | ||||
|  | ||||
|   :noname | ||||
|     " " [active-package], open-package | ||||
|     ?dup if | ||||
|       " cmdline" rot $call-method | ||||
|     else | ||||
|       ." cmdline is missing!" cr | ||||
|     then | ||||
|     \ cmdline must close itself upon return | ||||
|   ; | ||||
|  | ||||
|   :noname | ||||
|     [ ['] (lit) , swap , ] to outer-interpreter | ||||
|   ; SYSTEM-initializer | ||||
|  | ||||
|   external | ||||
|   : prepare 0 to my-self ; | ||||
|  | ||||
| finish-device | ||||
|  | ||||
| [THEN] | ||||
|  | ||||
|  | ||||
| device-end | ||||
| @ -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" | ||||
| 
 | ||||
| @ -16,7 +16,7 @@ | ||||
| 
 | ||||
| #include "openbios/config.h" | ||||
| #include "openbios/bindings.h" | ||||
| #include "modules.h" | ||||
| #include "packages.h" | ||||
| #include "libc/vsprintf.h" | ||||
| 
 | ||||
| typedef struct { | ||||
| @ -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; | ||||
| @ -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
 | ||||
| 
 | ||||
| @ -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" | ||||
| @ -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 @@ modules_init( void ) | ||||
| 	disklabel_init(); | ||||
| #endif | ||||
| #ifdef CONFIG_FS | ||||
| 	filesystem_init(); | ||||
| 	files_init(); | ||||
| #endif | ||||
| #ifdef CONFIG_MAC_PARTS | ||||
| 	macparts_init(); | ||||
| @ -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...) \ | ||||
| @ -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 @@ NODE_METHODS( files ) = { | ||||
| 
 | ||||
| 
 | ||||
| void | ||||
| filesystem_init( void ) | ||||
| files_init( void ) | ||||
| { | ||||
| 	REGISTER_NODE( files ); | ||||
| } | ||||
| @ -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@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 ); | ||||
| @ -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; | ||||
| @ -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...)                   \ | ||||
| @ -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" | ||||
		Reference in New Issue
	
	Block a user