Changes in uspace/drv/pciintel/pci.c [af6b5157:ebcb05a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/pciintel/pci.c
raf6b5157 rebcb05a 48 48 49 49 #include <ddf/driver.h> 50 #include <ddf/log.h> 50 51 #include <devman.h> 51 52 #include <ipc/devman.h> … … 225 226 226 227 if (match_id_str == NULL) { 227 printf(NAME ": out of memory creating match ID.\n");228 ddf_msg(LVL_ERROR, "Out of memory creating match ID."); 228 229 return; 229 230 } … … 231 232 rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 90); 232 233 if (rc != EOK) { 233 printf(NAME ": error adding match ID: %s\n",234 ddf_msg(LVL_ERROR, "Failed adding match ID: %s", 234 235 str_error(rc)); 235 236 } … … 323 324 324 325 if (range_addr != 0) { 325 printf(NAME ": function %s : ", fun->fnode->name);326 printf("address = %" PRIx64, range_addr);327 printf(", size = %x\n",(unsigned int) range_size);326 ddf_msg(LVL_DEBUG, "Function %s : address = %" PRIx64 327 ", size = %x", fun->fnode->name, range_addr, 328 (unsigned int) range_size); 328 329 } 329 330 … … 350 351 hw_res_list->count++; 351 352 352 printf(NAME ": function %s uses irq %x.\n", fun->fnode->name, irq);353 ddf_msg(LVL_NOTE, "Function %s uses irq %x.", fun->fnode->name, irq); 353 354 } 354 355 … … 406 407 char *fun_name = pci_fun_create_name(fun); 407 408 if (fun_name == NULL) { 408 printf(NAME ": out of memory.\n");409 ddf_msg(LVL_ERROR, "Out of memory."); 409 410 return; 410 411 } … … 412 413 fnode = ddf_fun_create(bus->dnode, fun_inner, fun_name); 413 414 if (fnode == NULL) { 414 printf(NAME ": error creating function.\n");415 ddf_msg(LVL_ERROR, "Failed creating function."); 415 416 return; 416 417 } … … 426 427 fnode->driver_data = fun; 427 428 428 printf(NAME ": adding new function %s.\n",429 ddf_msg(LVL_DEBUG, "Adding new function %s.", 429 430 fnode->name); 430 431 … … 443 444 child_bus = pci_conf_read_8(fun, 444 445 PCI_BRIDGE_SEC_BUS_NUM); 445 printf(NAME ": device is pci-to-pci bridge, " 446 "secondary bus number = %d.\n", bus_num); 446 ddf_msg(LVL_DEBUG, "Device is pci-to-pci " 447 "bridge, secondary bus number = %d.", 448 bus_num); 447 449 if (child_bus > bus_num) 448 450 pci_bus_scan(bus, child_bus); … … 466 468 int rc; 467 469 468 printf(NAME ": pci_add_device\n");470 ddf_msg(LVL_DEBUG, "pci_add_device"); 469 471 dnode->parent_phone = -1; 470 472 471 473 bus = pci_bus_new(); 472 474 if (bus == NULL) { 473 printf(NAME ": pci_add_device allocation failed.\n");475 ddf_msg(LVL_ERROR, "pci_add_device allocation failed."); 474 476 rc = ENOMEM; 475 477 goto fail; … … 481 483 IPC_FLAG_BLOCKING); 482 484 if (dnode->parent_phone < 0) { 483 printf(NAME ":pci_add_device failed to connect to the "484 "parent's driver. \n");485 ddf_msg(LVL_ERROR, "pci_add_device failed to connect to the " 486 "parent's driver."); 485 487 rc = dnode->parent_phone; 486 488 goto fail; … … 491 493 rc = hw_res_get_resource_list(dnode->parent_phone, &hw_resources); 492 494 if (rc != EOK) { 493 printf(NAME ": pci_add_device failed to get hw resources for"494 " the device.\n");495 ddf_msg(LVL_ERROR, "pci_add_device failed to get hw resources " 496 "for the device."); 495 497 goto fail; 496 498 } 497 499 got_res = true; 498 500 499 printf(NAME ": conf_addr = %" PRIx64 ".\n",501 ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".", 500 502 hw_resources.resources[0].res.io_range.address); 501 503 … … 509 511 if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 8, 510 512 &bus->conf_addr_port)) { 511 printf(NAME ": failed to enable configuration ports.\n");513 ddf_msg(LVL_ERROR, "Failed to enable configuration ports."); 512 514 rc = EADDRNOTAVAIL; 513 515 goto fail; … … 516 518 517 519 /* Make the bus device more visible. It has no use yet. */ 518 printf(NAME ": adding a 'ctl' function\n");520 ddf_msg(LVL_DEBUG, "Adding a 'ctl' function"); 519 521 520 522 ctl = ddf_fun_create(bus->dnode, fun_exposed, "ctl"); 521 523 if (ctl == NULL) { 522 printf(NAME ": error creating control function.\n");524 ddf_msg(LVL_ERROR, "Failed creating control function."); 523 525 rc = ENOMEM; 524 526 goto fail; … … 527 529 rc = ddf_fun_bind(ctl); 528 530 if (rc != EOK) { 529 printf(NAME ": error binding control function.\n");531 ddf_msg(LVL_ERROR, "Failed binding control function."); 530 532 goto fail; 531 533 } 532 534 533 535 /* Enumerate functions. */ 534 printf(NAME ": scanning the bus\n");536 ddf_msg(LVL_DEBUG, "Scanning the bus"); 535 537 pci_bus_scan(bus, 0); 536 538 … … 554 556 static void pciintel_init(void) 555 557 { 558 ddf_log_init(NAME, LVL_ERROR); 556 559 pci_fun_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops; 557 560 } … … 631 634 int main(int argc, char *argv[]) 632 635 { 633 printf(NAME ": HelenOS pci bus driver (intel method 1).\n");636 printf(NAME ": HelenOS PCI bus driver (Intel method 1).\n"); 634 637 pciintel_init(); 635 638 return ddf_driver_main(&pci_driver);
Note:
See TracChangeset
for help on using the changeset viewer.