MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / sysIpmiClientInvokeSyncMethod

Method sysIpmiClientInvokeSyncMethod

kernel/orbis/src/ipmi.cpp:889–1034  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

887}
888
889orbis::SysResult
890orbis::sysIpmiClientInvokeSyncMethod(Thread *thread, ptr<uint> result, uint kid,
891 ptr<void> params, uint64_t paramsSz) {
892 if (paramsSz != sizeof(IpmiSyncCallParams)) {
893 return ErrorCode::INVAL;
894 }
895
896 IpmiSyncCallParams _params;
897 ORBIS_RET_ON_ERROR(uread(_params, (ptr<IpmiSyncCallParams>)params));
898
899 if (_params.flags > 1) {
900 return ErrorCode::INVAL;
901 }
902
903 auto client = g_context->ipmiMap.get(kid).cast<IpmiClient>();
904
905 if (client == nullptr) {
906 return ErrorCode::INVAL;
907 }
908
909 auto session = client->session;
910
911 if (session == nullptr) {
912 return ErrorCode::INVAL;
913 }
914
915 std::lock_guard sessionLock(session->mutex);
916 auto server = session->server;
917
918 if (server == nullptr) {
919 return ErrorCode::INVAL;
920 }
921
922 {
923 std::lock_guard serverLock(server->mutex);
924
925 std::size_t inSize = 0;
926 for (auto &data : std::span(_params.pInData, _params.numInData)) {
927 inSize += data.size;
928 }
929
930 auto headerSize = sizeof(IpmiSyncMessageHeader) + inSize +
931 _params.numInData * sizeof(uint32_t);
932 auto size = headerSize + _params.numOutData * sizeof(uint);
933
934 kvector<std::byte> message(size);
935 auto msg = new (message.data()) IpmiSyncMessageHeader;
936 msg->sessionImpl = session->sessionImpl;
937 msg->pid = thread->tproc->pid;
938 msg->methodId = _params.method;
939 msg->numInData = _params.numInData;
940 msg->numOutData = _params.numOutData;
941
942 auto bufLoc = std::bit_cast<char *>(msg + 1);
943
944 for (auto &data : std::span(_params.pInData, _params.numInData)) {
945 *std::bit_cast<uint32_t *>(bufLoc) = data.size;
946 bufLoc += sizeof(uint32_t);

Callers

nothing calls this directly

Calls 13

ureadFunction · 0.85
ureadRawFunction · 0.85
uwriteFunction · 0.85
uwriteRawFunction · 0.85
push_backMethod · 0.80
getMethod · 0.45
dataMethod · 0.45
notify_oneMethod · 0.45
waitMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected