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