Changeset 443695e in mainline for uspace/lib


Ignore:
Timestamp:
2024-05-21T11:33:56Z (18 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
3526f4f3
Parents:
1801005
git-author:
Jiri Svoboda <jiri@…> (2024-05-20 17:33:43)
git-committer:
Jiri Svoboda <jiri@…> (2024-05-21 11:33:56)
Message:

Basic PCI-IDE driver (no DMA support)

Also, make sure we avoid attaching ISA IDE and PCI IDE
at the same time. For simplicity, use ISA IDE on ISA systems
and PCI IDE on PCI-based systems.

Location:
uspace/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/device/hw_res.c

    r1801005 r443695e  
    11/*
     2 * Copyright (c) 2024 Jiri Svoboda
    23 * Copyright (c) 2010 Lenka Trochtova
    34 * All rights reserved.
     
    161162}
    162163
     164/** Get bus flags.
     165 *
     166 * @param sess HW res session
     167 * @param rflags Place to store the flags
     168 *
     169 * @return Error code.
     170 *
     171 */
     172errno_t hw_res_get_flags(async_sess_t *sess, hw_res_flags_t *rflags)
     173{
     174        async_exch_t *exch = async_exchange_begin(sess);
     175
     176        sysarg_t flags;
     177        const errno_t ret = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
     178            HW_RES_GET_FLAGS, &flags);
     179
     180        async_exchange_end(exch);
     181
     182        if (ret == EOK)
     183                *rflags = flags;
     184
     185        return ret;
     186}
     187
    163188/** @}
    164189 */
  • uspace/lib/c/include/device/hw_res.h

    r1801005 r443695e  
    11/*
     2 * Copyright (c) 2024 Jiri Svoboda
    23 * Copyright (c) 2010 Lenka Trochtova
    34 * All rights reserved.
     
    5657        HW_RES_DMA_CHANNEL_SETUP,
    5758        HW_RES_DMA_CHANNEL_REMAIN,
     59        HW_RES_GET_FLAGS
    5860} hw_res_method_t;
    5961
     
    116118}
    117119
     120typedef enum {
     121        /** This is an PCI/ISA bridge, not 'classic' ISA bus */
     122        hwf_isa_bridge = 0x1
     123} hw_res_flags_t;
     124
    118125extern errno_t hw_res_get_resource_list(async_sess_t *, hw_resource_list_t *);
    119126extern errno_t hw_res_enable_interrupt(async_sess_t *, int);
     
    124131    uint32_t, uint8_t);
    125132extern errno_t hw_res_dma_channel_remain(async_sess_t *, unsigned, size_t *);
     133extern errno_t hw_res_get_flags(async_sess_t *, hw_res_flags_t *);
    126134
    127135#endif
  • uspace/lib/drv/generic/remote_hw_res.c

    r1801005 r443695e  
    11/*
     2 * Copyright (c) 2024 Jiri Svoboda
    23 * Copyright (c) 2010 Lenka Trochtova
    34 * Copyright (c) 2011 Jan Vesely
     
    4748static void remote_hw_res_dma_channel_setup(ddf_fun_t *, void *, ipc_call_t *);
    4849static void remote_hw_res_dma_channel_remain(ddf_fun_t *, void *, ipc_call_t *);
     50static void remote_hw_res_get_flags(ddf_fun_t *, void *, ipc_call_t *);
    4951
    5052static const remote_iface_func_ptr_t remote_hw_res_iface_ops [] = {
     
    5557        [HW_RES_DMA_CHANNEL_SETUP] = &remote_hw_res_dma_channel_setup,
    5658        [HW_RES_DMA_CHANNEL_REMAIN] = &remote_hw_res_dma_channel_remain,
     59        [HW_RES_GET_FLAGS] = &remote_hw_res_get_flags
    5760};
    5861
     
    171174}
    172175
     176static void remote_hw_res_get_flags(ddf_fun_t *fun, void *ops,
     177    ipc_call_t *call)
     178{
     179        hw_res_ops_t *hw_res_ops = ops;
     180
     181        if (hw_res_ops->get_flags == NULL) {
     182                async_answer_0(call, ENOTSUP);
     183                return;
     184        }
     185
     186        hw_res_flags_t flags = 0;
     187        const errno_t ret = hw_res_ops->get_flags(fun, &flags);
     188        async_answer_1(call, ret, flags);
     189}
     190
    173191/**
    174192 * @}
  • uspace/lib/drv/include/ops/hw_res.h

    r1801005 r443695e  
    11/*
     2 * Copyright (c) 2024 Jiri Svoboda
    23 * Copyright (c) 2010 Lenka Trochtova
    34 * Copyright (c) 2011 Jan Vesely
     
    4950        errno_t (*dma_channel_setup)(ddf_fun_t *, unsigned, uint32_t, uint32_t, uint8_t);
    5051        errno_t (*dma_channel_remain)(ddf_fun_t *, unsigned, size_t *);
     52        errno_t (*get_flags)(ddf_fun_t *, hw_res_flags_t *);
    5153} hw_res_ops_t;
    5254
Note: See TracChangeset for help on using the changeset viewer.