Changeset 984a9ba in mainline for uspace/lib/drv/generic/remote_ahci.c
- Timestamp:
- 2018-07-05T09:34:09Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63d46341
- Parents:
- 76f566d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_ahci.c
r76f566d r984a9ba 182 182 } 183 183 184 static void remote_ahci_get_sata_device_name(ddf_fun_t *, void *, cap_call_handle_t, 185 ipc_call_t *); 186 static void remote_ahci_get_num_blocks(ddf_fun_t *, void *, cap_call_handle_t, 187 ipc_call_t *); 188 static void remote_ahci_get_block_size(ddf_fun_t *, void *, cap_call_handle_t, 189 ipc_call_t *); 190 static void remote_ahci_read_blocks(ddf_fun_t *, void *, cap_call_handle_t, 191 ipc_call_t *); 192 static void remote_ahci_write_blocks(ddf_fun_t *, void *, cap_call_handle_t, 193 ipc_call_t *); 184 static void remote_ahci_get_sata_device_name(ddf_fun_t *, void *, ipc_call_t *); 185 static void remote_ahci_get_num_blocks(ddf_fun_t *, void *, ipc_call_t *); 186 static void remote_ahci_get_block_size(ddf_fun_t *, void *, ipc_call_t *); 187 static void remote_ahci_read_blocks(ddf_fun_t *, void *, ipc_call_t *); 188 static void remote_ahci_write_blocks(ddf_fun_t *, void *, ipc_call_t *); 194 189 195 190 /** Remote AHCI interface operations. */ … … 210 205 211 206 void remote_ahci_get_sata_device_name(ddf_fun_t *fun, void *iface, 212 cap_call_handle_t chandle,ipc_call_t *call)207 ipc_call_t *call) 213 208 { 214 209 const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface; 215 210 216 211 if (ahci_iface->get_sata_device_name == NULL) { 217 async_answer_0(c handle, ENOTSUP);212 async_answer_0(call, ENOTSUP); 218 213 return; 219 214 } … … 224 219 char *sata_dev_name = malloc(sata_dev_name_length); 225 220 if (sata_dev_name == NULL) { 226 async_answer_0(c handle, ENOMEM);221 async_answer_0(call, ENOMEM); 227 222 return; 228 223 } … … 231 226 sata_dev_name_length, sata_dev_name); 232 227 228 ipc_call_t data; 233 229 size_t real_size; 234 cap_call_handle_t call_handle; 235 if ((async_data_read_receive(&call_handle, &real_size)) && 230 if ((async_data_read_receive(&data, &real_size)) && 236 231 (real_size == sata_dev_name_length)) 237 async_data_read_finalize( call_handle, sata_dev_name,232 async_data_read_finalize(&data, sata_dev_name, 238 233 sata_dev_name_length); 239 234 240 235 free(sata_dev_name); 241 async_answer_0(c handle, ret);236 async_answer_0(call, ret); 242 237 } 243 238 244 239 static void remote_ahci_get_num_blocks(ddf_fun_t *fun, void *iface, 245 cap_call_handle_t chandle,ipc_call_t *call)240 ipc_call_t *call) 246 241 { 247 242 const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface; 248 243 249 244 if (ahci_iface->get_num_blocks == NULL) { 250 async_answer_0(c handle, ENOTSUP);245 async_answer_0(call, ENOTSUP); 251 246 return; 252 247 } … … 256 251 257 252 if (ret != EOK) 258 async_answer_0(c handle, ret);253 async_answer_0(call, ret); 259 254 else 260 async_answer_2(c handle, EOK, HI(blocks), LO(blocks));255 async_answer_2(call, EOK, HI(blocks), LO(blocks)); 261 256 } 262 257 263 258 static void remote_ahci_get_block_size(ddf_fun_t *fun, void *iface, 264 cap_call_handle_t chandle,ipc_call_t *call)259 ipc_call_t *call) 265 260 { 266 261 const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface; 267 262 268 263 if (ahci_iface->get_block_size == NULL) { 269 async_answer_0(c handle, ENOTSUP);264 async_answer_0(call, ENOTSUP); 270 265 return; 271 266 } … … 275 270 276 271 if (ret != EOK) 277 async_answer_0(c handle, ret);272 async_answer_0(call, ret); 278 273 else 279 async_answer_1(chandle, EOK, blocks); 280 } 281 282 void remote_ahci_read_blocks(ddf_fun_t *fun, void *iface, 283 cap_call_handle_t chandle, ipc_call_t *call) 274 async_answer_1(call, EOK, blocks); 275 } 276 277 void remote_ahci_read_blocks(ddf_fun_t *fun, void *iface, ipc_call_t *call) 284 278 { 285 279 const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface; 286 280 287 281 if (ahci_iface->read_blocks == NULL) { 288 async_answer_0(chandle, ENOTSUP); 289 return; 290 } 291 282 async_answer_0(call, ENOTSUP); 283 return; 284 } 285 286 ipc_call_t data; 292 287 size_t maxblock_size; 293 288 unsigned int flags; 294 295 cap_call_handle_t call_handle; 296 async_share_out_receive(&call_handle, &maxblock_size, &flags); 289 async_share_out_receive(&data, &maxblock_size, &flags); 297 290 298 291 void *buf; 299 async_share_out_finalize( call_handle, &buf);292 async_share_out_finalize(&data, &buf); 300 293 301 294 const uint64_t blocknum = … … 306 299 const errno_t ret = ahci_iface->read_blocks(fun, blocknum, cnt, buf); 307 300 308 async_answer_0(chandle, ret); 309 } 310 311 void remote_ahci_write_blocks(ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, 312 ipc_call_t *call) 301 async_answer_0(call, ret); 302 } 303 304 void remote_ahci_write_blocks(ddf_fun_t *fun, void *iface, ipc_call_t *call) 313 305 { 314 306 const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface; 315 307 316 308 if (ahci_iface->read_blocks == NULL) { 317 async_answer_0(chandle, ENOTSUP); 318 return; 319 } 320 309 async_answer_0(call, ENOTSUP); 310 return; 311 } 312 313 ipc_call_t data; 321 314 size_t maxblock_size; 322 315 unsigned int flags; 323 324 cap_call_handle_t call_handle; 325 async_share_out_receive(&call_handle, &maxblock_size, &flags); 316 async_share_out_receive(&data, &maxblock_size, &flags); 326 317 327 318 void *buf; 328 async_share_out_finalize( call_handle, &buf);319 async_share_out_finalize(&data, &buf); 329 320 330 321 const uint64_t blocknum = … … 335 326 const errno_t ret = ahci_iface->write_blocks(fun, blocknum, cnt, buf); 336 327 337 async_answer_0(c handle, ret);328 async_answer_0(call, ret); 338 329 } 339 330
Note:
See TracChangeset
for help on using the changeset viewer.