Changeset 832cbe7 in mainline for uspace/lib
- Timestamp:
- 2025-02-05T12:30:20Z (9 months ago)
- Branches:
- master
- Children:
- accdf882
- Parents:
- 0dab4850
- git-author:
- Jiri Svoboda <jiri@…> (2025-02-04 21:30:06)
- git-committer:
- Jiri Svoboda <jiri@…> (2025-02-05 12:30:20)
- Location:
- uspace/lib
- Files:
-
- 9 edited
-
c/generic/device/hw_res.c (modified) (2 diffs)
-
c/include/device/hw_res.h (modified) (4 diffs)
-
device/include/devman.h (modified) (2 diffs)
-
device/include/ipc/devman.h (modified) (2 diffs)
-
device/src/devman.c (modified) (2 diffs)
-
drv/generic/driver.c (modified) (2 diffs)
-
drv/generic/remote_hw_res.c (modified) (4 diffs)
-
drv/include/ddf/driver.h (modified) (2 diffs)
-
drv/include/ops/hw_res.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/device/hw_res.c
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * Copyright (c) 2010 Lenka Trochtova 4 4 * All rights reserved. … … 162 162 } 163 163 164 /** Get bus flags.164 /** Query legacy IO claims. 165 165 * 166 166 * @param sess HW res session 167 * @param r flags Place to store the flags168 * 169 * @return Error code. 170 * 171 */ 172 errno_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;167 * @param rclaims Place to store the claims 168 * 169 * @return Error code. 170 * 171 */ 172 errno_t hw_res_query_legacy_io(async_sess_t *sess, hw_res_claims_t *rclaims) 173 { 174 async_exch_t *exch = async_exchange_begin(sess); 175 176 sysarg_t claims; 177 177 const errno_t ret = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE), 178 HW_RES_ GET_FLAGS, &flags);178 HW_RES_QUERY_LEGACY_IO, &claims); 179 179 180 180 async_exchange_end(exch); 181 181 182 182 if (ret == EOK) 183 *rflags = flags; 183 *rclaims = claims; 184 185 return ret; 186 } 187 188 /** Claim legacy IO devices. 189 * 190 * @param sess HW res session 191 * @param claims Claims 192 * 193 * @return Error code. 194 * 195 */ 196 errno_t hw_res_claim_legacy_io(async_sess_t *sess, hw_res_claims_t claims) 197 { 198 async_exch_t *exch = async_exchange_begin(sess); 199 200 const errno_t ret = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE), 201 HW_RES_CLAIM_LEGACY_IO, claims); 202 203 async_exchange_end(exch); 184 204 185 205 return ret; -
uspace/lib/c/include/device/hw_res.h
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * Copyright (c) 2010 Lenka Trochtova 4 4 * All rights reserved. … … 57 57 HW_RES_DMA_CHANNEL_SETUP, 58 58 HW_RES_DMA_CHANNEL_REMAIN, 59 HW_RES_GET_FLAGS 59 HW_RES_QUERY_LEGACY_IO, 60 HW_RES_CLAIM_LEGACY_IO 60 61 } hw_res_method_t; 61 62 … … 118 119 } 119 120 121 /** Claims to legacy devices */ 120 122 typedef enum { 121 /** This is an PCI/ISA bridge, not 'classic' ISA bus */122 hw f_isa_bridge = 0x1123 } hw_res_ flags_t;123 /** 'Legacy' ISA IDE I/O ranges */ 124 hwc_isa_ide = 0x1 125 } hw_res_claims_t; 124 126 125 127 extern errno_t hw_res_get_resource_list(async_sess_t *, hw_resource_list_t *); … … 131 133 uint32_t, uint8_t); 132 134 extern errno_t hw_res_dma_channel_remain(async_sess_t *, unsigned, size_t *); 133 extern errno_t hw_res_get_flags(async_sess_t *, hw_res_flags_t *); 135 extern errno_t hw_res_query_legacy_io(async_sess_t *, hw_res_claims_t *); 136 extern errno_t hw_res_claim_legacy_io(async_sess_t *, hw_res_claims_t); 134 137 135 138 #endif -
uspace/lib/device/include/devman.h
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 20 09Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * Copyright (c) 2010 Lenka Trochtova 4 4 * All rights reserved. … … 52 52 extern errno_t devman_drv_fun_online(devman_handle_t); 53 53 extern errno_t devman_drv_fun_offline(devman_handle_t); 54 extern errno_t devman_drv_fun_wait_stable(devman_handle_t); 54 55 55 56 extern async_sess_t *devman_device_connect(devman_handle_t, unsigned int); -
uspace/lib/device/include/ipc/devman.h
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 2025 Jiri Svoboda 2 3 * Copyright (c) 2010 Lenka Trochtova 3 4 * All rights reserved. … … 147 148 DEVMAN_DRV_FUN_ONLINE, 148 149 DEVMAN_DRV_FUN_OFFLINE, 150 DEVMAN_DRV_FUN_WAIT_STABLE, 149 151 DEVMAN_REMOVE_FUNCTION 150 152 } driver_to_devman_t; -
uspace/lib/device/src/devman.c
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 2025 Jiri Svoboda 2 3 * Copyright (c) 2007 Josef Cejka 3 * Copyright (c) 2013 Jiri Svoboda4 4 * Copyright (c) 2010 Lenka Trochtova 5 5 * All rights reserved. … … 343 343 } 344 344 345 errno_t devman_drv_fun_wait_stable(devman_handle_t funh) 346 { 347 async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER); 348 if (exch == NULL) 349 return ENOMEM; 350 351 errno_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_WAIT_STABLE, funh); 352 353 devman_exchange_end(exch); 354 return retval; 355 } 356 345 357 async_sess_t *devman_parent_device_connect(devman_handle_t handle, 346 358 unsigned int flags) -
uspace/lib/drv/generic/driver.c
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 2025 Jiri Svoboda 2 3 * Copyright (c) 2010 Lenka Trochtova 3 * Copyright (c) 2011 Jiri Svoboda4 4 * All rights reserved. 5 5 * … … 971 971 } 972 972 973 /** Wait for function to enter stable state. 974 * 975 * @param fun Function 976 * @return EOK on success or an error code 977 */ 978 errno_t ddf_fun_wait_stable(ddf_fun_t *fun) 979 { 980 return devman_drv_fun_wait_stable(fun->handle); 981 } 982 973 983 errno_t ddf_driver_main(const driver_t *drv) 974 984 { -
uspace/lib/drv/generic/remote_hw_res.c
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * Copyright (c) 2010 Lenka Trochtova 4 4 * Copyright (c) 2011 Jan Vesely … … 48 48 static void remote_hw_res_dma_channel_setup(ddf_fun_t *, void *, ipc_call_t *); 49 49 static void remote_hw_res_dma_channel_remain(ddf_fun_t *, void *, ipc_call_t *); 50 static void remote_hw_res_get_flags(ddf_fun_t *, void *, ipc_call_t *); 50 static void remote_hw_res_query_legacy_io(ddf_fun_t *, void *, ipc_call_t *); 51 static void remote_hw_res_claim_legacy_io(ddf_fun_t *, void *, ipc_call_t *); 51 52 52 53 static const remote_iface_func_ptr_t remote_hw_res_iface_ops [] = { … … 57 58 [HW_RES_DMA_CHANNEL_SETUP] = &remote_hw_res_dma_channel_setup, 58 59 [HW_RES_DMA_CHANNEL_REMAIN] = &remote_hw_res_dma_channel_remain, 59 [HW_RES_GET_FLAGS] = &remote_hw_res_get_flags 60 [HW_RES_QUERY_LEGACY_IO] = &remote_hw_res_query_legacy_io, 61 [HW_RES_CLAIM_LEGACY_IO] = &remote_hw_res_claim_legacy_io 60 62 }; 61 63 … … 174 176 } 175 177 176 static 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); 178 static void remote_hw_res_query_legacy_io(ddf_fun_t *fun, void *ops, 179 ipc_call_t *call) 180 { 181 hw_res_ops_t *hw_res_ops = ops; 182 183 if (hw_res_ops->query_legacy_io == NULL) { 184 async_answer_0(call, ENOTSUP); 185 return; 186 } 187 188 hw_res_claims_t claims = 0; 189 const errno_t ret = hw_res_ops->query_legacy_io(fun, &claims); 190 async_answer_1(call, ret, claims); 191 } 192 193 static void remote_hw_res_claim_legacy_io(ddf_fun_t *fun, void *ops, 194 ipc_call_t *call) 195 { 196 hw_res_ops_t *hw_res_ops = ops; 197 hw_res_claims_t claims; 198 199 if (hw_res_ops->claim_legacy_io == NULL) { 200 async_answer_0(call, ENOTSUP); 201 return; 202 } 203 204 claims = DEV_IPC_GET_ARG1(*call); 205 206 const errno_t ret = hw_res_ops->claim_legacy_io(fun, claims); 207 async_answer_0(call, ret); 189 208 } 190 209 -
uspace/lib/drv/include/ddf/driver.h
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 2025 Jiri Svoboda 2 3 * Copyright (c) 2010 Lenka Trochtova 3 * Copyright (c) 2011 Jiri Svoboda4 4 * All rights reserved. 5 5 * … … 133 133 extern void ddf_fun_set_conn_handler(ddf_fun_t *, async_port_handler_t); 134 134 extern errno_t ddf_fun_add_to_category(ddf_fun_t *, const char *); 135 extern errno_t ddf_fun_wait_stable(ddf_fun_t *); 135 136 136 137 #endif -
uspace/lib/drv/include/ops/hw_res.h
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * Copyright (c) 2010 Lenka Trochtova 4 4 * Copyright (c) 2011 Jan Vesely … … 50 50 errno_t (*dma_channel_setup)(ddf_fun_t *, unsigned, uint32_t, uint32_t, uint8_t); 51 51 errno_t (*dma_channel_remain)(ddf_fun_t *, unsigned, size_t *); 52 errno_t (*get_flags)(ddf_fun_t *, hw_res_flags_t *); 52 errno_t (*query_legacy_io)(ddf_fun_t *, hw_res_claims_t *); 53 errno_t (*claim_legacy_io)(ddf_fun_t *, hw_res_claims_t); 53 54 } hw_res_ops_t; 54 55
Note:
See TracChangeset
for help on using the changeset viewer.
