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