Changes in uspace/lib/drv/generic/remote_pci.c [99e8fb7b:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_pci.c
r99e8fb7b r9d58539 36 36 #include <async.h> 37 37 #include <errno.h> 38 #include <macros.h>39 38 40 39 #include "pci_dev_iface.h" 41 40 #include "ddf/driver.h" 42 43 typedef enum {44 IPC_M_CONFIG_SPACE_READ_8,45 IPC_M_CONFIG_SPACE_READ_16,46 IPC_M_CONFIG_SPACE_READ_32,47 48 IPC_M_CONFIG_SPACE_WRITE_8,49 IPC_M_CONFIG_SPACE_WRITE_16,50 IPC_M_CONFIG_SPACE_WRITE_3251 } pci_dev_iface_funcs_t;52 53 int pci_config_space_read_8(async_sess_t *sess, uint32_t address, uint8_t *val)54 {55 sysarg_t res = 0;56 57 async_exch_t *exch = async_exchange_begin(sess);58 int rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),59 IPC_M_CONFIG_SPACE_READ_8, address, &res);60 async_exchange_end(exch);61 62 *val = (uint8_t) res;63 return rc;64 }65 66 int pci_config_space_read_16(async_sess_t *sess, uint32_t address,67 uint16_t *val)68 {69 sysarg_t res = 0;70 71 async_exch_t *exch = async_exchange_begin(sess);72 int rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),73 IPC_M_CONFIG_SPACE_READ_16, address, &res);74 async_exchange_end(exch);75 76 *val = (uint16_t) res;77 return rc;78 }79 80 int pci_config_space_read_32(async_sess_t *sess, uint32_t address,81 uint32_t *val)82 {83 sysarg_t res = 0;84 85 async_exch_t *exch = async_exchange_begin(sess);86 int rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),87 IPC_M_CONFIG_SPACE_READ_32, address, &res);88 async_exchange_end(exch);89 90 *val = (uint32_t) res;91 return rc;92 }93 94 int pci_config_space_write_8(async_sess_t *sess, uint32_t address, uint8_t val)95 {96 async_exch_t *exch = async_exchange_begin(sess);97 int rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),98 IPC_M_CONFIG_SPACE_WRITE_8, address, val);99 async_exchange_end(exch);100 101 return rc;102 }103 104 int pci_config_space_write_16(async_sess_t *sess, uint32_t address,105 uint16_t val)106 {107 async_exch_t *exch = async_exchange_begin(sess);108 int rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),109 IPC_M_CONFIG_SPACE_WRITE_16, address, val);110 async_exchange_end(exch);111 112 return rc;113 }114 115 int pci_config_space_write_32(async_sess_t *sess, uint32_t address,116 uint32_t val)117 {118 async_exch_t *exch = async_exchange_begin(sess);119 int rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),120 IPC_M_CONFIG_SPACE_WRITE_32, address, val);121 async_exchange_end(exch);122 123 return rc;124 }125 41 126 42 static void remote_config_space_read_8(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); … … 133 49 134 50 /** Remote USB interface operations. */ 135 static constremote_iface_func_ptr_t remote_pci_iface_ops [] = {136 [IPC_M_CONFIG_SPACE_READ_8] =remote_config_space_read_8,137 [IPC_M_CONFIG_SPACE_READ_16] =remote_config_space_read_16,138 [IPC_M_CONFIG_SPACE_READ_32] =remote_config_space_read_32,51 static remote_iface_func_ptr_t remote_pci_iface_ops [] = { 52 remote_config_space_read_8, 53 remote_config_space_read_16, 54 remote_config_space_read_32, 139 55 140 [IPC_M_CONFIG_SPACE_WRITE_8] =remote_config_space_write_8,141 [IPC_M_CONFIG_SPACE_WRITE_16] =remote_config_space_write_16,142 [IPC_M_CONFIG_SPACE_WRITE_32] =remote_config_space_write_3256 remote_config_space_write_8, 57 remote_config_space_write_16, 58 remote_config_space_write_32 143 59 }; 144 60 145 61 /** Remote USB interface structure. 146 62 */ 147 const remote_iface_t remote_pci_iface = { 148 .method_count = ARRAY_SIZE(remote_pci_iface_ops), 63 remote_iface_t remote_pci_iface = { 64 .method_count = sizeof(remote_pci_iface_ops) / 65 sizeof(remote_pci_iface_ops[0]), 149 66 .methods = remote_pci_iface_ops 150 67 };
Note:
See TracChangeset
for help on using the changeset viewer.