Changeset 969585f in mainline for uspace/drv/pciintel/pci.c


Ignore:
Timestamp:
2011-04-01T20:49:28Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
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.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    r8e7d724 r969585f  
    4848
    4949#include <ddf/driver.h>
     50#include <ddf/log.h>
    5051#include <devman.h>
    5152#include <ipc/devman.h>
     
    325326
    326327        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.");
    328329                return;
    329330        }
     
    331332        rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 90);
    332333        if (rc != EOK) {
    333                 printf(NAME ": error adding match ID: %s\n",
     334                ddf_msg(LVL_ERROR, "Failed adding match ID: %s",
    334335                    str_error(rc));
    335336        }
     
    428429       
    429430        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);
    433434        }
    434435       
     
    455456        hw_res_list->count++;
    456457       
    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);
    458459}
    459460
     
    511512                        char *fun_name = pci_fun_create_name(fun);
    512513                        if (fun_name == NULL) {
    513                                 printf(NAME ": out of memory.\n");
     514                                ddf_msg(LVL_ERROR, "Out of memory.");
    514515                                return;
    515516                        }
     
    517518                        fnode = ddf_fun_create(bus->dnode, fun_inner, fun_name);
    518519                        if (fnode == NULL) {
    519                                 printf(NAME ": error creating function.\n");
     520                                ddf_msg(LVL_ERROR, "Failed creating function.");
    520521                                return;
    521522                        }
     
    531532                        fnode->driver_data = fun;
    532533                       
    533                         printf(NAME ": adding new function %s.\n",
     534                        ddf_msg(LVL_DEBUG, "Adding new function %s.",
    534535                            fnode->name);
    535536                       
     
    548549                                child_bus = pci_conf_read_8(fun,
    549550                                    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);
    552554                                if (child_bus > bus_num)
    553555                                        pci_bus_scan(bus, child_bus);
     
    571573        int rc;
    572574       
    573         printf(NAME ": pci_add_device\n");
     575        ddf_msg(LVL_DEBUG, "pci_add_device");
    574576        dnode->parent_phone = -1;
    575577       
    576578        bus = pci_bus_new();
    577579        if (bus == NULL) {
    578                 printf(NAME ": pci_add_device allocation failed.\n");
     580                ddf_msg(LVL_ERROR, "pci_add_device allocation failed.");
    579581                rc = ENOMEM;
    580582                goto fail;
     
    586588            IPC_FLAG_BLOCKING);
    587589        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.");
    590592                rc = dnode->parent_phone;
    591593                goto fail;
     
    596598        rc = hw_res_get_resource_list(dnode->parent_phone, &hw_resources);
    597599        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.");
    600602                goto fail;
    601603        }
    602604        got_res = true;
    603605       
    604         printf(NAME ": conf_addr = %" PRIx64 ".\n",
     606        ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".",
    605607            hw_resources.resources[0].res.io_range.address);
    606608       
     
    614616        if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 8,
    615617            &bus->conf_addr_port)) {
    616                 printf(NAME ": failed to enable configuration ports.\n");
     618                ddf_msg(LVL_ERROR, "Failed to enable configuration ports.");
    617619                rc = EADDRNOTAVAIL;
    618620                goto fail;
     
    621623       
    622624        /* 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");
    624626       
    625627        ctl = ddf_fun_create(bus->dnode, fun_exposed, "ctl");
    626628        if (ctl == NULL) {
    627                 printf(NAME ": error creating control function.\n");
     629                ddf_msg(LVL_ERROR, "Failed creating control function.");
    628630                rc = ENOMEM;
    629631                goto fail;
     
    632634        rc = ddf_fun_bind(ctl);
    633635        if (rc != EOK) {
    634                 printf(NAME ": error binding control function.\n");
     636                ddf_msg(LVL_ERROR, "Failed binding control function.");
    635637                goto fail;
    636638        }
    637639       
    638640        /* Enumerate functions. */
    639         printf(NAME ": scanning the bus\n");
     641        ddf_msg(LVL_DEBUG, "Scanning the bus");
    640642        pci_bus_scan(bus, 0);
    641643       
     
    659661static void pciintel_init(void)
    660662{
     663        ddf_log_init(NAME, LVL_ERROR);
    661664        pci_fun_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops;
    662665        pci_fun_ops.interfaces[PCI_DEV_IFACE] = &pci_dev_ops;
     
    738741int main(int argc, char *argv[])
    739742{
    740         printf(NAME ": HelenOS pci bus driver (intel method 1).\n");
     743        printf(NAME ": HelenOS PCI bus driver (Intel method 1).\n");
    741744        pciintel_init();
    742745        return ddf_driver_main(&pci_driver);
Note: See TracChangeset for help on using the changeset viewer.