Changeset 79ae36dd in mainline for uspace/drv/uhci_rhd/main.c


Ignore:
Timestamp:
2011-06-08T19:01:55Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0eff68e
Parents:
764d71e
Message:

new async framework with integrated exchange tracking

  • strict isolation between low-level IPC and high-level async framework with integrated exchange tracking
    • each IPC connection is represented by an async_sess_t structure
    • each IPC exchange is represented by an async_exch_t structure
    • exchange management is either based on atomic messages (EXCHANGE_ATOMIC), locking (EXCHANGE_SERIALIZE) or connection cloning (EXCHANGE_CLONE)
  • async_obsolete: temporary compatibility layer to keep old async clients working (several pieces of code are currently broken, but only non-essential functionality)
  • IPC_M_PHONE_HANGUP is now method no. 0 (for elegant boolean evaluation)
  • IPC_M_DEBUG_ALL has been renamed to IPC_M_DEBUG
  • IPC_M_PING has been removed (VFS protocol now has VFS_IN_PING)
  • console routines in libc have been rewritten for better abstraction
  • additional use for libc-private header files (FILE structure opaque to the client)
  • various cstyle changes (typos, indentation, missing externs in header files, improved comments, etc.)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci_rhd/main.c

    r764d71e r79ae36dd  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28
    2829/** @addtogroup drvusbuhcirh
    2930 * @{
     
    3233 * @brief UHCI root hub initialization routines
    3334 */
     35
    3436#include <ddf/driver.h>
    3537#include <devman.h>
     
    4850static int hc_get_my_registers(const ddf_dev_t *dev,
    4951    uintptr_t *io_reg_address, size_t *io_reg_size);
    50 /*----------------------------------------------------------------------------*/
     52
    5153static int uhci_rh_add_device(ddf_dev_t *device);
    52 /*----------------------------------------------------------------------------*/
     54
    5355static driver_ops_t uhci_rh_driver_ops = {
    5456        .add_device = uhci_rh_add_device,
    5557};
    56 /*----------------------------------------------------------------------------*/
     58
    5759static driver_t uhci_rh_driver = {
    5860        .name = NAME,
    5961        .driver_ops = &uhci_rh_driver_ops
    6062};
    61 /*----------------------------------------------------------------------------*/
     63
    6264/** Initialize global driver structures (NONE).
    6365 *
     
    7476        return ddf_driver_main(&uhci_rh_driver);
    7577}
    76 /*----------------------------------------------------------------------------*/
     78
    7779/** Initialize a new ddf driver instance of UHCI root hub.
    7880 *
     
    122124        return EOK;
    123125}
    124 /*----------------------------------------------------------------------------*/
     126
    125127/** Get address of I/O registers.
    126128 *
     
    134136{
    135137        assert(dev);
    136 
    137         const int parent_phone = devman_parent_device_connect(dev->handle,
     138       
     139        async_sess_t *parent_sess =
     140            devman_parent_device_connect(EXCHANGE_SERIALIZE, dev->handle,
    138141            IPC_FLAG_BLOCKING);
    139         if (parent_phone < 0) {
    140                 return parent_phone;
    141         }
    142 
     142        if (!parent_sess)
     143                return ENOMEM;
     144       
    143145        hw_resource_list_t hw_resources;
    144         const int ret = hw_res_get_resource_list(parent_phone, &hw_resources);
     146        const int ret = hw_res_get_resource_list(parent_sess, &hw_resources);
    145147        if (ret != EOK) {
    146                 async_hangup(parent_phone);
     148                async_hangup(parent_sess);
    147149                return ret;
    148150        }
    149 
     151       
    150152        uintptr_t io_address = 0;
    151153        size_t io_size = 0;
    152154        bool io_found = false;
    153 
     155       
    154156        size_t i = 0;
    155157        for (; i < hw_resources.count; i++) {
     
    160162                        io_found = true;
    161163                }
     164       
    162165        }
    163         async_hangup(parent_phone);
    164 
    165         if (!io_found) {
     166        async_hangup(parent_sess);
     167       
     168        if (!io_found)
    166169                return ENOENT;
    167         }
    168         if (io_reg_address != NULL) {
     170       
     171        if (io_reg_address != NULL)
    169172                *io_reg_address = io_address;
    170         }
    171         if (io_reg_size != NULL) {
     173       
     174        if (io_reg_size != NULL)
    172175                *io_reg_size = io_size;
    173         }
     176       
    174177        return EOK;
    175178}
     179
    176180/**
    177181 * @}
Note: See TracChangeset for help on using the changeset viewer.