Changeset 45457265 in mainline for uspace/drv/bus/usb/xhci/hc.c


Ignore:
Timestamp:
2018-02-03T02:14:26Z (7 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
eb862fd
Parents:
961a5ee
Message:

errno_t all the things!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/hc.c

    r961a5ee r45457265  
    8080 * ports to protocol versions and speeds.
    8181 */
    82 static int hc_parse_ec(xhci_hc_t *hc)
     82static errno_t hc_parse_ec(xhci_hc_t *hc)
    8383{
    8484        unsigned psic, major, minor;
     
    186186 * Initialize MMIO spaces of xHC.
    187187 */
    188 int hc_init_mmio(xhci_hc_t *hc, const hw_res_list_parsed_t *hw_res)
    189 {
    190         int err;
     188errno_t hc_init_mmio(xhci_hc_t *hc, const hw_res_list_parsed_t *hw_res)
     189{
     190        errno_t err;
    191191
    192192        if (hw_res->mem_ranges.count != 1) {
     
    257257 * Initialize structures kept in allocated memory.
    258258 */
    259 int hc_init_memory(xhci_hc_t *hc, ddf_dev_t *device)
    260 {
    261         int err = ENOMEM;
     259errno_t hc_init_memory(xhci_hc_t *hc, ddf_dev_t *device)
     260{
     261        errno_t err = ENOMEM;
    262262
    263263        if (dma_buffer_alloc(&hc->dcbaa_dma, (1 + hc->max_slots) * sizeof(uint64_t)))
     
    362362 * (except 0) are disabled.
    363363 */
    364 int hc_irq_code_gen(irq_code_t *code, xhci_hc_t *hc, const hw_res_list_parsed_t *hw_res, int *irq)
     364errno_t hc_irq_code_gen(irq_code_t *code, xhci_hc_t *hc, const hw_res_list_parsed_t *hw_res, int *irq)
    365365{
    366366        assert(code);
     
    412412 * Claim xHC from BIOS. Implements handoff as per Section 4.22.1 of xHCI spec.
    413413 */
    414 int hc_claim(xhci_hc_t *hc, ddf_dev_t *dev)
     414errno_t hc_claim(xhci_hc_t *hc, ddf_dev_t *dev)
    415415{
    416416        /* No legacy support capability, the controller is solely for us */
     
    440440 * Ask the xHC to reset its state. Implements sequence
    441441 */
    442 static int hc_reset(xhci_hc_t *hc)
     442static errno_t hc_reset(xhci_hc_t *hc)
    443443{
    444444        if (xhci_reg_wait(&hc->op_regs->usbsts, XHCI_REG_MASK(XHCI_OP_CNR), 0))
     
    466466 * Initialize the HC: section 4.2
    467467 */
    468 int hc_start(xhci_hc_t *hc)
    469 {
    470         int err;
     468errno_t hc_start(xhci_hc_t *hc)
     469{
     470        errno_t err;
    471471
    472472        if ((err = hc_reset(hc)))
     
    565565 * Used only when polling. Shall supplement the irq_commands.
    566566 */
    567 int hc_status(bus_t *bus, uint32_t *status)
     567errno_t hc_status(bus_t *bus, uint32_t *status)
    568568{
    569569        xhci_hc_t *hc = bus_to_hc(bus);
     
    583583}
    584584
    585 static int xhci_handle_mfindex_wrap_event(xhci_hc_t *hc, xhci_trb_t *trb)
     585static errno_t xhci_handle_mfindex_wrap_event(xhci_hc_t *hc, xhci_trb_t *trb)
    586586{
    587587        struct timeval tv;
     
    594594}
    595595
    596 typedef int (*event_handler) (xhci_hc_t *, xhci_trb_t *trb);
     596typedef errno_t (*event_handler) (xhci_hc_t *, xhci_trb_t *trb);
    597597
    598598/**
     
    612612};
    613613
    614 static int hc_handle_event(xhci_hc_t *hc, xhci_trb_t *trb)
     614static errno_t hc_handle_event(xhci_hc_t *hc, xhci_trb_t *trb)
    615615{
    616616        const unsigned type = TRB_TYPE(*trb);
     
    630630static int event_worker(void *arg)
    631631{
    632         int err;
     632        errno_t err;
    633633        xhci_trb_t trb;
    634634        xhci_hc_t * const hc = arg;
     
    654654    xhci_interrupter_regs_t *intr)
    655655{
    656         int err;
     656        errno_t err;
    657657
    658658        xhci_trb_t trb;
     
    781781 * DCBAA with the newly created slot.
    782782 */
    783 int hc_enable_slot(xhci_device_t *dev)
    784 {
    785         int err;
     783errno_t hc_enable_slot(xhci_device_t *dev)
     784{
     785        errno_t err;
    786786        xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
    787787
     
    815815 * Frees the device context.
    816816 */
    817 int hc_disable_slot(xhci_device_t *dev)
    818 {
    819         int err;
     817errno_t hc_disable_slot(xhci_device_t *dev)
     818{
     819        errno_t err;
    820820        xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
    821821
     
    837837 * Prepare an empty Endpoint Input Context inside a dma buffer.
    838838 */
    839 static int create_configure_ep_input_ctx(xhci_device_t *dev, dma_buffer_t *dma_buf)
     839static errno_t create_configure_ep_input_ctx(xhci_device_t *dev, dma_buffer_t *dma_buf)
    840840{
    841841        const xhci_hc_t * hc = bus_to_hc(dev->base.bus);
    842         const int err = dma_buffer_alloc(dma_buf, XHCI_INPUT_CTX_SIZE(hc));
     842        const errno_t err = dma_buffer_alloc(dma_buf, XHCI_INPUT_CTX_SIZE(hc));
    843843        if (err)
    844844                return err;
     
    860860 * @param dev Device to assing an address (unconfigured yet)
    861861 */
    862 int hc_address_device(xhci_device_t *dev)
    863 {
    864         int err = ENOMEM;
     862errno_t hc_address_device(xhci_device_t *dev)
     863{
     864        errno_t err = ENOMEM;
    865865        xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
    866866        xhci_endpoint_t *ep0 = xhci_endpoint_get(dev->base.endpoints[0]);
     
    908908 * @param slot_id Slot ID assigned to the device.
    909909 */
    910 int hc_configure_device(xhci_device_t *dev)
     910errno_t hc_configure_device(xhci_device_t *dev)
    911911{
    912912        xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
     
    914914        /* Issue configure endpoint command (sec 4.3.5). */
    915915        dma_buffer_t ictx_dma_buf;
    916         const int err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
     916        const errno_t err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
    917917        if (err)
    918918                return err;
     
    929929 * @param dev The owner of the device
    930930 */
    931 int hc_deconfigure_device(xhci_device_t *dev)
     931errno_t hc_deconfigure_device(xhci_device_t *dev)
    932932{
    933933        xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
     
    950950 * @param ep_ctx Endpoint context of the endpoint
    951951 */
    952 int hc_add_endpoint(xhci_endpoint_t *ep)
     952errno_t hc_add_endpoint(xhci_endpoint_t *ep)
    953953{
    954954        xhci_device_t * const dev = xhci_ep_to_dev(ep);
     
    957957        /* Issue configure endpoint command (sec 4.3.5). */
    958958        dma_buffer_t ictx_dma_buf;
    959         const int err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
     959        const errno_t err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
    960960        if (err)
    961961                return err;
     
    981981 * @param ep_idx Endpoint DCI in question
    982982 */
    983 int hc_drop_endpoint(xhci_endpoint_t *ep)
     983errno_t hc_drop_endpoint(xhci_endpoint_t *ep)
    984984{
    985985        xhci_device_t * const dev = xhci_ep_to_dev(ep);
     
    992992        /* Issue configure endpoint command (sec 4.3.5). */
    993993        dma_buffer_t ictx_dma_buf;
    994         const int err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
     994        const errno_t err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
    995995        if (err)
    996996                return err;
     
    10131013 * @param ep_ctx Endpoint context of the endpoint
    10141014 */
    1015 int hc_update_endpoint(xhci_endpoint_t *ep)
     1015errno_t hc_update_endpoint(xhci_endpoint_t *ep)
    10161016{
    10171017        xhci_device_t * const dev = xhci_ep_to_dev(ep);
     
    10211021        xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
    10221022
    1023         const int err = dma_buffer_alloc(&ictx_dma_buf, XHCI_INPUT_CTX_SIZE(hc));
     1023        const errno_t err = dma_buffer_alloc(&ictx_dma_buf, XHCI_INPUT_CTX_SIZE(hc));
    10241024        if (err)
    10251025                return err;
     
    10441044 * @param ep_idx Endpoint DCI in question
    10451045 */
    1046 int hc_stop_endpoint(xhci_endpoint_t *ep)
     1046errno_t hc_stop_endpoint(xhci_endpoint_t *ep)
    10471047{
    10481048        xhci_device_t * const dev = xhci_ep_to_dev(ep);
     
    10651065 * @param ep_idx Endpoint DCI in question
    10661066 */
    1067 int hc_reset_endpoint(xhci_endpoint_t *ep)
     1067errno_t hc_reset_endpoint(xhci_endpoint_t *ep)
    10681068{
    10691069        xhci_device_t * const dev = xhci_ep_to_dev(ep);
     
    10811081 * @param dev The owner of the endpoint
    10821082 */
    1083 int hc_reset_ring(xhci_endpoint_t *ep, uint32_t stream_id)
     1083errno_t hc_reset_ring(xhci_endpoint_t *ep, uint32_t stream_id)
    10841084{
    10851085        xhci_device_t * const dev = xhci_ep_to_dev(ep);
Note: See TracChangeset for help on using the changeset viewer.