33,9 → 33,9 |
#define MAX_OFW_ARGS 10 |
#define BUF_SIZE 1024 |
|
typedef unsigned int ofw_arg_t; |
typedef unsigned int ihandle; |
typedef unsigned int phandle; |
typedef unsigned long ofw_arg_t; |
typedef unsigned long ihandle; |
typedef unsigned long phandle; |
|
/** OpenFirmware command structure |
* |
42,8 → 42,8 |
*/ |
typedef struct { |
const char *service; /**< Command name */ |
unsigned int nargs; /**< Number of in arguments */ |
unsigned int nret; /**< Number of out arguments */ |
unsigned long nargs; /**< Number of in arguments */ |
unsigned long nret; /**< Number of out arguments */ |
ofw_arg_t args[MAX_OFW_ARGS]; /**< List of arguments */ |
} ofw_args_t; |
|
60,11 → 60,11 |
phandle ofw_aliases; |
|
|
static int ofw_call(const char *service, const int nargs, const int nret, ofw_arg_t *rets, ...) |
static long ofw_call(const char *service, const long nargs, const long nret, ofw_arg_t *rets, ...) |
{ |
va_list list; |
ofw_args_t args; |
int i; |
long i; |
|
args.service = service; |
args.nargs = nargs; |
93,15 → 93,15 |
} |
|
|
static int ofw_get_property(const phandle device, const char *name, const void *buf, const int buflen) |
static long ofw_get_property(const phandle device, const char *name, const void *buf, const long buflen) |
{ |
return ofw_call("getprop", 4, 1, NULL, device, name, buf, buflen); |
} |
|
|
static unsigned int ofw_get_address_cells(const phandle device) |
static unsigned long ofw_get_address_cells(const phandle device) |
{ |
unsigned int ret; |
unsigned long ret; |
|
if (ofw_get_property(device, "#address-cells", &ret, sizeof(ret)) <= 0) |
if (ofw_get_property(ofw_root, "#address-cells", &ret, sizeof(ret)) <= 0) |
111,9 → 111,9 |
} |
|
|
static unsigned int ofw_get_size_cells(const phandle device) |
static unsigned long ofw_get_size_cells(const phandle device) |
{ |
unsigned int ret; |
unsigned long ret; |
|
if (ofw_get_property(device, "#size-cells", &ret, sizeof(ret)) <= 0) |
if (ofw_get_property(ofw_root, "#size-cells", &ret, sizeof(ret)) <= 0) |
163,7 → 163,7 |
} |
|
|
void ofw_write(const char *str, const int len) |
void ofw_write(const char *str, const long len) |
{ |
if (ofw_stdout == 0) |
return; |
184,28 → 184,28 |
} |
|
|
int ofw_map(const void *phys, const void *virt, const int size, const int mode) |
long ofw_map(const void *phys, const void *virt, const long size, const long mode) |
{ |
return ofw_call("call-method", 6, 1, NULL, "map", ofw_mmu, mode, size, virt, phys); |
} |
|
|
int ofw_memmap(memmap_t *map) |
long ofw_memmap(memmap_t *map) |
{ |
unsigned int buf[BUF_SIZE]; |
int ret = ofw_get_property(ofw_memory, "reg", buf, sizeof(unsigned int) * BUF_SIZE); |
unsigned long buf[BUF_SIZE]; |
long ret = ofw_get_property(ofw_memory, "reg", buf, sizeof(unsigned long) * BUF_SIZE); |
if (ret <= 0) |
return false; |
|
unsigned int ac = ofw_get_address_cells(ofw_memory); |
unsigned int sc = ofw_get_size_cells(ofw_memory); |
unsigned long ac = ofw_get_address_cells(ofw_memory); |
unsigned long sc = ofw_get_size_cells(ofw_memory); |
|
int pos; |
long pos; |
map->total = 0; |
map->count = 0; |
for (pos = 0; (pos < ret / sizeof(unsigned int)) && (map->count < MEMMAP_MAX_RECORDS); pos += ac + sc) { |
for (pos = 0; (pos < ret / sizeof(unsigned long)) && (map->count < MEMMAP_MAX_RECORDS); pos += ac + sc) { |
void * start = (void *) buf[pos + ac - 1]; |
unsigned int size = buf[pos + ac + sc - 1]; |
unsigned long size = buf[pos + ac + sc - 1]; |
|
if (size > 0) { |
map->zones[map->count].start = start; |
217,7 → 217,7 |
} |
|
|
int ofw_screen(screen_t *screen) |
long ofw_screen(screen_t *screen) |
{ |
char device_name[BUF_SIZE]; |
|