Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/pciintel/pci.c

    rebcb05a raf6b5157  
    4848
    4949#include <ddf/driver.h>
    50 #include <ddf/log.h>
    5150#include <devman.h>
    5251#include <ipc/devman.h>
     
    226225
    227226        if (match_id_str == NULL) {
    228                 ddf_msg(LVL_ERROR, "Out of memory creating match ID.");
     227                printf(NAME ": out of memory creating match ID.\n");
    229228                return;
    230229        }
     
    232231        rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 90);
    233232        if (rc != EOK) {
    234                 ddf_msg(LVL_ERROR, "Failed adding match ID: %s",
     233                printf(NAME ": error adding match ID: %s\n",
    235234                    str_error(rc));
    236235        }
     
    324323       
    325324        if (range_addr != 0) {
    326                 ddf_msg(LVL_DEBUG, "Function %s : address = %" PRIx64
    327                     ", size = %x", fun->fnode->name, range_addr,
    328                     (unsigned int) range_size);
     325                printf(NAME ": function %s : ", fun->fnode->name);
     326                printf("address = %" PRIx64, range_addr);
     327                printf(", size = %x\n", (unsigned int) range_size);
    329328        }
    330329       
     
    351350        hw_res_list->count++;
    352351       
    353         ddf_msg(LVL_NOTE, "Function %s uses irq %x.", fun->fnode->name, irq);
     352        printf(NAME ": function %s uses irq %x.\n", fun->fnode->name, irq);
    354353}
    355354
     
    407406                        char *fun_name = pci_fun_create_name(fun);
    408407                        if (fun_name == NULL) {
    409                                 ddf_msg(LVL_ERROR, "Out of memory.");
     408                                printf(NAME ": out of memory.\n");
    410409                                return;
    411410                        }
     
    413412                        fnode = ddf_fun_create(bus->dnode, fun_inner, fun_name);
    414413                        if (fnode == NULL) {
    415                                 ddf_msg(LVL_ERROR, "Failed creating function.");
     414                                printf(NAME ": error creating function.\n");
    416415                                return;
    417416                        }
     
    427426                        fnode->driver_data = fun;
    428427                       
    429                         ddf_msg(LVL_DEBUG, "Adding new function %s.",
     428                        printf(NAME ": adding new function %s.\n",
    430429                            fnode->name);
    431430                       
     
    444443                                child_bus = pci_conf_read_8(fun,
    445444                                    PCI_BRIDGE_SEC_BUS_NUM);
    446                                 ddf_msg(LVL_DEBUG, "Device is pci-to-pci "
    447                                     "bridge, secondary bus number = %d.",
    448                                     bus_num);
     445                                printf(NAME ": device is pci-to-pci bridge, "
     446                                    "secondary bus number = %d.\n", bus_num);
    449447                                if (child_bus > bus_num)
    450448                                        pci_bus_scan(bus, child_bus);
     
    468466        int rc;
    469467       
    470         ddf_msg(LVL_DEBUG, "pci_add_device");
     468        printf(NAME ": pci_add_device\n");
    471469        dnode->parent_phone = -1;
    472470       
    473471        bus = pci_bus_new();
    474472        if (bus == NULL) {
    475                 ddf_msg(LVL_ERROR, "pci_add_device allocation failed.");
     473                printf(NAME ": pci_add_device allocation failed.\n");
    476474                rc = ENOMEM;
    477475                goto fail;
     
    483481            IPC_FLAG_BLOCKING);
    484482        if (dnode->parent_phone < 0) {
    485                 ddf_msg(LVL_ERROR, "pci_add_device failed to connect to the "
    486                     "parent's driver.");
     483                printf(NAME ": pci_add_device failed to connect to the "
     484                    "parent's driver.\n");
    487485                rc = dnode->parent_phone;
    488486                goto fail;
     
    493491        rc = hw_res_get_resource_list(dnode->parent_phone, &hw_resources);
    494492        if (rc != EOK) {
    495                 ddf_msg(LVL_ERROR, "pci_add_device failed to get hw resources "
    496                     "for the device.");
     493                printf(NAME ": pci_add_device failed to get hw resources for "
     494                    "the device.\n");
    497495                goto fail;
    498496        }
    499497        got_res = true;
    500498       
    501         ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".",
     499        printf(NAME ": conf_addr = %" PRIx64 ".\n",
    502500            hw_resources.resources[0].res.io_range.address);
    503501       
     
    511509        if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 8,
    512510            &bus->conf_addr_port)) {
    513                 ddf_msg(LVL_ERROR, "Failed to enable configuration ports.");
     511                printf(NAME ": failed to enable configuration ports.\n");
    514512                rc = EADDRNOTAVAIL;
    515513                goto fail;
     
    518516       
    519517        /* Make the bus device more visible. It has no use yet. */
    520         ddf_msg(LVL_DEBUG, "Adding a 'ctl' function");
     518        printf(NAME ": adding a 'ctl' function\n");
    521519       
    522520        ctl = ddf_fun_create(bus->dnode, fun_exposed, "ctl");
    523521        if (ctl == NULL) {
    524                 ddf_msg(LVL_ERROR, "Failed creating control function.");
     522                printf(NAME ": error creating control function.\n");
    525523                rc = ENOMEM;
    526524                goto fail;
     
    529527        rc = ddf_fun_bind(ctl);
    530528        if (rc != EOK) {
    531                 ddf_msg(LVL_ERROR, "Failed binding control function.");
     529                printf(NAME ": error binding control function.\n");
    532530                goto fail;
    533531        }
    534532       
    535533        /* Enumerate functions. */
    536         ddf_msg(LVL_DEBUG, "Scanning the bus");
     534        printf(NAME ": scanning the bus\n");
    537535        pci_bus_scan(bus, 0);
    538536       
     
    556554static void pciintel_init(void)
    557555{
    558         ddf_log_init(NAME, LVL_ERROR);
    559556        pci_fun_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops;
    560557}
     
    634631int main(int argc, char *argv[])
    635632{
    636         printf(NAME ": HelenOS PCI bus driver (Intel method 1).\n");
     633        printf(NAME ": HelenOS pci bus driver (intel method 1).\n");
    637634        pciintel_init();
    638635        return ddf_driver_main(&pci_driver);
Note: See TracChangeset for help on using the changeset viewer.