Changeset b7b5f83 in mainline
- Timestamp:
- 2006-07-03T19:46:13Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b95b717
- Parents:
- d22645e
- Files:
-
- 9 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ppc32/loader/ofw.c
rd22645e rb7b5f83 34 34 ofw_write(str, len); 35 35 } 36 37 int ofw_keyboard(keyboard_t *keyboard) 38 { 39 char device_name[BUF_SIZE]; 40 41 if (ofw_get_property(ofw_aliases, "macio", device_name, sizeof(device_name)) <= 0) 42 return false; 43 44 phandle device = ofw_find_device(device_name); 45 if (device == -1) 46 return false; 47 48 pci_reg_t macio; 49 if (ofw_get_property(device, "assigned-addresses", &macio, sizeof(macio)) <= 0) 50 return false; 51 keyboard->addr = (void *) macio.addr.addr_lo; 52 keyboard->size = macio.size_lo; 53 54 return true; 55 } -
arch/ppc64/loader/ofw.c
rd22645e rb7b5f83 30 30 #include <printf.h> 31 31 32 void write(const char *str, const longlen)32 void write(const char *str, const int len) 33 33 { 34 34 ofw_write(str, len); 35 35 } 36 37 int ofw_keyboard(keyboard_t *keyboard) 38 { 39 char device_name[BUF_SIZE]; 40 41 if (ofw_get_property(ofw_aliases, "macio", device_name, sizeof(device_name)) <= 0) 42 return false; 43 44 phandle device = ofw_find_device(device_name); 45 if (device == -1) 46 return false; 47 48 pci_reg_t macio; 49 if (ofw_get_property(device, "assigned-addresses", &macio, sizeof(macio)) <= 0) 50 return false; 51 keyboard->addr = (void *) macio.addr.addr_lo; 52 keyboard->size = macio.size_lo; 53 54 return true; 55 } -
arch/sparc64/Makefile.inc
rd22645e rb7b5f83 32 32 33 33 image.iso: kernel 34 make -C arch/$(ARCH)/loader COMPILER=$(COMPILER) KERNELDIR=../../../$(KERNELDIR) USPACEDIR=../../../$(USPACEDIR) IMAGE=$(CONFIG_IMAGE) 34 35 mkdir -p $(TMP)/boot 35 36 mkdir -p $(TMP)/kernel -
genarch/ofw.c
rd22645e rb7b5f83 32 32 33 33 #define MAX_OFW_ARGS 10 34 #define BUF_SIZE 102435 36 typedef unsigned int ofw_arg_t;37 typedef unsigned int ihandle;38 typedef unsigned int phandle;39 34 40 35 /** OpenFirmware command structure … … 50 45 typedef void (*ofw_entry)(ofw_args_t *); 51 46 52 53 typedef struct {54 unsigned int info;55 unsigned int addr_hi;56 unsigned int addr_lo;57 } pci_addr_t;58 59 typedef struct {60 pci_addr_t addr;61 unsigned int size_hi;62 unsigned int size_lo;63 } pci_reg_t;64 65 66 47 ofw_entry ofw; 67 48 … … 100 81 101 82 102 staticphandle ofw_find_device(const char *name)83 phandle ofw_find_device(const char *name) 103 84 { 104 85 return ofw_call("finddevice", 1, 1, NULL, name); … … 106 87 107 88 108 staticint ofw_get_property(const phandle device, const char *name, const void *buf, const int buflen)89 int ofw_get_property(const phandle device, const char *name, const void *buf, const int buflen) 109 90 { 110 91 return ofw_call("getprop", 4, 1, NULL, device, name, buf, buflen); … … 205 186 int ofw_memmap(memmap_t *map) 206 187 { 207 unsigned intbuf[BUF_SIZE];208 int ret = ofw_get_property(ofw_memory, "reg", buf, sizeof( unsigned int) * BUF_SIZE);188 unsigned long buf[BUF_SIZE]; 189 int ret = ofw_get_property(ofw_memory, "reg", buf, sizeof(buf)); 209 190 if (ret <= 0) 210 191 return false; … … 216 197 map->total = 0; 217 198 map->count = 0; 218 for (pos = 0; (pos < ret / sizeof(unsigned int)) && (map->count < MEMMAP_MAX_RECORDS); pos += ac + sc) {199 for (pos = 0; (pos < ret / sizeof(unsigned long)) && (map->count < MEMMAP_MAX_RECORDS); pos += ac + sc) { 219 200 void * start = (void *) buf[pos + ac - 1]; 220 201 unsigned int size = buf[pos + ac + sc - 1]; … … 234 215 char device_name[BUF_SIZE]; 235 216 236 if (ofw_get_property(ofw_aliases, "screen", device_name, sizeof( char) * BUF_SIZE) <= 0)217 if (ofw_get_property(ofw_aliases, "screen", device_name, sizeof(device_name)) <= 0) 237 218 return false; 238 219 … … 259 240 } 260 241 261 262 int ofw_keyboard(keyboard_t *keyboard)263 {264 char device_name[BUF_SIZE];265 266 if (ofw_get_property(ofw_aliases, "macio", device_name, sizeof(char) * BUF_SIZE) <= 0)267 return false;268 269 phandle device = ofw_find_device(device_name);270 if (device == -1)271 return false;272 273 pci_reg_t macio;274 if (ofw_get_property(device, "assigned-addresses", &macio, sizeof(macio)) <= 0)275 return false;276 277 keyboard->addr = (void *) macio.addr.addr_lo;278 keyboard->size = macio.size_lo;279 280 return true;281 } -
genarch/ofw.h
rd22645e rb7b5f83 30 30 #define __OFW_H__ 31 31 32 #define NULL 0 33 #define MEMMAP_MAX_RECORDS 32 34 #define false 0 35 #define true 1 32 #include <types.h> 33 #include <stdarg.h> 36 34 37 typedef __builtin_va_list va_list; 35 #define BUF_SIZE 1024 38 36 39 #define va_start(ap, last) __builtin_va_start(ap, last) 40 #define va_arg(ap, type) __builtin_va_arg(ap, type) 41 #define va_end(ap) __builtin_va_end(ap) 37 #define MEMMAP_MAX_RECORDS 32 42 38 43 39 typedef struct { … … 65 61 } keyboard_t; 66 62 63 typedef struct { 64 unsigned int info; 65 unsigned int addr_hi; 66 unsigned int addr_lo; 67 } pci_addr_t; 68 69 typedef struct { 70 pci_addr_t addr; 71 unsigned int size_hi; 72 unsigned int size_lo; 73 } pci_reg_t; 74 75 typedef unsigned long ofw_arg_t; 76 typedef unsigned int ihandle; 77 typedef unsigned int phandle; 78 79 extern phandle ofw_aliases; 67 80 68 81 extern void init(void); 69 82 extern void ofw_write(const char *str, const int len); 83 84 extern int ofw_get_property(const phandle device, const char *name, const void *buf, const int buflen); 85 extern phandle ofw_find_device(const char *name); 70 86 71 87 extern void *ofw_translate(const void *virt);
Note:
See TracChangeset
for help on using the changeset viewer.