Changeset 99e8fb7b in mainline for uspace/lib/drv/generic/remote_pci.c
- Timestamp:
- 2013-12-31T19:08:48Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7f620e8
- Parents:
- a44424f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_pci.c
ra44424f r99e8fb7b 41 41 #include "ddf/driver.h" 42 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_32 51 } 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 43 126 static void remote_config_space_read_8(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 44 127 static void remote_config_space_read_16(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
Note:
See TracChangeset
for help on using the changeset viewer.