Changes in uspace/drv/isa/isa.c [fc51296:af6b5157] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/isa/isa.c
rfc51296 raf6b5157 53 53 54 54 #include <ddf/driver.h> 55 #include <ddf/log.h>56 55 #include <ops/hw_res.h> 57 56 … … 135 134 fd = open(conf_path, O_RDONLY); 136 135 if (fd < 0) { 137 ddf_msg(LVL_ERROR, "Unable to open %s\n", conf_path);136 printf(NAME ": unable to open %s\n", conf_path); 138 137 goto cleanup; 139 138 } … … 142 141 143 142 len = lseek(fd, 0, SEEK_END); 144 lseek(fd, 0, SEEK_SET); 143 lseek(fd, 0, SEEK_SET); 145 144 if (len == 0) { 146 ddf_msg(LVL_ERROR, "Configuration file '%s' is empty.\n",147 conf_path);145 printf(NAME ": fun_conf_read error: configuration file '%s' " 146 "is empty.\n", conf_path); 148 147 goto cleanup; 149 148 } … … 151 150 buf = malloc(len + 1); 152 151 if (buf == NULL) { 153 ddf_msg(LVL_ERROR, "Memory allocation failed.\n");152 printf(NAME ": fun_conf_read error: memory allocation failed.\n"); 154 153 goto cleanup; 155 154 } 156 155 157 156 if (0 >= read(fd, buf, len)) { 158 ddf_msg(LVL_ERROR, "Unable to read file '%s'.\n", conf_path); 157 printf(NAME ": fun_conf_read error: unable to read file '%s'.\n", 158 conf_path); 159 159 goto cleanup; 160 160 } … … 252 252 fun->hw_resources.count++; 253 253 254 ddf_msg(LVL_NOTE, "Added irq 0x%x to function %s\n", irq,254 printf(NAME ": added irq 0x%x to function %s\n", irq, 255 255 fun->fnode->name); 256 256 } … … 270 270 fun->hw_resources.count++; 271 271 272 ddf_msg(LVL_NOTE, "Added io range (addr=0x%x, size=0x%x) to "272 printf(NAME ": added io range (addr=0x%x, size=0x%x) to " 273 273 "function %s\n", (unsigned int) addr, (unsigned int) len, 274 274 fun->fnode->name); … … 331 331 score = (int)strtol(val, &end, 10); 332 332 if (val == end) { 333 ddf_msg(LVL_ERROR, "Cannot read match score for function"334 " %s.\n", fun->fnode->name);333 printf(NAME " : error - could not read match score for " 334 "function %s.\n", fun->fnode->name); 335 335 return; 336 336 } … … 339 339 get_match_id(&id, val); 340 340 if (id == NULL) { 341 ddf_msg(LVL_ERROR, "Cannot read match ID for function %s.\n",342 fun->fnode->name);341 printf(NAME " : error - could not read match id for " 342 "function %s.\n", fun->fnode->name); 343 343 return; 344 344 } 345 345 346 ddf_msg(LVL_DEBUG, "Adding match id '%s' with score %d to "347 "function %s\n", id,score, fun->fnode->name);346 printf(NAME ": adding match id '%s' with score %d to function %s\n", id, 347 score, fun->fnode->name); 348 348 349 349 rc = ddf_fun_add_match_id(fun->fnode, id, score); 350 if (rc != EOK) { 351 ddf_msg(LVL_ERROR, "Failed adding match ID: %s\n", 352 str_error(rc)); 353 } 350 if (rc != EOK) 351 printf(NAME ": error adding match ID: %s\n", str_error(rc)); 354 352 } 355 353 … … 377 375 if (!prop_parse(fun, line, "io_range", &fun_parse_io_range) && 378 376 !prop_parse(fun, line, "irq", &fun_parse_irq) && 379 !prop_parse(fun, line, "match", &fun_parse_match_id)) {380 381 ddf_msg(LVL_ERROR, "Undefined device property at line '%s'\n",382 377 !prop_parse(fun, line, "match", &fun_parse_match_id)) 378 { 379 printf(NAME " error undefined device property at line '%s'\n", 380 line); 383 381 } 384 382 } … … 441 439 fun->fnode->ops = &isa_fun_ops; 442 440 443 ddf_msg(LVL_DEBUG, "Binding function %s.\n", fun->fnode->name);441 printf(NAME ": Binding function %s.\n", fun->fnode->name); 444 442 445 443 /* XXX Handle error */ … … 469 467 static int isa_add_device(ddf_dev_t *dev) 470 468 { 471 ddf_msg(LVL_DEBUG, "isa_add_device, device handle = %d\n",469 printf(NAME ": isa_add_device, device handle = %d\n", 472 470 (int) dev->handle); 473 471 474 472 /* Make the bus device more visible. Does not do anything. */ 475 ddf_msg(LVL_DEBUG, "Adding a 'ctl' function\n");473 printf(NAME ": adding a 'ctl' function\n"); 476 474 477 475 ddf_fun_t *ctl = ddf_fun_create(dev, fun_exposed, "ctl"); 478 476 if (ctl == NULL) { 479 ddf_msg(LVL_ERROR, "Failedcreating control function.\n");477 printf(NAME ": Error creating control function.\n"); 480 478 return EXDEV; 481 479 } 482 480 483 481 if (ddf_fun_bind(ctl) != EOK) { 484 ddf_msg(LVL_ERROR, "Failedbinding control function.\n");482 printf(NAME ": Error binding control function.\n"); 485 483 return EXDEV; 486 484 } … … 488 486 /* Add functions as specified in the configuration file. */ 489 487 isa_functions_add(dev); 490 ddf_msg(LVL_NOTE, "Finished enumeratinglegacy functions\n");488 printf(NAME ": finished the enumeration of legacy functions\n"); 491 489 492 490 return EOK; … … 495 493 static void isa_init() 496 494 { 497 ddf_log_init(NAME, LVL_ERROR);498 495 isa_fun_ops.interfaces[HW_RES_DEV_IFACE] = &isa_fun_hw_res_ops; 499 496 }
Note:
See TracChangeset
for help on using the changeset viewer.