Changes in uspace/drv/bus/isa/isa.c [0bbd13e:56fd7cf] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/isa/isa.c
r0bbd13e r56fd7cf 73 73 #define CHILD_FUN_CONF_PATH "/drv/isa/isa.dev" 74 74 75 /** Obtain soft-state from device node */76 #define ISA_BUS(dev) ((isa_bus_t *) ((dev)->driver_data))77 78 /** Obtain soft-state from function node */79 #define ISA_FUN(fun) ((isa_fun_t *) ((fun)->driver_data))80 81 75 #define ISA_MAX_HW_RES 5 82 76 … … 95 89 } isa_fun_t; 96 90 91 /** Obtain soft-state from device node */ 92 static isa_bus_t *isa_bus(ddf_dev_t *dev) 93 { 94 return ddf_dev_data_get(dev); 95 } 96 97 /** Obtain soft-state from function node */ 98 static isa_fun_t *isa_fun(ddf_fun_t *fun) 99 { 100 return ddf_fun_data_get(fun); 101 } 102 97 103 static hw_resource_list_t *isa_get_fun_resources(ddf_fun_t *fnode) 98 104 { 99 isa_fun_t *fun = ISA_FUN(fnode);105 isa_fun_t *fun = isa_fun(fnode); 100 106 assert(fun != NULL); 101 107 … … 107 113 /* This is an old ugly way, copied from pci driver */ 108 114 assert(fnode); 109 isa_fun_t * isa_fun = fnode->driver_data;115 isa_fun_t *fun = isa_fun(fnode); 110 116 111 117 sysarg_t apic; … … 123 129 return false; 124 130 125 assert(isa_fun); 126 const hw_resource_list_t *res = &isa_fun->hw_resources; 131 const hw_resource_list_t *res = &fun->hw_resources; 127 132 assert(res); 128 133 for (size_t i = 0; i < res->count; ++i) { … … 150 155 { 151 156 assert(fnode); 152 isa_fun_t * isa_fun = fnode->driver_data;153 const hw_resource_list_t *res = & isa_fun->hw_resources;157 isa_fun_t *fun = isa_fun(fnode); 158 const hw_resource_list_t *res = &fun->hw_resources; 154 159 assert(res); 155 160 … … 339 344 340 345 ddf_msg(LVL_NOTE, "Added irq 0x%x to function %s", irq, 341 fun->fnode->name);346 ddf_fun_get_name(fun->fnode)); 342 347 } 343 348 } … … 355 360 fun->hw_resources.count++; 356 361 ddf_msg(LVL_NOTE, "Added dma 0x%x to function %s", dma, 357 fun->fnode->name);362 ddf_fun_get_name(fun->fnode)); 358 363 359 364 return; … … 366 371 fun->hw_resources.count++; 367 372 ddf_msg(LVL_NOTE, "Added dma 0x%x to function %s", dma, 368 fun->fnode->name);373 ddf_fun_get_name(fun->fnode)); 369 374 370 375 return; … … 372 377 373 378 ddf_msg(LVL_WARN, "Skipped dma 0x%x for function %s", dma, 374 fun->fnode->name);379 ddf_fun_get_name(fun->fnode)); 375 380 } 376 381 } … … 391 396 ddf_msg(LVL_NOTE, "Added io range (addr=0x%x, size=0x%x) to " 392 397 "function %s", (unsigned int) addr, (unsigned int) len, 393 fun->fnode->name);398 ddf_fun_get_name(fun->fnode)); 394 399 } 395 400 } … … 463 468 if (val == end) { 464 469 ddf_msg(LVL_ERROR, "Cannot read match score for function " 465 "%s.", fun->fnode->name);470 "%s.", ddf_fun_get_name(fun->fnode)); 466 471 return; 467 472 } … … 471 476 if (id == NULL) { 472 477 ddf_msg(LVL_ERROR, "Cannot read match ID for function %s.", 473 fun->fnode->name);478 ddf_fun_get_name(fun->fnode)); 474 479 return; 475 480 } 476 481 477 482 ddf_msg(LVL_DEBUG, "Adding match id '%s' with score %d to " 478 "function %s", id, score, fun->fnode->name);483 "function %s", id, score, ddf_fun_get_name(fun->fnode)); 479 484 480 485 rc = ddf_fun_add_match_id(fun->fnode, id, score); … … 579 584 580 585 /* Set device operations to the device. */ 581 fun->fnode->ops = &isa_fun_ops;582 583 ddf_msg(LVL_DEBUG, "Binding function %s.", fun->fnode->name);586 ddf_fun_set_ops(fun->fnode, &isa_fun_ops); 587 588 ddf_msg(LVL_DEBUG, "Binding function %s.", ddf_fun_get_name(fun->fnode)); 584 589 585 590 /* XXX Handle error */ … … 614 619 615 620 ddf_msg(LVL_DEBUG, "isa_dev_add, device handle = %d", 616 (int) d ev->handle);621 (int) ddf_dev_get_handle(dev)); 617 622 618 623 isa = ddf_dev_data_alloc(dev, sizeof(isa_bus_t)); … … 652 657 static int isa_dev_remove(ddf_dev_t *dev) 653 658 { 654 isa_bus_t *isa = ISA_BUS(dev);659 isa_bus_t *isa = isa_bus(dev); 655 660 int rc; 656 661 … … 664 669 if (rc != EOK) { 665 670 fibril_mutex_unlock(&isa->mutex); 666 ddf_msg(LVL_ERROR, "Failed offlining %s", fun->fnode->name);671 ddf_msg(LVL_ERROR, "Failed offlining %s", ddf_fun_get_name(fun->fnode)); 667 672 return rc; 668 673 } … … 671 676 if (rc != EOK) { 672 677 fibril_mutex_unlock(&isa->mutex); 673 ddf_msg(LVL_ERROR, "Failed unbinding %s", fun->fnode->name);678 ddf_msg(LVL_ERROR, "Failed unbinding %s", ddf_fun_get_name(fun->fnode)); 674 679 return rc; 675 680 }
Note:
See TracChangeset
for help on using the changeset viewer.