summaryrefslogtreecommitdiffstats
path: root/qemu/roms/openbios/include/libopenbios
diff options
context:
space:
mode:
Diffstat (limited to 'qemu/roms/openbios/include/libopenbios')
-rw-r--r--qemu/roms/openbios/include/libopenbios/aout_load.h27
-rw-r--r--qemu/roms/openbios/include/libopenbios/bindings.h156
-rw-r--r--qemu/roms/openbios/include/libopenbios/bootcode_load.h22
-rw-r--r--qemu/roms/openbios/include/libopenbios/bootinfo_load.h26
-rw-r--r--qemu/roms/openbios/include/libopenbios/console.h25
-rw-r--r--qemu/roms/openbios/include/libopenbios/elf_load.h31
-rw-r--r--qemu/roms/openbios/include/libopenbios/fcode_load.h24
-rw-r--r--qemu/roms/openbios/include/libopenbios/fontdata.h28
-rw-r--r--qemu/roms/openbios/include/libopenbios/forth_load.h24
-rw-r--r--qemu/roms/openbios/include/libopenbios/initprogram.h22
-rw-r--r--qemu/roms/openbios/include/libopenbios/ipchecksum.h7
-rw-r--r--qemu/roms/openbios/include/libopenbios/load.h22
-rw-r--r--qemu/roms/openbios/include/libopenbios/of.h22
-rw-r--r--qemu/roms/openbios/include/libopenbios/ofmem.h145
-rw-r--r--qemu/roms/openbios/include/libopenbios/openbios.h22
-rw-r--r--qemu/roms/openbios/include/libopenbios/sys_info.h38
-rw-r--r--qemu/roms/openbios/include/libopenbios/video.h36
-rw-r--r--qemu/roms/openbios/include/libopenbios/xcoff_load.h27
18 files changed, 704 insertions, 0 deletions
diff --git a/qemu/roms/openbios/include/libopenbios/aout_load.h b/qemu/roms/openbios/include/libopenbios/aout_load.h
new file mode 100644
index 000000000..b462e1c86
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/aout_load.h
@@ -0,0 +1,27 @@
+/*
+ * Creation Date: <2010/03/22 18:00:00 mcayland>
+ * Time-stamp: <2010/03/22 18:00:00 mcayland>
+ *
+ * <aout_load.h>
+ *
+ * a.out loader
+ *
+ * Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland@siriusit.co.uk)
+ *
+ * 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_AOUTLOAD
+#define _H_AOUTLOAD
+
+#include "arch/common/a.out.h"
+#include "libopenbios/sys_info.h"
+
+extern int is_aout(struct exec *ehdr);
+extern int aout_load(struct sys_info *info, ihandle_t dev);
+extern void aout_init_program(void);
+
+#endif /* _H_AOUTLOAD */
diff --git a/qemu/roms/openbios/include/libopenbios/bindings.h b/qemu/roms/openbios/include/libopenbios/bindings.h
new file mode 100644
index 000000000..de9c77520
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/bindings.h
@@ -0,0 +1,156 @@
+/*
+ * Creation Date: <2003/12/19 23:09:56 samuel>
+ * Time-stamp: <2004/01/07 19:36:42 samuel>
+ *
+ * <bindings.h>
+ *
+ * Forth bindings
+ *
+ * Copyright (C) 2003, 2004 Samuel Rydh (samuel@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
+ *
+ */
+
+#ifndef _H_BINDINGS
+#define _H_BINDINGS
+
+#include "kernel/stack.h"
+#include "kernel/kernel.h"
+
+#define PUSH3(a,b,c) do { PUSH((a)); PUSH((b)); PUSH((c)); } while(0)
+#define PUSH2(a,b) do { PUSH((a)); PUSH((b)); } while(0)
+#define RET( v ) do { PUSH(v); return; } while(0)
+
+/* initialization */
+extern int initialize_forth( void );
+
+/* panic */
+extern int forth_segv_handler( char *segv_addr );
+
+/* active package */
+extern phandle_t find_dev( const char *path );
+extern phandle_t get_cur_dev( void );
+extern phandle_t activate_device( const char *str );
+extern void device_end( void );
+extern void activate_dev( phandle_t ph );
+
+
+/* ihandle related */
+extern phandle_t ih_to_phandle( ihandle_t ih );
+extern ihandle_t my_parent( void );
+extern ihandle_t my_self( void );
+extern char *my_args_copy( void );
+
+extern xt_t find_package_method( const char *meth, phandle_t ph );
+extern xt_t find_ih_method( const char *method, ihandle_t ih );
+extern xt_t find_parent_method( const char *method );
+extern void call_package( xt_t xt, ihandle_t ihandle );
+extern void call_parent( xt_t xt );
+extern void call_parent_method( const char *method );
+
+/* package */
+extern ihandle_t open_package( const char *argstr, phandle_t ph );
+extern ihandle_t open_dev( const char *spec );
+extern void close_package( ihandle_t ih );
+extern void close_dev( ihandle_t ih );
+
+/* property access */
+extern void set_property( phandle_t ph, const char *name,
+ const char *buf, int len );
+extern void set_int_property( phandle_t ph, const char *name,
+ u32 val );
+extern u32 get_int_property( phandle_t ph, const char *name,
+ int *retlen );
+extern char *get_property( phandle_t ph, const char *name,
+ int *retlen );
+
+/* device tree iteration */
+extern phandle_t dt_iter_begin( void );
+extern phandle_t dt_iterate( phandle_t last_tree );
+extern phandle_t dt_iterate_type( phandle_t last_tree,
+ const char *type );
+static inline phandle_t dt_find_type( const char *type ) {
+ return dt_iterate_type( 0, type );
+}
+
+/* forth bindings */
+extern cell feval( const char *str );
+extern void bind_xtfunc( const char *name, xt_t xt,
+ ucell arg, void (*func)(void) );
+extern void bind_func( const char *name, void (*func)(void) );
+extern xt_t bind_noname_func( void (*func)(void) );
+extern void push_str( const char *str );
+extern char *pop_fstr_copy( void );
+
+extern int _fword( const char *word, xt_t *cache_xt );
+extern cell _eword( const char *word, xt_t *cache_xt, int nargs );
+extern int _selfword( const char *method, xt_t *cache_xt );
+extern int _parword( const char *method, xt_t *cache_xt );
+
+#define fword(w) ({ static xt_t cache_xt = 0; _fword(w, &cache_xt); })
+#define eword(w, nargs) ({ static xt_t cache_xt = 0; _eword(w, &cache_xt, nargs); })
+#define selfword(w) ({ static xt_t cache_xt = 0; _selfword(w, &cache_xt); })
+#define parword(w) ({ static xt_t cache_xt = 0; _parword(w, &cache_xt); })
+
+extern void throw( int error );
+
+
+/* node bindings */
+extern void make_openable( int only_parents );
+
+
+typedef struct {
+ const char *name;
+ void *func;
+} method_t;
+
+#define REGISTER_NAMED_NODE( name, path ) do { \
+ bind_new_node( name##_flags_, name##_size_, \
+ path, name##_m, sizeof(name##_m)/sizeof(method_t)); \
+ } while(0)
+
+#define REGISTER_NAMED_NODE_PHANDLE( name, path, phandle ) do { \
+ phandle = \
+ bind_new_node( name##_flags_, name##_size_, \
+ path, name##_m, sizeof(name##_m)/sizeof(method_t)); \
+ } while(0)
+
+#define REGISTER_NODE_METHODS( name, path ) do { \
+ const char *paths[1]; \
+ \
+ paths[0] = path; \
+ bind_node( name##_flags_, name##_size_, \
+ paths, 1, name##_m, sizeof(name##_m)/sizeof(method_t)); \
+ } while(0)
+
+#define DECLARE_UNNAMED_NODE( name, flags, size ) \
+static const int name##_flags_ = flags; \
+static const int name##_size_ = size;
+
+#define DECLARE_NODE( name, flags, size, paths... ) \
+static const char * const name##_p[] = { paths }; \
+DECLARE_UNNAMED_NODE(name, flags, size)
+
+#define NODE_METHODS( name ) \
+static const method_t name##_m[]
+
+#define REGISTER_NODE( name ) do { \
+ bind_node( name##_flags_, name##_size_, \
+ name##_p, sizeof(name##_p)/sizeof(char*), \
+ name##_m, sizeof(name##_m)/sizeof(method_t) ); \
+ } while(0)
+
+extern void bind_node( int flags, int size, const char * const *paths, int npaths,
+ const method_t *methods, int nmethods );
+
+extern phandle_t bind_new_node( int flags, int size, const char *name,
+ const method_t *methods, int nmethods );
+
+#define INSTALL_OPEN 1 /* install trivial open and close methods */
+
+
+
+#endif /* _H_BINDINGS */
diff --git a/qemu/roms/openbios/include/libopenbios/bootcode_load.h b/qemu/roms/openbios/include/libopenbios/bootcode_load.h
new file mode 100644
index 000000000..147783ae0
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/bootcode_load.h
@@ -0,0 +1,22 @@
+/*
+ * Creation Date: <2010/03/22 18:00:00 mcayland>
+ * Time-stamp: <2010/03/22 18:00:00 mcayland>
+ *
+ * <bootcode_load.h>
+ *
+ * Raw bootcode (%BOOT) loader
+ *
+ * Copyright (C) 2013 Mark Cave-Ayland (mark.cave-ayland@ilande.co.uk)
+ *
+ * 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_BOOTCODELOAD
+#define _H_BOOTCODELOAD
+
+extern int bootcode_load(ihandle_t dev);
+
+#endif /* _H__H_BOOTCODELOAD */
diff --git a/qemu/roms/openbios/include/libopenbios/bootinfo_load.h b/qemu/roms/openbios/include/libopenbios/bootinfo_load.h
new file mode 100644
index 000000000..1905a5e99
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/bootinfo_load.h
@@ -0,0 +1,26 @@
+/*
+ * Creation Date: <2010/03/22 18:00:00 mcayland>
+ * Time-stamp: <2010/03/22 18:00:00 mcayland>
+ *
+ * <bootinfo_load.h>
+ *
+ * CHRP boot info loader
+ *
+ * Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland@siriusit.co.uk)
+ *
+ * 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_BOOTINFOLOAD
+#define _H_BOOTINFOLOAD
+
+#include "libopenbios/sys_info.h"
+
+extern int is_bootinfo(char *bootinfo);
+extern int bootinfo_load(struct sys_info *info, const char *filename);
+extern void bootinfo_init_program(void);
+
+#endif /* _H_BOOTINFOLOAD */
diff --git a/qemu/roms/openbios/include/libopenbios/console.h b/qemu/roms/openbios/include/libopenbios/console.h
new file mode 100644
index 000000000..899dab831
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/console.h
@@ -0,0 +1,25 @@
+/*
+ * <console.h>
+ *
+ * Shared console routines
+ *
+ * Copyright (C) 2013 Mark Cave-Ayland (mark.cave-ayland@ilande.co.uk)
+ *
+ * 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_CONSOLE
+#define _H_CONSOLE
+
+struct _console_ops {
+ int (*putchar)(int c);
+ int (*availchar)(void);
+ int (*getchar)(void);
+};
+
+void init_console(struct _console_ops ops);
+
+#endif /* _H_CONSOLE */
diff --git a/qemu/roms/openbios/include/libopenbios/elf_load.h b/qemu/roms/openbios/include/libopenbios/elf_load.h
new file mode 100644
index 000000000..d3876241f
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/elf_load.h
@@ -0,0 +1,31 @@
+/*
+ * Creation Date: <2001/05/05 16:44:17 samuel>
+ * Time-stamp: <2003/10/22 23:18:42 samuel>
+ *
+ * <elfload.h>
+ *
+ * Elf loader
+ *
+ * Copyright (C) 2001, 2003 Samuel Rydh (samuel@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_ELFLOAD
+#define _H_ELFLOAD
+
+#include "arch/common/elf.h"
+#include "asm/elf.h"
+#include "libopenbios/sys_info.h"
+
+extern int elf_load(struct sys_info *info, ihandle_t dev, const char *cmdline, void **boot_notes);
+extern void elf_init_program(void);
+extern int is_elf(Elf_ehdr *ehdr);
+extern int find_elf(Elf_ehdr *ehdr);
+
+extern Elf_phdr * elf_readhdrs(int offset, Elf_ehdr *ehdr);
+
+#endif /* _H_ELFLOAD */
diff --git a/qemu/roms/openbios/include/libopenbios/fcode_load.h b/qemu/roms/openbios/include/libopenbios/fcode_load.h
new file mode 100644
index 000000000..a84ac982b
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/fcode_load.h
@@ -0,0 +1,24 @@
+/*
+ * Creation Date: <2010/03/22 18:00:00 mcayland>
+ * Time-stamp: <2010/03/22 18:00:00 mcayland>
+ *
+ * <fcode_load.h>
+ *
+ * Fcode loader
+ *
+ * Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland@siriusit.co.uk)
+ *
+ * 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_FCODELOAD
+#define _H_FCODELOAD
+
+extern int is_fcode(unsigned char *fcode);
+extern int fcode_load(ihandle_t dev);
+extern void fcode_init_program(void);
+
+#endif /* _H_FCODELOAD */
diff --git a/qemu/roms/openbios/include/libopenbios/fontdata.h b/qemu/roms/openbios/include/libopenbios/fontdata.h
new file mode 100644
index 000000000..1f8f0de32
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/fontdata.h
@@ -0,0 +1,28 @@
+/* Font definitions */
+
+#ifndef OPENBIOS_FONTDATA_H
+#define OPENBIOS_FONTDATA_H
+
+#define FONTDATAMAX_8X8 2048
+#define FONT_WIDTH_8X8 8
+#define FONT_HEIGHT_8X8 8
+
+extern const unsigned char fontdata_8x8[FONTDATAMAX_8X8];
+
+#define FONTDATAMAX_8X16 4096
+#define FONT_WIDTH_8X16 8
+#define FONT_HEIGHT_8X16 16
+
+extern const unsigned char fontdata_8x16[FONTDATAMAX_8X16];
+
+#if defined(CONFIG_FONT_8X8)
+#define fontdata fontdata_8x8
+#define FONT_HEIGHT FONT_HEIGHT_8X8
+#define FONT_WIDTH FONT_WIDTH_8X8
+#elif defined(CONFIG_FONT_8X16)
+#define fontdata fontdata_8x16
+#define FONT_HEIGHT FONT_HEIGHT_8X16
+#define FONT_WIDTH FONT_WIDTH_8X16
+#endif
+
+#endif /* OPENBIOS_FONTDATA_H */
diff --git a/qemu/roms/openbios/include/libopenbios/forth_load.h b/qemu/roms/openbios/include/libopenbios/forth_load.h
new file mode 100644
index 000000000..a39d414c7
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/forth_load.h
@@ -0,0 +1,24 @@
+/*
+ * Creation Date: <2010/03/22 18:00:00 mcayland>
+ * Time-stamp: <2010/03/22 18:00:00 mcayland>
+ *
+ * <forth_load.h>
+ *
+ * Forth loader
+ *
+ * Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland@siriusit.co.uk)
+ *
+ * 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_FORTHLOAD
+#define _H_FORTHLOAD
+
+extern int is_forth(char *forth);
+extern int forth_load(ihandle_t dev);
+extern void forth_init_program(void);
+
+#endif /* _H_FORTHLOAD */
diff --git a/qemu/roms/openbios/include/libopenbios/initprogram.h b/qemu/roms/openbios/include/libopenbios/initprogram.h
new file mode 100644
index 000000000..1684f5d9b
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/initprogram.h
@@ -0,0 +1,22 @@
+/*
+ * Creation Date: <2010/04/02 13:00:00 mcayland>
+ * Time-stamp: <2010/04/02 13:00:00 mcayland>
+ *
+ * <initprogram.h>
+ *
+ * C implementation of (init-program) word
+ *
+ * Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland@siriusit.co.uk)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2
+ *
+ */
+
+#ifndef _H_INITPROGRAM
+#define _H_INITPROGRAM
+
+extern void init_program(void);
+
+#endif /* _H_INITPROGRAM */
diff --git a/qemu/roms/openbios/include/libopenbios/ipchecksum.h b/qemu/roms/openbios/include/libopenbios/ipchecksum.h
new file mode 100644
index 000000000..24cc1d744
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/ipchecksum.h
@@ -0,0 +1,7 @@
+#ifndef IPCHECKSUM_H
+#define IPCHECKSUM_H
+
+unsigned short ipchksum(const void *data, unsigned long length);
+unsigned short add_ipchksums(unsigned long offset, unsigned short sum, unsigned short new);
+
+#endif /* IPCHECKSUM_H */
diff --git a/qemu/roms/openbios/include/libopenbios/load.h b/qemu/roms/openbios/include/libopenbios/load.h
new file mode 100644
index 000000000..2a4d97f3e
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/load.h
@@ -0,0 +1,22 @@
+/*
+ * Creation Date: <2010/06/25 20:00:00 mcayland>
+ * Time-stamp: <2010/06/25 20:00:00 mcayland>
+ *
+ * <load.h>
+ *
+ * C implementation of load
+ *
+ * Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland@siriusit.co.uk)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2
+ *
+ */
+
+#ifndef _H_LOAD
+#define _H_LOAD
+
+extern void load(ihandle_t dev);
+
+#endif /* _H_LOAD */
diff --git a/qemu/roms/openbios/include/libopenbios/of.h b/qemu/roms/openbios/include/libopenbios/of.h
new file mode 100644
index 000000000..64cf6d080
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/of.h
@@ -0,0 +1,22 @@
+/*
+ * Creation Date: <2004/01/07 19:19:18 samuel>
+ * Time-stamp: <2004/01/07 19:19:48 samuel>
+ *
+ * <of.h>
+ *
+ * OpenFirmware related defines
+ *
+ * Copyright (C) 2004 Samuel Rydh (samuel@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
+ *
+ */
+
+#ifndef _H_OF
+#define _H_OF
+
+extern int of_client_interface( int *params );
+
+#endif /* _H_OF */
diff --git a/qemu/roms/openbios/include/libopenbios/ofmem.h b/qemu/roms/openbios/include/libopenbios/ofmem.h
new file mode 100644
index 000000000..0b19db1ca
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/ofmem.h
@@ -0,0 +1,145 @@
+/*
+ * Creation Date: <1999/11/16 00:47:06 samuel>
+ * Time-stamp: <2003/10/18 13:28:14 samuel>
+ *
+ * <ofmem.h>
+ *
+ *
+ *
+ * Copyright (C) 1999, 2002 Samuel Rydh (samuel@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_OFMEM
+#define _H_OFMEM
+
+#include "kernel/stack.h"
+
+typedef struct alloc_desc {
+ struct alloc_desc *next;
+ ucell size; /* size (including) this struct */
+} alloc_desc_t;
+
+typedef struct mem_range {
+ struct mem_range *next;
+ phys_addr_t start; /* sizeof(phys) >= sizeof(virt), e.g SPARC32 */
+ ucell size;
+} range_t;
+
+typedef struct trans {
+ struct trans *next;
+ ucell virt; /* chain is sorted by virt */
+ ucell size;
+ phys_addr_t phys;
+ ucell mode;
+} translation_t;
+
+/* ofmem private data */
+typedef struct {
+ ucell ramsize;
+ char *next_malloc;
+ alloc_desc_t *mfree; /* list of free malloc blocks */
+
+ range_t *phys_range;
+ range_t *virt_range;
+ range_t *io_range;
+
+ translation_t *trans; /* this is really a translation_t */
+} ofmem_t;
+
+/* structure for retained data */
+typedef struct {
+ ucell magic;
+ ucell numentries;
+ range_t retain_phys_range[8]; /* physical memory that should survive a warm reset */
+} retain_t;
+
+/* TODO: temporary migration interface */
+extern ofmem_t* ofmem_arch_get_private(void);
+extern void* ofmem_arch_get_malloc_base(void);
+extern ucell ofmem_arch_get_heap_top(void);
+extern ucell ofmem_arch_get_virt_top(void);
+extern ucell ofmem_arch_get_iomem_base(void);
+extern ucell ofmem_arch_get_iomem_top(void);
+extern retain_t* ofmem_arch_get_retained(void);
+extern int ofmem_arch_get_physaddr_cellsize(void);
+extern int ofmem_arch_encode_physaddr(ucell *p, phys_addr_t value);
+extern int ofmem_arch_get_available_entry_size(phandle_t ph);
+extern void ofmem_arch_create_available_entry(phandle_t ph, ucell *availentry, phys_addr_t start, ucell size);
+extern int ofmem_arch_get_translation_entry_size(void);
+extern void ofmem_arch_create_translation_entry(ucell *transentry, translation_t *t);
+extern ucell ofmem_arch_default_translation_mode( phys_addr_t phys );
+extern ucell ofmem_arch_io_translation_mode( phys_addr_t phys );
+extern void ofmem_arch_map_pages(phys_addr_t phys, ucell virt, ucell size,
+ ucell mode);
+extern void ofmem_arch_unmap_pages(ucell virt, ucell size);
+/* sparc64 uses this method */
+extern int ofmem_map_page_range( phys_addr_t phys, ucell virt, ucell size,
+ ucell mode );
+
+/* Private functions for mapping between physical/virtual addresses */
+extern phys_addr_t va2pa(unsigned long va);
+extern unsigned long pa2va(phys_addr_t pa);
+
+/* malloc interface */
+extern int ofmem_posix_memalign( void **memptr, size_t alignment, size_t size );
+extern void* ofmem_malloc( size_t size );
+extern void ofmem_free( void *ptr );
+extern void* ofmem_realloc( void *ptr, size_t size );
+
+/* ofmem_common.c */
+
+extern void ofmem_cleanup( void );
+extern void ofmem_init( void );
+
+/*
+ * register /memory and /virtual-memory handles
+ * ofmem module will update "available" and "translations" properties
+ * using these handles
+ *
+ * to disable updating /memory properties pass zero memory handle
+ */
+extern void ofmem_register( phandle_t ph_memory, phandle_t ph_mmu );
+
+extern ucell ofmem_claim( ucell addr, ucell size, ucell align );
+extern phys_addr_t ofmem_claim_phys( phys_addr_t mphys, ucell size, ucell align );
+extern ucell ofmem_claim_virt( ucell mvirt, ucell size, ucell align );
+extern ucell ofmem_claim_io( ucell virt, ucell size, ucell align );
+
+extern phys_addr_t ofmem_retain( phys_addr_t phys, ucell size, ucell align );
+
+extern int ofmem_map( phys_addr_t phys, ucell virt, ucell size, ucell mode );
+extern int ofmem_unmap( ucell virt, ucell size );
+extern ucell ofmem_map_io( phys_addr_t phys, ucell size );
+
+extern void ofmem_release( ucell virt, ucell size );
+extern void ofmem_release_phys( phys_addr_t phys, ucell size );
+extern void ofmem_release_virt( ucell virt, ucell size );
+extern void ofmem_release_io( ucell virt, ucell size );
+extern phys_addr_t ofmem_translate( ucell virt, ucell *ret_mode );
+
+/* memory and virtual-memory nodes */
+extern phandle_t s_phandle_memory;
+extern phandle_t s_phandle_mmu;
+
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE - 1))
+#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
+
+#if defined(CONFIG_DEBUG_OFMEM)
+ #define DEBUG_OFMEM 1
+#else
+ #define DEBUG_OFMEM 0
+#endif
+
+#define OFMEM_TRACE(fmt, ...) do { \
+ if (DEBUG_OFMEM) { \
+ printk("OFMEM: " fmt, ## __VA_ARGS__); \
+ } \
+} while (0);
+
+#endif /* _H_OFMEM */
diff --git a/qemu/roms/openbios/include/libopenbios/openbios.h b/qemu/roms/openbios/include/libopenbios/openbios.h
new file mode 100644
index 000000000..394ed4484
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/openbios.h
@@ -0,0 +1,22 @@
+/*
+ * Creation Date: <2010/04/02 12:00:00 mcayland>
+ * Time-stamp: <2010/04/02 12:00:00 mcayland>
+ *
+ * <openbios.h>
+ *
+ * General OpenBIOS initialization
+ *
+ * Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland@siriusit.co.uk)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2
+ *
+ */
+
+#ifndef _H_LIBOPENBIOS
+#define _H_LIBOPENBIOS
+
+extern void openbios_init( void );
+
+#endif /* _H_LIBOPENBIOS */
diff --git a/qemu/roms/openbios/include/libopenbios/sys_info.h b/qemu/roms/openbios/include/libopenbios/sys_info.h
new file mode 100644
index 000000000..a8b3cce37
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/sys_info.h
@@ -0,0 +1,38 @@
+#ifndef SYS_INFO_H
+#define SYS_INFO_H
+
+/* Information collected from firmware/bootloader */
+
+struct sys_info {
+ /* Values passed by bootloader */
+ unsigned long boot_type;
+ unsigned long boot_data;
+ unsigned long boot_arg;
+
+ const char *firmware; /* "PCBIOS", "LinuxBIOS", etc. */
+ const char *command_line; /* command line given to us */
+
+ /* memory map */
+ int n_memranges;
+ struct memrange {
+ unsigned long long base;
+ unsigned long long size;
+ } *memrange;
+ unsigned long *dict_start;
+ unsigned long *dict_end;
+ cell dict_limit;
+ ucell *dict_last;
+};
+
+extern void *elf_boot_notes;
+extern struct sys_info sys_info;
+
+void collect_elfboot_info(struct sys_info *info);
+void collect_linuxbios_info(struct sys_info *info);
+
+/* Our name and version. I want to see single instance of these in the image */
+extern const char *program_name, *program_version;
+
+#define LOADER_NOT_SUPPORT 0xbadf11e
+
+#endif /* SYS_INFO_H */
diff --git a/qemu/roms/openbios/include/libopenbios/video.h b/qemu/roms/openbios/include/libopenbios/video.h
new file mode 100644
index 000000000..44d74564f
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/video.h
@@ -0,0 +1,36 @@
+
+#ifdef CONFIG_VGA_WIDTH
+#define VGA_DEFAULT_WIDTH CONFIG_VGA_WIDTH
+#else
+#define VGA_DEFAULT_WIDTH 800
+#endif
+
+#ifdef CONFIG_VGA_HEIGHT
+#define VGA_DEFAULT_HEIGHT CONFIG_VGA_HEIGHT
+#else
+#define VGA_DEFAULT_HEIGHT 600
+#endif
+
+#ifdef CONFIG_VGA_DEPTH
+#define VGA_DEFAULT_DEPTH CONFIG_VGA_DEPTH
+#else
+#define VGA_DEFAULT_DEPTH 8
+#endif
+
+#define VGA_DEFAULT_LINEBYTES (VGA_DEFAULT_WIDTH*((VGA_DEFAULT_DEPTH+7)/8))
+
+void setup_video(void);
+unsigned long video_get_color(int col_ind);
+void video_mask_blit(void);
+void video_invert_rect(void);
+void video_fill_rect(void);
+
+extern struct video_info {
+ volatile ihandle_t *ih;
+ volatile ucell *mvirt;
+ volatile ucell *rb, *w, *h, *depth;
+
+ volatile ucell *pal; /* 256 elements */
+} video;
+
+#define VIDEO_DICT_VALUE(x) (*(ucell *)(x))
diff --git a/qemu/roms/openbios/include/libopenbios/xcoff_load.h b/qemu/roms/openbios/include/libopenbios/xcoff_load.h
new file mode 100644
index 000000000..2ec693d60
--- /dev/null
+++ b/qemu/roms/openbios/include/libopenbios/xcoff_load.h
@@ -0,0 +1,27 @@
+/*
+ * Creation Date: <2010/03/22 18:00:00 mcayland>
+ * Time-stamp: <2010/03/22 18:00:00 mcayland>
+ *
+ * <xcoff_load.h>
+ *
+ * XCOFF loader
+ *
+ * Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland@siriusit.co.uk)
+ *
+ * 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_XCOFFLOAD
+#define _H_XCOFFLOAD
+
+#include "arch/common/xcoff.h"
+#include "libopenbios/sys_info.h"
+
+extern int is_xcoff(COFF_filehdr_t *fhdr);
+extern int xcoff_load(struct sys_info *info, const char *filename);
+extern void xcoff_init_program(void);
+
+#endif /* _H_XCOFFLOAD */