-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stub nsid1.ctl and a53io devices
- Loading branch information
Showing
5 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "io-device.hpp" | ||
#include "orbis/KernelAllocator.hpp" | ||
#include "orbis/file.hpp" | ||
#include "orbis/utils/Logs.hpp" | ||
#include <chrono> | ||
#include <thread> | ||
|
||
struct A53IoFile : orbis::File {}; | ||
|
||
static orbis::ErrorCode a53io_ioctl(orbis::File *file, std::uint64_t request, | ||
void *argp, orbis::Thread *thread) { | ||
|
||
ORBIS_LOG_FATAL("Unhandled a53io ioctl", request); | ||
return {}; | ||
} | ||
static orbis::ErrorCode a53io_read(orbis::File *file, orbis::Uio *uio, | ||
orbis::Thread *thread) { | ||
ORBIS_LOG_TODO(__FUNCTION__); | ||
|
||
std::this_thread::sleep_for(std::chrono::days(1)); | ||
return {}; | ||
} | ||
|
||
static const orbis::FileOps fileOps = { | ||
.ioctl = a53io_ioctl, | ||
.read = a53io_read, | ||
}; | ||
|
||
struct A53IoDevice : IoDevice { | ||
orbis::ErrorCode open(orbis::Ref<orbis::File> *file, const char *path, | ||
std::uint32_t flags, std::uint32_t mode, | ||
orbis::Thread *thread) override { | ||
auto newFile = orbis::knew<A53IoFile>(); | ||
newFile->ops = &fileOps; | ||
newFile->device = this; | ||
|
||
*file = newFile; | ||
return {}; | ||
} | ||
}; | ||
|
||
IoDevice *createA53IoCharacterDevice() { return orbis::knew<A53IoDevice>(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "io-device.hpp" | ||
#include "orbis/KernelAllocator.hpp" | ||
#include "orbis/file.hpp" | ||
#include "orbis/utils/Logs.hpp" | ||
#include "vfs.hpp" | ||
#include "../io-devices.hpp" | ||
#include <chrono> | ||
#include <thread> | ||
|
||
struct NsidCtlFile : orbis::File {}; | ||
|
||
static orbis::ErrorCode nsid_ctl_ioctl(orbis::File *file, std::uint64_t request, | ||
void *argp, orbis::Thread *thread) { | ||
|
||
if (request == 0x20003102) { | ||
ORBIS_LOG_ERROR(__FUNCTION__, "create ssd0 device"); | ||
vfs::addDevice("ssd0", createHddCharacterDevice(0x100000000)); | ||
} else { | ||
ORBIS_LOG_FATAL("Unhandled nsid_ctl ioctl", request); | ||
} | ||
|
||
|
||
return {}; | ||
} | ||
static orbis::ErrorCode nsid_ctl_read(orbis::File *file, orbis::Uio *uio, | ||
orbis::Thread *thread) { | ||
ORBIS_LOG_TODO(__FUNCTION__); | ||
|
||
std::this_thread::sleep_for(std::chrono::days(1)); | ||
return {}; | ||
} | ||
|
||
static const orbis::FileOps fileOps = { | ||
.ioctl = nsid_ctl_ioctl, | ||
.read = nsid_ctl_read, | ||
}; | ||
|
||
struct NsidCtlDevice : IoDevice { | ||
orbis::ErrorCode open(orbis::Ref<orbis::File> *file, const char *path, | ||
std::uint32_t flags, std::uint32_t mode, | ||
orbis::Thread *thread) override { | ||
auto newFile = orbis::knew<NsidCtlFile>(); | ||
newFile->ops = &fileOps; | ||
newFile->device = this; | ||
|
||
*file = newFile; | ||
return {}; | ||
} | ||
}; | ||
|
||
IoDevice *createNsidCtlCharacterDevice() { return orbis::knew<NsidCtlDevice>(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters