Changeset 832cbe7 in mainline
- Timestamp:
- 2025-02-05T12:30:20Z (7 days 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
- Files:
-
- 1 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/block/isa-ide/main.c
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 43 43 44 44 #include "isa-ide.h" 45 #include "isa-ide_hw.h" 45 46 #include "main.h" 46 47 … … 70 71 async_sess_t *parent_sess; 71 72 hw_res_list_parsed_t hw_res; 72 hw_res_ flags_t flags;73 hw_res_claims_t claims; 73 74 errno_t rc; 74 75 … … 77 78 return ENOMEM; 78 79 79 rc = hw_res_get_flags(parent_sess, &flags); 80 if (rc != EOK) 81 return rc; 82 83 /* 84 * Prevent attaching to the legacy ISA IDE register block 85 * on a system with PCI not to conflict with PCI IDE. 86 * 87 * XXX This is a simplification. If we had a PCI-based system without 88 * PCI-IDE or with PCI-IDE disabled and would still like to use 89 * an ISA IDE controller, this would prevent us from doing so. 90 */ 91 if (flags & hwf_isa_bridge) { 92 ddf_msg(LVL_NOTE, "Will not attach to PCI/ISA bridge."); 93 return EIO; 80 rc = hw_res_query_legacy_io(parent_sess, &claims); 81 if (rc != EOK) { 82 ddf_msg(LVL_NOTE, "Error getting HW resource flags."); 83 return rc; 94 84 } 95 85 96 86 hw_res_list_parsed_init(&hw_res); 97 87 rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0); 98 if (rc != EOK) 99 return rc; 88 if (rc != EOK) { 89 ddf_msg(LVL_NOTE, "Error getting HW resource list."); 90 return rc; 91 } 100 92 101 93 if (hw_res.io_ranges.count != 4) { … … 148 140 } 149 141 142 /* 143 * Only attach to legacy ISA IDE register block if it 144 * is not claimed by PCI IDE driver. 145 */ 146 if (res->cmd1 == leg_ide_ata_cmd_p && 147 res->cmd2 == leg_ide_ata_cmd_s && 148 (claims & hwc_isa_ide) != 0) { 149 ddf_msg(LVL_NOTE, "Will not attach to ISA legacy ports " 150 "since they are already handled by PCI."); 151 return EBUSY; 152 } 153 150 154 return EOK; 151 155 error: … … 167 171 rc = isa_ide_get_res(dev, &res); 168 172 if (rc != EOK) { 169 ddf_msg(LVL_ERROR, "Invalid HW resource configuration."); 173 if (rc == EINVAL) 174 ddf_msg(LVL_ERROR, "Invalid HW resource configuration."); 170 175 return EINVAL; 171 176 } -
uspace/drv/block/pc-floppy/main.c
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 73 73 async_sess_t *parent_sess; 74 74 hw_res_list_parsed_t hw_res; 75 hw_res_flags_t flags;76 75 errno_t rc; 77 76 … … 79 78 if (parent_sess == NULL) 80 79 return ENOMEM; 81 82 rc = hw_res_get_flags(parent_sess, &flags);83 if (rc != EOK)84 return rc;85 80 86 81 hw_res_list_parsed_init(&hw_res); -
uspace/drv/block/pci-ide/main.c
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 133 133 pci_ide_ctrl_t *ctrl; 134 134 pci_ide_hwres_t res; 135 async_sess_t *parent_sess; 135 136 errno_t rc; 136 137 … … 164 165 if (rc != EOK) { 165 166 ddf_msg(LVL_ERROR, "Failed initializing ATA controller."); 167 rc = EIO; 168 goto error; 169 } 170 171 parent_sess = ddf_dev_parent_sess_get(dev); 172 if (parent_sess == NULL) { 173 rc = ENOMEM; 174 goto error; 175 } 176 177 /* Claim legacy I/O range to prevent ISA IDE from attaching there. */ 178 rc = hw_res_claim_legacy_io(parent_sess, hwc_isa_ide); 179 if (rc != EOK) { 180 ddf_msg(LVL_ERROR, "Failed claiming legacy I/O range."); 166 181 rc = EIO; 167 182 goto error; -
uspace/drv/block/pci-ide/pci-ide.c
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 189 189 190 190 ddf_msg(LVL_DEBUG, "pci_ide_channel_init()"); 191 192 memset(¶ms, 0, sizeof(params)); 191 193 192 194 chan->ctrl = ctrl; -
uspace/drv/bus/isa/isa.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 … … 206 206 } 207 207 208 static errno_t isa_fun_get_flags(ddf_fun_t *fnode, hw_res_flags_t *rflags) 208 /** Handle legacy IO availability query from function. 209 * 210 * @param fnode Function performing the query 211 * @param rclaims Place to store the legacy IO claims bitmask 212 * @return EOK on success or an error code 213 */ 214 static errno_t isa_fun_query_legacy_io(ddf_fun_t *fnode, 215 hw_res_claims_t *rclaims) 209 216 { 210 217 isa_fun_t *fun = isa_fun(fnode); 211 hw_res_flags_t flags; 212 213 flags = 0; 214 if (fun->bus->pci_isa_bridge) 215 flags |= hwf_isa_bridge; 216 217 ddf_msg(LVL_NOTE, "isa_fun_get_flags: returning 0x%x", flags); 218 *rflags = flags; 218 hw_res_claims_t claims; 219 async_sess_t *sess; 220 errno_t rc; 221 222 ddf_msg(LVL_DEBUG, "isa_fun_query_legacy_io()"); 223 224 sess = ddf_dev_parent_sess_get(fun->bus->dev); 225 if (sess == NULL) { 226 ddf_msg(LVL_ERROR, "isa_dev_add failed to connect to the " 227 "parent driver."); 228 return ENOENT; 229 } 230 231 if (!fun->bus->pci_isa_bridge) { 232 ddf_msg(LVL_NOTE, "isa_fun_query_legacy_io: classic ISA - " 233 "legacy IDE range is available"); 234 /* Classic ISA, we can be sure IDE is unclaimed by PCI */ 235 claims = 0; 236 } else { 237 ddf_msg(LVL_NOTE, "isa_fun_query_legacy_io: ISA bridge - " 238 "determine legacy IDE availability from PCI bus driver"); 239 rc = hw_res_query_legacy_io(sess, &claims); 240 if (rc != EOK) { 241 ddf_msg(LVL_NOTE, "Error querying legacy IO claims."); 242 return rc; 243 } 244 } 245 246 ddf_msg(LVL_DEBUG, "isa_fun_query_legacy_io: returning 0x%x", claims); 247 *rclaims = claims; 219 248 return EOK; 220 249 } … … 227 256 .dma_channel_setup = isa_fun_setup_dma, 228 257 .dma_channel_remain = isa_fun_remain_dma, 229 . get_flags = isa_fun_get_flags258 .query_legacy_io = isa_fun_query_legacy_io 230 259 }; 231 260 -
uspace/drv/bus/pci/pciintel/pci.c
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * Copyright (c) 2010 Lenka Trochtova 4 4 * All rights reserved. … … 143 143 } 144 144 145 /** Handle legacy IO availability query from function. 146 * 147 * @param fnode Function performing the query 148 * @param rclaims Place to store the legacy IO claims bitmask 149 * @return EOK on success or an error code 150 */ 151 static errno_t pciintel_query_legacy_io(ddf_fun_t *fnode, 152 hw_res_claims_t *rclaims) 153 { 154 pci_fun_t *fun = pci_fun(fnode); 155 pci_bus_t *bus = fun->busptr; 156 pci_fun_t *f; 157 hw_res_claims_t claims; 158 159 /* 160 * We need to wait for enumeration to complete so that we give 161 * the PCI IDE driver a chance to claim the legacy ISA IDE 162 * ranges. 163 */ 164 ddf_msg(LVL_DEBUG, "pciintel_query_legacy_io"); 165 166 fun->querying = true; 167 168 fibril_mutex_lock(&bus->enum_done_lock); 169 while (!bus->enum_done) 170 fibril_condvar_wait(&bus->enum_done_cv, &bus->enum_done_lock); 171 fibril_mutex_unlock(&bus->enum_done_lock); 172 173 ddf_msg(LVL_DEBUG, "Wait for PCI devices to stabilize"); 174 175 f = pci_fun_first(bus); 176 while (f != NULL) { 177 if (!f->querying) 178 ddf_fun_wait_stable(f->fnode); 179 f = pci_fun_next(f); 180 } 181 182 /* Devices are stable. Now we can determine if ISA IDE was claimed. */ 183 184 claims = 0; 185 186 ddf_msg(LVL_DEBUG, "PCI devices stabilized, leg_ide_claimed=%d\n", 187 (int)bus->leg_ide_claimed); 188 if (bus->leg_ide_claimed != false) { 189 ddf_msg(LVL_NOTE, "Legacy IDE I/O ports claimed by PCI driver."); 190 claims |= hwc_isa_ide; 191 } 192 193 fun->querying = false; 194 *rclaims = claims; 195 return EOK; 196 } 197 198 /** Handle legacy IO claim from function. 199 * 200 * @param fnode Function claiming the legacy I/O ports 201 * @param claims Bitmask of claimed I/O 202 * @return EOK on success or an error code 203 */ 204 static errno_t pciintel_claim_legacy_io(ddf_fun_t *fnode, 205 hw_res_claims_t claims) 206 { 207 pci_fun_t *fun = pci_fun(fnode); 208 pci_bus_t *bus = fun->busptr; 209 210 ddf_msg(LVL_DEBUG, "pciintel_claim_legacy_io() claims=%x", claims); 211 if ((claims & hwc_isa_ide) != 0) 212 bus->leg_ide_claimed = true; 213 214 return EOK; 215 } 216 145 217 static pio_window_t *pciintel_get_pio_window(ddf_fun_t *fnode) 146 218 { … … 211 283 .disable_interrupt = &pciintel_disable_interrupt, 212 284 .clear_interrupt = &pciintel_clear_interrupt, 285 .query_legacy_io = &pciintel_query_legacy_io, 286 .claim_legacy_io = &pciintel_claim_legacy_io 213 287 }; 214 288 … … 755 829 list_initialize(&bus->funs); 756 830 fibril_mutex_initialize(&bus->conf_mutex); 831 fibril_mutex_initialize(&bus->enum_done_lock); 832 fibril_condvar_initialize(&bus->enum_done_cv); 757 833 758 834 bus->dnode = dnode; … … 863 939 hw_res_clean_resource_list(&hw_resources); 864 940 941 ddf_msg(LVL_DEBUG, "Bus enumeration done."); 942 943 fibril_mutex_lock(&bus->enum_done_lock); 944 bus->enum_done = true; 945 fibril_mutex_unlock(&bus->enum_done_lock); 946 fibril_condvar_broadcast(&bus->enum_done_cv); 947 865 948 return EOK; 866 867 949 fail: 868 950 if (got_res) -
uspace/drv/bus/pci/pciintel/pci.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 * … … 41 41 #include <ddf/driver.h> 42 42 #include <fibril_synch.h> 43 #include <stdbool.h> 43 44 44 45 #define PCI_MAX_HW_RES 10 … … 54 55 /** List of functions (of pci_fun_t) */ 55 56 list_t funs; 57 /** Enumeration is done */ 58 bool enum_done; 59 /** Synchronize enum_done */ 60 fibril_mutex_t enum_done_lock; 61 /** Signal change to enum_done */ 62 fibril_condvar_t enum_done_cv; 63 /** @c true iff legacy IDE range is claimed by PCI IDE driver */ 64 bool leg_ide_claimed; 56 65 } pci_bus_t; 57 66 … … 72 81 uint8_t prog_if; 73 82 uint8_t revision; 83 bool querying; 74 84 hw_resource_list_t hw_resources; 75 85 hw_resource_t resources[PCI_MAX_HW_RES]; -
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 -
uspace/srv/devman/drv_conn.c
r0dab4850 r832cbe7 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * Copyright (c) 2010 Lenka Trochtova 4 4 * All rights reserved. … … 453 453 fun_busy_unlock(fun); 454 454 fun_del_ref(fun); 455 async_answer_0(icall, EOK); 456 } 457 458 /** Wait for function to become stable. 459 * 460 */ 461 static void devman_drv_fun_wait_stable(ipc_call_t *icall, driver_t *drv) 462 { 463 fun_node_t *fun; 464 dev_node_t *dev; 465 466 fibril_rwlock_read_lock(&device_tree.rwlock); 467 468 fun = find_fun_node(&device_tree, ipc_get_arg1(icall)); 469 if (fun == NULL) { 470 fibril_rwlock_read_unlock(&device_tree.rwlock); 471 async_answer_0(icall, ENOENT); 472 return; 473 } 474 475 if (fun->child == NULL) { 476 fibril_rwlock_read_unlock(&device_tree.rwlock); 477 fun_del_ref(fun); 478 async_answer_0(icall, EOK); 479 return; 480 } 481 482 dev = fun->child; 483 dev_add_ref(dev); 484 485 fibril_rwlock_read_unlock(&device_tree.rwlock); 486 487 dev_wait_stable(dev); 488 dev_del_ref(dev); 489 455 490 async_answer_0(icall, EOK); 456 491 } … … 642 677 devman_drv_fun_offline(&call, driver); 643 678 break; 679 case DEVMAN_DRV_FUN_WAIT_STABLE: 680 devman_drv_fun_wait_stable(&call, driver); 681 break; 644 682 case DEVMAN_REMOVE_FUNCTION: 645 683 devman_remove_function(&call);
Note:
See TracChangeset
for help on using the changeset viewer.