diff options
author | Florian Lohoff <flo@rfc822.org> | 2008-11-29 12:16:56 +0000 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-04-26 15:26:27 +0200 |
commit | 7b4ca7013c58a67f1ec41478b1bfc250b3485d28 (patch) | |
tree | f759f75d5ac13dda6c581c3f6357d976b6cb593a /snilib/sniprom.h | |
parent | 4ce5705be57a10598775d14cc1b8a6296df9c653 (diff) |
Add basic SNIRM support
Add basic SNIRM support - Currently has a hardcoded boot location but
you get the idea.
Diffstat (limited to 'snilib/sniprom.h')
-rw-r--r-- | snilib/sniprom.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/snilib/sniprom.h b/snilib/sniprom.h new file mode 100644 index 0000000..db079ad --- /dev/null +++ b/snilib/sniprom.h @@ -0,0 +1,59 @@ + +#include <subarch.h> + +#define PROM_VEC KSEG1ADDR(0x1fc00000) +#define PROM_ENTRY(x) (PROM_VEC + (x*8)) + +#define PROM_RESET 0 +#define PROM_OPEN 6 +#define PROM_READ 7 +#define PROM_WRITE 8 +//#define PROM_SEEK 8 +#define PROM_PUTCHAR 12 +#define PROM_FLUSHCACHE 28 +#define PROM_CLEARCACHE 29 +#define PROM_GETENV 33 +#define PROM_GET_MEMCONF 58 + + +typedef struct { + unsigned int size; + unsigned int base; + unsigned int size2; + unsigned int pad1; + unsigned int pad2; +} MEMBANK; + +typedef struct { + MEMBANK bank[8]; +} MEMCONF; + +static inline int __prom_get_memconf(MEMCONF *mc) { + return ((int (*)(MEMCONF *))PROM_ENTRY(PROM_GET_MEMCONF))(mc); +} + +static inline int __prom_putchar(char a) { + return ((int (*)(int))PROM_ENTRY(PROM_PUTCHAR))(a); +} + +static inline int __prom_open(char *filename, int mode) { + return ((int (*)(char *, int))PROM_ENTRY(PROM_OPEN))(filename, mode); +} + +static inline int __prom_write(FILE stream, char *buf, unsigned long len) { + return ((int (*)(FILE, char *, unsigned long))PROM_ENTRY(PROM_WRITE)) + (stream, buf, len); +} + +static inline int __prom_read(FILE stream, char *buf, unsigned long len) { + return ((int (*)(FILE, char *, unsigned long))PROM_ENTRY(PROM_READ)) + (stream, buf, len); +} + +static inline void __prom_reset(void ) { + ((void (*)(void ))PROM_ENTRY(PROM_RESET))(); +} + +static inline void __prom_flushcache(void) { + ((void (*)(void ))PROM_ENTRY(PROM_FLUSHCACHE))(); +} |