Changes in uspace/srv/bd/rd/rd.c [15f3c3f:f302586] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/rd/rd.c
r15f3c3f rf302586 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 */ … … 104 105 unsigned int flags; 105 106 if (async_share_out_receive(&callid, &comm_size, &flags)) { 106 fs_va = as_get_mappable_page(comm_size); 107 if (fs_va) { 108 (void) async_share_out_finalize(callid, fs_va); 109 } else { 107 (void) async_share_out_finalize(callid, &fs_va); 108 if (fs_va == (void *) -1) { 110 109 async_answer_0(callid, EHANGUP); 111 110 return; … … 208 207 static bool rd_init(void) 209 208 { 210 int ret = sysinfo_get_value("rd.size", &rd_size); 211 if ((ret != EOK) || (rd_size == 0)) { 209 sysarg_t size; 210 int ret = sysinfo_get_value("rd.size", &size); 211 if ((ret != EOK) || (size == 0)) { 212 212 printf("%s: No RAM disk found\n", NAME); 213 213 return false; 214 214 } 215 215 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)) {216 sysarg_t addr_phys; 217 ret = sysinfo_get_value("rd.address.physical", &addr_phys); 218 if ((ret != EOK) || (addr_phys == 0)) { 219 219 printf("%s: Invalid RAM disk physical address\n", NAME); 220 220 return false; 221 221 } 222 222 223 rd_ addr = as_get_mappable_page(rd_size);224 225 int flags =AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE;226 int retval = physmem_map((void *) rd_ph_addr, rd_addr,227 ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, flags);228 229 if (ret val < 0) {223 rd_size = ALIGN_UP(size, block_size); 224 unsigned int flags = 225 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE; 226 227 ret = physmem_map((void *) addr_phys, 228 ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, flags, &rd_addr); 229 if (ret != EOK) { 230 230 printf("%s: Error mapping RAM disk\n", NAME); 231 231 return false; 232 232 } 233 233 234 printf("%s: Found RAM disk at %p, %zu bytes\n", NAME, 235 (void *) rd_ph_addr, rd_size); 236 237 int rc = loc_server_register(NAME, rd_connection); 238 if (rc < 0) { 239 printf("%s: Unable to register driver (%d)\n", NAME, rc); 234 printf("%s: Found RAM disk at %p, %" PRIun " bytes\n", NAME, 235 (void *) addr_phys, size); 236 237 async_set_client_connection(rd_connection); 238 ret = loc_server_register(NAME); 239 if (ret < 0) { 240 printf("%s: Unable to register driver (%d)\n", NAME, ret); 240 241 return false; 241 242 } 242 243 243 244 service_id_t service_id; 244 if (loc_service_register("bd/initrd", &service_id) != EOK) { 245 ret = loc_service_register("bd/initrd", &service_id); 246 if (ret != EOK) { 245 247 printf("%s: Unable to register device service\n", NAME); 246 248 return false;
Note:
See TracChangeset
for help on using the changeset viewer.