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