mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 06:26:49 +00:00
[orbis-kernel] stub ipmi server/client
This commit is contained in:
parent
482a61766e
commit
25d4e35509
4 changed files with 162 additions and 16 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include "evf.hpp"
|
||||
#include "ipmi.hpp"
|
||||
#include "osem.hpp"
|
||||
#include "utils/LinkedNode.hpp"
|
||||
#include "utils/SharedCV.hpp"
|
||||
|
|
@ -104,6 +105,28 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
std::pair<IpmiServer *, bool> createIpmiServer(utils::kstring name,
|
||||
std::uint32_t attrs,
|
||||
std::int32_t initCount,
|
||||
std::int32_t maxCount) {
|
||||
std::lock_guard lock(m_sem_mtx);
|
||||
auto [it, inserted] = mIpmiServers.try_emplace(std::move(name), nullptr);
|
||||
if (inserted) {
|
||||
it->second = knew<IpmiServer>(name);
|
||||
}
|
||||
|
||||
return {it->second.get(), inserted};
|
||||
}
|
||||
|
||||
Ref<IpmiServer> findIpmiServer(std::string_view name) {
|
||||
std::lock_guard lock(m_sem_mtx);
|
||||
if (auto it = mIpmiServers.find(name); it != mIpmiServers.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
enum {
|
||||
c_golden_ratio_prime = 2654404609u,
|
||||
c_umtx_chains = 512,
|
||||
|
|
@ -145,6 +168,9 @@ private:
|
|||
|
||||
shared_mutex m_sem_mtx;
|
||||
utils::kmap<utils::kstring, Ref<Semaphore>> m_semaphores;
|
||||
|
||||
shared_mutex mIpmiServerMtx;
|
||||
utils::kmap<utils::kstring, Ref<IpmiServer>> mIpmiServers;
|
||||
};
|
||||
|
||||
extern KernelContext &g_context;
|
||||
|
|
|
|||
19
orbis-kernel/include/orbis/ipmi.hpp
Normal file
19
orbis-kernel/include/orbis/ipmi.hpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#pragma once
|
||||
|
||||
#include "KernelAllocator.hpp"
|
||||
#include "utils/Rc.hpp"
|
||||
|
||||
namespace orbis {
|
||||
struct IpmiServer : RcBase {
|
||||
kstring name;
|
||||
|
||||
explicit IpmiServer(kstring name) : name(std::move(name)) {}
|
||||
};
|
||||
|
||||
struct IpmiClient : RcBase {
|
||||
Ref<IpmiServer> connection;
|
||||
kstring name;
|
||||
|
||||
explicit IpmiClient(kstring name) : name(std::move(name)) {}
|
||||
};
|
||||
} // namespace orbis
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
#include "orbis-config.hpp"
|
||||
|
||||
#include "../evf.hpp"
|
||||
#include "../ipmi.hpp"
|
||||
#include "../osem.hpp"
|
||||
#include "../thread/Thread.hpp"
|
||||
#include "../thread/types.hpp"
|
||||
|
|
@ -58,6 +59,7 @@ struct Process final {
|
|||
|
||||
utils::RcIdMap<EventFlag, sint, 4097, 1> evfMap;
|
||||
utils::RcIdMap<Semaphore, sint, 4097, 1> semMap;
|
||||
utils::RcIdMap<IpmiClient, sint, 4097, 1> ipmiClientMap;
|
||||
utils::RcIdMap<Module, ModuleHandle> modulesMap;
|
||||
utils::OwningIdMap<Thread, lwpid_t> threadsMap;
|
||||
utils::RcIdMap<orbis::File, sint> fileDescriptors;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue