mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:37:43 +00:00
Kernel: Implement an asynchronous device request stack
This allows issuing asynchronous requests for devices and waiting on the completion of the request. The requests can cascade into multiple sub-requests. Since IRQs may complete at any time, if the current process is no longer the same that started the process, we need to swich the paging context before accessing user buffers. Change the PATA driver to use this model.
This commit is contained in:
parent
96081010dc
commit
2fd5ce1eb0
17 changed files with 804 additions and 246 deletions
|
@ -54,13 +54,10 @@ public:
|
|||
static NonnullRefPtr<PATADiskDevice> create(PATAChannel&, DriveType, int major, int minor);
|
||||
virtual ~PATADiskDevice() override;
|
||||
|
||||
// ^DiskDevice
|
||||
virtual bool read_blocks(unsigned index, u16 count, UserOrKernelBuffer&) override;
|
||||
virtual bool write_blocks(unsigned index, u16 count, const UserOrKernelBuffer&) override;
|
||||
|
||||
void set_drive_geometry(u16, u16, u16);
|
||||
|
||||
// ^BlockDevice
|
||||
virtual void start_request(AsyncBlockDeviceRequest&) override;
|
||||
virtual KResultOr<size_t> read(FileDescription&, size_t, UserOrKernelBuffer&, size_t) override;
|
||||
virtual bool can_read(const FileDescription&, size_t) const override;
|
||||
virtual KResultOr<size_t> write(FileDescription&, size_t, const UserOrKernelBuffer&, size_t) override;
|
||||
|
@ -73,11 +70,6 @@ private:
|
|||
// ^DiskDevice
|
||||
virtual const char* class_name() const override;
|
||||
|
||||
bool wait_for_irq();
|
||||
bool read_sectors_with_dma(u32 lba, u16 count, UserOrKernelBuffer&);
|
||||
bool write_sectors_with_dma(u32 lba, u16 count, const UserOrKernelBuffer&);
|
||||
bool read_sectors(u32 lba, u16 count, UserOrKernelBuffer& buffer);
|
||||
bool write_sectors(u32 lba, u16 count, const UserOrKernelBuffer& data);
|
||||
bool is_slave() const;
|
||||
|
||||
Lock m_lock { "IDEDiskDevice" };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue