mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:07:46 +00:00
Kernel/USB: Make USBControllers pseudo StorageControllers
This will be needed in the next commit to generate valid LUNs
This commit is contained in:
parent
4b327bdc95
commit
b857c6b92f
2 changed files with 15 additions and 0 deletions
|
@ -5,9 +5,15 @@
|
|||
*/
|
||||
|
||||
#include <Kernel/Bus/USB/USBController.h>
|
||||
#include <Kernel/Devices/Storage/StorageManagement.h>
|
||||
|
||||
namespace Kernel::USB {
|
||||
|
||||
USBController::USBController()
|
||||
: m_storage_controller_id(StorageManagement::generate_controller_id())
|
||||
{
|
||||
}
|
||||
|
||||
u8 USBController::allocate_address()
|
||||
{
|
||||
// FIXME: This can be smarter.
|
||||
|
|
|
@ -28,9 +28,18 @@ public:
|
|||
virtual ErrorOr<size_t> submit_bulk_transfer(Transfer& transfer) = 0;
|
||||
virtual ErrorOr<void> submit_async_interrupt_transfer(NonnullLockRefPtr<Transfer> transfer, u16 ms_interval) = 0;
|
||||
|
||||
u32 storage_controller_id() const { return m_storage_controller_id; }
|
||||
u8 allocate_address();
|
||||
|
||||
protected:
|
||||
USBController();
|
||||
|
||||
private:
|
||||
// Note: We are pseudo storage controller for the sake of generating LUNs
|
||||
// And do not follow a hardware_relative_controller_id for the controller class "USB",
|
||||
// as we also have to follow the device id and its internal LUN, leaving no room for that
|
||||
u32 m_storage_controller_id { 0 };
|
||||
|
||||
u8 m_next_device_index { 1 };
|
||||
|
||||
IntrusiveListNode<USBController, NonnullLockRefPtr<USBController>> m_controller_list_node;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue