Changeset f1d6866 in mainline for uspace/drv/bus/usb/uhci/pci.c


Ignore:
Timestamp:
2011-09-18T21:22:59Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
dcc44ca1
Parents:
85ff862 (diff), 45a9cf4 (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/bus/usb/uhci/pci.c

    r85ff862 rf1d6866  
    6161        assert(io_reg_size);
    6262        assert(irq_no);
    63        
     63
    6464        async_sess_t *parent_sess =
    6565            devman_parent_device_connect(EXCHANGE_SERIALIZE, dev->handle,
     
    6767        if (!parent_sess)
    6868                return ENOMEM;
    69        
     69
    7070        hw_resource_list_t hw_resources;
    71         int rc = hw_res_get_resource_list(parent_sess, &hw_resources);
     71        const int rc = hw_res_get_resource_list(parent_sess, &hw_resources);
     72        async_hangup(parent_sess);
    7273        if (rc != EOK) {
    73                 async_hangup(parent_sess);
    7474                return rc;
    7575        }
    76        
     76
    7777        uintptr_t io_address = 0;
    7878        size_t io_size = 0;
    7979        bool io_found = false;
    80        
     80
    8181        int irq = 0;
    8282        bool irq_found = false;
    83        
     83
    8484        size_t i;
    8585        for (i = 0; i < hw_resources.count; i++) {
     
    102102                }
    103103        }
    104        
    105         async_hangup(parent_sess);
    106        
     104        free(hw_resources.resources);
     105
    107106        if (!io_found || !irq_found)
    108107                return ENOENT;
    109        
     108
    110109        *io_reg_address = io_address;
    111110        *io_reg_size = io_size;
    112111        *irq_no = irq;
    113        
     112
    114113        return EOK;
    115114}
    116 
     115/*----------------------------------------------------------------------------*/
    117116/** Call the PCI driver with a request to enable interrupts
    118117 *
     
    127126        if (!parent_sess)
    128127                return ENOMEM;
    129        
     128
    130129        const bool enabled = hw_res_enable_interrupt(parent_sess);
    131130        async_hangup(parent_sess);
    132        
     131
    133132        return enabled ? EOK : EIO;
    134133}
    135 
     134/*----------------------------------------------------------------------------*/
    136135/** Call the PCI driver with a request to clear legacy support register
    137136 *
     
    142141{
    143142        assert(device);
    144        
     143
    145144        async_sess_t *parent_sess =
    146145            devman_parent_device_connect(EXCHANGE_SERIALIZE, device->handle,
     
    148147        if (!parent_sess)
    149148                return ENOMEM;
    150        
     149
    151150        /* See UHCI design guide for these values p.45,
    152151         * write all WC bits in USB legacy register */
    153152        const sysarg_t address = 0xc0;
    154153        const sysarg_t value = 0xaf00;
    155        
     154
    156155        async_exch_t *exch = async_exchange_begin(parent_sess);
    157        
     156
    158157        const int rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
    159158            IPC_M_CONFIG_SPACE_WRITE_16, address, value);
    160        
     159
    161160        async_exchange_end(exch);
    162161        async_hangup(parent_sess);
    163        
     162
    164163        return rc;
    165164}
Note: See TracChangeset for help on using the changeset viewer.