/boot/trunk/arch/ppc64/loader/ofw.c |
---|
29,27 → 29,7 |
#include <ofw.h> |
#include <printf.h> |
void write(const char *str, const int len) |
void write(const char *str, const long len) |
{ |
ofw_write(str, len); |
} |
int ofw_keyboard(keyboard_t *keyboard) |
{ |
char device_name[BUF_SIZE]; |
if (ofw_get_property(ofw_aliases, "macio", device_name, sizeof(device_name)) <= 0) |
return false; |
phandle device = ofw_find_device(device_name); |
if (device == -1) |
return false; |
pci_reg_t macio; |
if (ofw_get_property(device, "assigned-addresses", &macio, sizeof(macio)) <= 0) |
return false; |
keyboard->addr = (void *) macio.addr.addr_lo; |
keyboard->size = macio.size_lo; |
return true; |
} |
/boot/trunk/arch/ppc32/loader/ofw.c |
---|
33,23 → 33,3 |
{ |
ofw_write(str, len); |
} |
int ofw_keyboard(keyboard_t *keyboard) |
{ |
char device_name[BUF_SIZE]; |
if (ofw_get_property(ofw_aliases, "macio", device_name, sizeof(device_name)) <= 0) |
return false; |
phandle device = ofw_find_device(device_name); |
if (device == -1) |
return false; |
pci_reg_t macio; |
if (ofw_get_property(device, "assigned-addresses", &macio, sizeof(macio)) <= 0) |
return false; |
keyboard->addr = (void *) macio.addr.addr_lo; |
keyboard->size = macio.size_lo; |
return true; |
} |
/boot/trunk/arch/sparc64/loader/ofw.c |
---|
File deleted |
/boot/trunk/arch/sparc64/loader/Makefile |
---|
File deleted |
/boot/trunk/arch/sparc64/loader/pack |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/boot/trunk/arch/sparc64/loader/asm.S |
---|
File deleted |
/boot/trunk/arch/sparc64/loader/boot.S |
---|
File deleted |
/boot/trunk/arch/sparc64/loader/main.c |
---|
File deleted |
/boot/trunk/arch/sparc64/loader/asm.h |
---|
File deleted |
/boot/trunk/arch/sparc64/loader/types.h |
---|
File deleted |
/boot/trunk/arch/sparc64/loader/main.h |
---|
File deleted |
/boot/trunk/arch/sparc64/Makefile.inc |
---|
31,7 → 31,6 |
build: image.iso |
image.iso: kernel |
make -C arch/$(ARCH)/loader COMPILER=$(COMPILER) KERNELDIR=../../../$(KERNELDIR) USPACEDIR=../../../$(USPACEDIR) IMAGE=$(CONFIG_IMAGE) |
mkdir -p $(TMP)/boot |
mkdir -p $(TMP)/kernel |
cat arch/$(ARCH)/silo/silo.tar.gz | (cd $(TMP)/boot; tar xvfz -) |
/boot/trunk/genarch/ofw.h |
---|
29,12 → 29,16 |
#ifndef __OFW_H__ |
#define __OFW_H__ |
#include <types.h> |
#include <stdarg.h> |
#define NULL 0 |
#define MEMMAP_MAX_RECORDS 32 |
#define false 0 |
#define true 1 |
#define BUF_SIZE 1024 |
typedef __builtin_va_list va_list; |
#define MEMMAP_MAX_RECORDS 32 |
#define va_start(ap, last) __builtin_va_start(ap, last) |
#define va_arg(ap, type) __builtin_va_arg(ap, type) |
#define va_end(ap) __builtin_va_end(ap) |
typedef struct { |
void *start; |
60,30 → 64,10 |
unsigned int size; |
} keyboard_t; |
typedef struct { |
unsigned int info; |
unsigned int addr_hi; |
unsigned int addr_lo; |
} pci_addr_t; |
typedef struct { |
pci_addr_t addr; |
unsigned int size_hi; |
unsigned int size_lo; |
} pci_reg_t; |
typedef unsigned long ofw_arg_t; |
typedef unsigned int ihandle; |
typedef unsigned int phandle; |
extern phandle ofw_aliases; |
extern void init(void); |
extern void ofw_write(const char *str, const int len); |
extern int ofw_get_property(const phandle device, const char *name, const void *buf, const int buflen); |
extern phandle ofw_find_device(const char *name); |
extern void *ofw_translate(const void *virt); |
extern int ofw_map(const void *phys, const void *virt, const int size, const int mode); |
extern int ofw_memmap(memmap_t *map); |
/boot/trunk/genarch/ofw.c |
---|
31,7 → 31,12 |
#include <asm.h> |
#define MAX_OFW_ARGS 10 |
#define BUF_SIZE 1024 |
typedef unsigned int ofw_arg_t; |
typedef unsigned int ihandle; |
typedef unsigned int phandle; |
/** OpenFirmware command structure |
* |
*/ |
44,6 → 49,20 |
typedef void (*ofw_entry)(ofw_args_t *); |
typedef struct { |
unsigned int info; |
unsigned int addr_hi; |
unsigned int addr_lo; |
} pci_addr_t; |
typedef struct { |
pci_addr_t addr; |
unsigned int size_hi; |
unsigned int size_lo; |
} pci_reg_t; |
ofw_entry ofw; |
phandle ofw_chosen; |
80,13 → 99,13 |
} |
phandle ofw_find_device(const char *name) |
static phandle ofw_find_device(const char *name) |
{ |
return ofw_call("finddevice", 1, 1, NULL, name); |
} |
int ofw_get_property(const phandle device, const char *name, const void *buf, const int buflen) |
static int ofw_get_property(const phandle device, const char *name, const void *buf, const int buflen) |
{ |
return ofw_call("getprop", 4, 1, NULL, device, name, buf, buflen); |
} |
185,8 → 204,8 |
int ofw_memmap(memmap_t *map) |
{ |
unsigned long buf[BUF_SIZE]; |
int ret = ofw_get_property(ofw_memory, "reg", buf, sizeof(buf)); |
unsigned int buf[BUF_SIZE]; |
int ret = ofw_get_property(ofw_memory, "reg", buf, sizeof(unsigned int) * BUF_SIZE); |
if (ret <= 0) |
return false; |
196,7 → 215,7 |
int pos; |
map->total = 0; |
map->count = 0; |
for (pos = 0; (pos < ret / sizeof(unsigned long)) && (map->count < MEMMAP_MAX_RECORDS); pos += ac + sc) { |
for (pos = 0; (pos < ret / sizeof(unsigned int)) && (map->count < MEMMAP_MAX_RECORDS); pos += ac + sc) { |
void * start = (void *) buf[pos + ac - 1]; |
unsigned int size = buf[pos + ac + sc - 1]; |
214,7 → 233,7 |
{ |
char device_name[BUF_SIZE]; |
if (ofw_get_property(ofw_aliases, "screen", device_name, sizeof(device_name)) <= 0) |
if (ofw_get_property(ofw_aliases, "screen", device_name, sizeof(char) * BUF_SIZE) <= 0) |
return false; |
phandle device = ofw_find_device(device_name); |
239,3 → 258,24 |
return true; |
} |
int ofw_keyboard(keyboard_t *keyboard) |
{ |
char device_name[BUF_SIZE]; |
if (ofw_get_property(ofw_aliases, "macio", device_name, sizeof(char) * BUF_SIZE) <= 0) |
return false; |
phandle device = ofw_find_device(device_name); |
if (device == -1) |
return false; |
pci_reg_t macio; |
if (ofw_get_property(device, "assigned-addresses", &macio, sizeof(macio)) <= 0) |
return false; |
keyboard->addr = (void *) macio.addr.addr_lo; |
keyboard->size = macio.size_lo; |
return true; |
} |