Changeset 969585f in mainline for uspace/drv/pciintel/pci.c
- Timestamp:
- 2011-04-01T20:49:28Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0053fa38, 5542b83, c6ba274
- Parents:
- 8e7d724 (diff), ebcb05a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/pciintel/pci.c
r8e7d724 r969585f 48 48 49 49 #include <ddf/driver.h> 50 #include <ddf/log.h> 50 51 #include <devman.h> 51 52 #include <ipc/devman.h> … … 325 326 326 327 if (match_id_str == NULL) { 327 printf(NAME ": out of memory creating match ID.\n");328 ddf_msg(LVL_ERROR, "Out of memory creating match ID."); 328 329 return; 329 330 } … … 331 332 rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 90); 332 333 if (rc != EOK) { 333 printf(NAME ": error adding match ID: %s\n",334 ddf_msg(LVL_ERROR, "Failed adding match ID: %s", 334 335 str_error(rc)); 335 336 } … … 428 429 429 430 if (range_addr != 0) { 430 printf(NAME ": function %s : ", fun->fnode->name);431 printf("address = %" PRIx64, range_addr);432 printf(", size = %x\n",(unsigned int) range_size);431 ddf_msg(LVL_DEBUG, "Function %s : address = %" PRIx64 432 ", size = %x", fun->fnode->name, range_addr, 433 (unsigned int) range_size); 433 434 } 434 435 … … 455 456 hw_res_list->count++; 456 457 457 printf(NAME ": function %s uses irq %x.\n", fun->fnode->name, irq);458 ddf_msg(LVL_NOTE, "Function %s uses irq %x.", fun->fnode->name, irq); 458 459 } 459 460 … … 511 512 char *fun_name = pci_fun_create_name(fun); 512 513 if (fun_name == NULL) { 513 printf(NAME ": out of memory.\n");514 ddf_msg(LVL_ERROR, "Out of memory."); 514 515 return; 515 516 } … … 517 518 fnode = ddf_fun_create(bus->dnode, fun_inner, fun_name); 518 519 if (fnode == NULL) { 519 printf(NAME ": error creating function.\n");520 ddf_msg(LVL_ERROR, "Failed creating function."); 520 521 return; 521 522 } … … 531 532 fnode->driver_data = fun; 532 533 533 printf(NAME ": adding new function %s.\n",534 ddf_msg(LVL_DEBUG, "Adding new function %s.", 534 535 fnode->name); 535 536 … … 548 549 child_bus = pci_conf_read_8(fun, 549 550 PCI_BRIDGE_SEC_BUS_NUM); 550 printf(NAME ": device is pci-to-pci bridge, " 551 "secondary bus number = %d.\n", bus_num); 551 ddf_msg(LVL_DEBUG, "Device is pci-to-pci " 552 "bridge, secondary bus number = %d.", 553 bus_num); 552 554 if (child_bus > bus_num) 553 555 pci_bus_scan(bus, child_bus); … … 571 573 int rc; 572 574 573 printf(NAME ": pci_add_device\n");575 ddf_msg(LVL_DEBUG, "pci_add_device"); 574 576 dnode->parent_phone = -1; 575 577 576 578 bus = pci_bus_new(); 577 579 if (bus == NULL) { 578 printf(NAME ": pci_add_device allocation failed.\n");580 ddf_msg(LVL_ERROR, "pci_add_device allocation failed."); 579 581 rc = ENOMEM; 580 582 goto fail; … … 586 588 IPC_FLAG_BLOCKING); 587 589 if (dnode->parent_phone < 0) { 588 printf(NAME ":pci_add_device failed to connect to the "589 "parent's driver. \n");590 ddf_msg(LVL_ERROR, "pci_add_device failed to connect to the " 591 "parent's driver."); 590 592 rc = dnode->parent_phone; 591 593 goto fail; … … 596 598 rc = hw_res_get_resource_list(dnode->parent_phone, &hw_resources); 597 599 if (rc != EOK) { 598 printf(NAME ": pci_add_device failed to get hw resources for"599 " the device.\n");600 ddf_msg(LVL_ERROR, "pci_add_device failed to get hw resources " 601 "for the device."); 600 602 goto fail; 601 603 } 602 604 got_res = true; 603 605 604 printf(NAME ": conf_addr = %" PRIx64 ".\n",606 ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".", 605 607 hw_resources.resources[0].res.io_range.address); 606 608 … … 614 616 if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 8, 615 617 &bus->conf_addr_port)) { 616 printf(NAME ": failed to enable configuration ports.\n");618 ddf_msg(LVL_ERROR, "Failed to enable configuration ports."); 617 619 rc = EADDRNOTAVAIL; 618 620 goto fail; … … 621 623 622 624 /* Make the bus device more visible. It has no use yet. */ 623 printf(NAME ": adding a 'ctl' function\n");625 ddf_msg(LVL_DEBUG, "Adding a 'ctl' function"); 624 626 625 627 ctl = ddf_fun_create(bus->dnode, fun_exposed, "ctl"); 626 628 if (ctl == NULL) { 627 printf(NAME ": error creating control function.\n");629 ddf_msg(LVL_ERROR, "Failed creating control function."); 628 630 rc = ENOMEM; 629 631 goto fail; … … 632 634 rc = ddf_fun_bind(ctl); 633 635 if (rc != EOK) { 634 printf(NAME ": error binding control function.\n");636 ddf_msg(LVL_ERROR, "Failed binding control function."); 635 637 goto fail; 636 638 } 637 639 638 640 /* Enumerate functions. */ 639 printf(NAME ": scanning the bus\n");641 ddf_msg(LVL_DEBUG, "Scanning the bus"); 640 642 pci_bus_scan(bus, 0); 641 643 … … 659 661 static void pciintel_init(void) 660 662 { 663 ddf_log_init(NAME, LVL_ERROR); 661 664 pci_fun_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops; 662 665 pci_fun_ops.interfaces[PCI_DEV_IFACE] = &pci_dev_ops; … … 738 741 int main(int argc, char *argv[]) 739 742 { 740 printf(NAME ": HelenOS pci bus driver (intel method 1).\n");743 printf(NAME ": HelenOS PCI bus driver (Intel method 1).\n"); 741 744 pciintel_init(); 742 745 return ddf_driver_main(&pci_driver);
Note:
See TracChangeset
for help on using the changeset viewer.