Changes in uspace/srv/bd/rd/rd.c [15f3c3f:b5daa89] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/rd/rd.c
r15f3c3f rb5daa89 55 55 #include <ipc/bd.h> 56 56 #include <macros.h> 57 58 #define NAME "rd" 57 #include <inttypes.h> 58 59 #define NAME "rd" 59 60 60 61 /** Pointer to the ramdisk's image */ … … 208 209 static bool rd_init(void) 209 210 { 210 int ret = sysinfo_get_value("rd.size", &rd_size); 211 if ((ret != EOK) || (rd_size == 0)) { 211 sysarg_t size; 212 int ret = sysinfo_get_value("rd.size", &size); 213 if ((ret != EOK) || (size == 0)) { 212 214 printf("%s: No RAM disk found\n", NAME); 213 215 return false; 214 216 } 215 217 216 sysarg_t rd_ph_addr;217 ret = sysinfo_get_value("rd.address.physical", & rd_ph_addr);218 if ((ret != EOK) || ( rd_ph_addr== 0)) {218 sysarg_t addr_phys; 219 ret = sysinfo_get_value("rd.address.physical", &addr_phys); 220 if ((ret != EOK) || (addr_phys == 0)) { 219 221 printf("%s: Invalid RAM disk physical address\n", NAME); 220 222 return false; 221 223 } 222 224 225 rd_size = ALIGN_UP(size, block_size); 223 226 rd_addr = as_get_mappable_page(rd_size); 224 227 225 int flags = AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE; 226 int retval = physmem_map((void *) rd_ph_addr, rd_addr, 228 unsigned int flags = 229 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE; 230 ret = physmem_map((void *) addr_phys, rd_addr, 227 231 ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, flags); 228 229 if (retval < 0) { 232 if (ret < 0) { 230 233 printf("%s: Error mapping RAM disk\n", NAME); 231 234 return false; 232 235 } 233 236 234 printf("%s: Found RAM disk at %p, % zubytes\n", NAME,235 (void *) rd_ph_addr, rd_size);236 237 int rc= loc_server_register(NAME, rd_connection);238 if (r c< 0) {239 printf("%s: Unable to register driver (%d)\n", NAME, r c);237 printf("%s: Found RAM disk at %p, %" PRIun " bytes\n", NAME, 238 (void *) addr_phys, size); 239 240 ret = loc_server_register(NAME, rd_connection); 241 if (ret < 0) { 242 printf("%s: Unable to register driver (%d)\n", NAME, ret); 240 243 return false; 241 244 } 242 245 243 246 service_id_t service_id; 244 if (loc_service_register("bd/initrd", &service_id) != EOK) { 247 ret = loc_service_register("bd/initrd", &service_id); 248 if (ret != EOK) { 245 249 printf("%s: Unable to register device service\n", NAME); 246 250 return false;
Note:
See TracChangeset
for help on using the changeset viewer.