Changeset 694ca93f in mainline for uspace/drv/pciintel/pci.c


Ignore:
Timestamp:
2011-05-01T19:34:26Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0e26444
Parents:
1ff896e (diff), 042fbe0 (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.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    r1ff896e r694ca93f  
    4848
    4949#include <ddf/driver.h>
     50#include <ddf/log.h>
    5051#include <devman.h>
    5152#include <ipc/devman.h>
     
    225226
    226227        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.");
    228229                return;
    229230        }
     
    231232        rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 90);
    232233        if (rc != EOK) {
    233                 printf(NAME ": error adding match ID: %s\n",
     234                ddf_msg(LVL_ERROR, "Failed adding match ID: %s",
    234235                    str_error(rc));
    235236        }
     
    323324       
    324325        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);
    328329        }
    329330       
     
    350351        hw_res_list->count++;
    351352       
    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);
    353354}
    354355
     
    406407                        char *fun_name = pci_fun_create_name(fun);
    407408                        if (fun_name == NULL) {
    408                                 printf(NAME ": out of memory.\n");
     409                                ddf_msg(LVL_ERROR, "Out of memory.");
    409410                                return;
    410411                        }
     
    412413                        fnode = ddf_fun_create(bus->dnode, fun_inner, fun_name);
    413414                        if (fnode == NULL) {
    414                                 printf(NAME ": error creating function.\n");
     415                                ddf_msg(LVL_ERROR, "Failed creating function.");
    415416                                return;
    416417                        }
     
    426427                        fnode->driver_data = fun;
    427428                       
    428                         printf(NAME ": adding new function %s.\n",
     429                        ddf_msg(LVL_DEBUG, "Adding new function %s.",
    429430                            fnode->name);
    430431                       
     
    443444                                child_bus = pci_conf_read_8(fun,
    444445                                    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);
    447449                                if (child_bus > bus_num)
    448450                                        pci_bus_scan(bus, child_bus);
     
    466468        int rc;
    467469       
    468         printf(NAME ": pci_add_device\n");
     470        ddf_msg(LVL_DEBUG, "pci_add_device");
    469471        dnode->parent_phone = -1;
    470472       
    471473        bus = pci_bus_new();
    472474        if (bus == NULL) {
    473                 printf(NAME ": pci_add_device allocation failed.\n");
     475                ddf_msg(LVL_ERROR, "pci_add_device allocation failed.");
    474476                rc = ENOMEM;
    475477                goto fail;
     
    481483            IPC_FLAG_BLOCKING);
    482484        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.");
    485487                rc = dnode->parent_phone;
    486488                goto fail;
     
    491493        rc = hw_res_get_resource_list(dnode->parent_phone, &hw_resources);
    492494        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.");
    495497                goto fail;
    496498        }
    497499        got_res = true;
    498500       
    499         printf(NAME ": conf_addr = %" PRIx64 ".\n",
     501        ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".",
    500502            hw_resources.resources[0].res.io_range.address);
    501503       
     
    509511        if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 8,
    510512            &bus->conf_addr_port)) {
    511                 printf(NAME ": failed to enable configuration ports.\n");
     513                ddf_msg(LVL_ERROR, "Failed to enable configuration ports.");
    512514                rc = EADDRNOTAVAIL;
    513515                goto fail;
     
    516518       
    517519        /* 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");
    519521       
    520522        ctl = ddf_fun_create(bus->dnode, fun_exposed, "ctl");
    521523        if (ctl == NULL) {
    522                 printf(NAME ": error creating control function.\n");
     524                ddf_msg(LVL_ERROR, "Failed creating control function.");
    523525                rc = ENOMEM;
    524526                goto fail;
     
    527529        rc = ddf_fun_bind(ctl);
    528530        if (rc != EOK) {
    529                 printf(NAME ": error binding control function.\n");
     531                ddf_msg(LVL_ERROR, "Failed binding control function.");
    530532                goto fail;
    531533        }
    532534       
    533535        /* Enumerate functions. */
    534         printf(NAME ": scanning the bus\n");
     536        ddf_msg(LVL_DEBUG, "Scanning the bus");
    535537        pci_bus_scan(bus, 0);
    536538       
     
    554556static void pciintel_init(void)
    555557{
     558        ddf_log_init(NAME, LVL_ERROR);
    556559        pci_fun_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops;
    557560}
     
    631634int main(int argc, char *argv[])
    632635{
    633         printf(NAME ": HelenOS pci bus driver (intel method 1).\n");
     636        printf(NAME ": HelenOS PCI bus driver (Intel method 1).\n");
    634637        pciintel_init();
    635638        return ddf_driver_main(&pci_driver);
Note: See TracChangeset for help on using the changeset viewer.