Feature/sotrage system overhaul #73

Open
Aaron wants to merge 21 commits from feature/sotrage-system-overhaul into develop
pull from: feature/sotrage-system-overhaul
3 changed files with 149 additions and 290 deletions
Showing only changes of commit d318eca262 - Show all commits

No files matched your search

+1 -10
View File
@@ -14,7 +14,7 @@ The I/O model operates as follows:
- `storage_read` / `storage_write` are convenience wrappers that build a stack-local `TIORequest` and call `submit_io_wait`.
- `storage_read_async` / `storage_write_async` build and submit a request with a caller-supplied callback, returning immediately.
Legacy `storage_read_legacy` / `storage_write_legacy` procedure wrappers are retained for callers not yet migrated to the function-returning API.
Blocking callers use `storage_read` / `storage_write` and check the returned `TError`.
## Dependencies
@@ -205,15 +205,6 @@ function storage_write_async(device : PStorage_Device; addr : uint32; sectors :
Non-blocking write. Analogous to `storage_read_async`.
### storage_read_legacy / storage_write_legacy
```pascal
procedure storage_read_legacy(device : PStorage_Device; addr : uint32; sectors : uint32; buffer : puint32);
procedure storage_write_legacy(device : PStorage_Device; addr : uint32; sectors : uint32; buffer : puint32);
```
Drop-in procedure replacements for callers using the old void-returning API. Forward to `storage_read` / `storage_write` and discard the error code. Marked for removal once all callers are migrated.
## Notes
- `dispatch_next` is an internal procedure called with interrupts disabled. It dequeues the head of the CFIFO, allocates a heap copy via `ioreq_copy` (for ISR safety), and invokes the appropriate `dispatchRead` or `dispatchWrite` on the device. If neither dispatch pointer is set, the request is failed with `eDeviceNotFound`.
+6 -23
View File
@@ -19,14 +19,14 @@
and provides the submit_io / complete_io request-based I/O path.
Device drivers call register_device() when they discover a new device.
Phase 2 I/O model:
Request-based I/O model:
- submit_io enqueues a TIORequest into the device's per-device CFIFO,
dispatches to hardware, and sleeps the calling task (proc_await).
- complete_io is called from ISR/completion context, wakes the caller.
dispatches to hardware, and returns without waiting for completion.
- complete_io delivers callbacks from the driver's completion context.
- storage_read / storage_write are thin wrappers that build a stack-local
TIORequest, call submit_io, and return the resulting TError.
- Legacy sync/async callbacks are still supported as fallback for drivers
not yet migrated to the TDriverDispatch interface.
TIORequest, call submit_io_wait, and return the resulting TError.
- Drivers must provide the TDriverDispatch interface; there is no legacy
callback fallback.
@author(Aaron Hance <[email protected]>)
}
@@ -112,12 +112,6 @@ function storage_read_async(device : PStorage_Device; addr : uint32; sectors : u
function storage_write_async(device : PStorage_Device; addr : uint32; sectors : uint32;
buffer : puint32; callback : TIOCallback; callbackData : pointer) : TError;
{ Legacy wrappers — procedure signatures matching the old API.
Forward to the new functions, silently discard errors.
TODO: migrate all callers and remove these. }
procedure storage_read_legacy(device : PStorage_Device; addr : uint32; sectors : uint32; buffer : puint32);
procedure storage_write_legacy(device : PStorage_Device; addr : uint32; sectors : uint32; buffer : puint32);
implementation
uses
@@ -744,17 +738,6 @@ begin
storage_write_async := submit_io(@req);
end;
{ Legacy procedure wrappers — drop-in replacements for old callers }
procedure storage_read_legacy(device : PStorage_Device; addr : uint32; sectors : uint32; buffer : puint32);
begin
storage_read(device, addr, sectors, buffer);
end;
procedure storage_write_legacy(device : PStorage_Device; addr : uint32; sectors : uint32; buffer : puint32);
begin
storage_write(device, addr, sectors, buffer);
end;
initialization
boot.mgr.registerBoot('driver.storage.mgr', @init, 'Storage Manager', 'driver.storage.vfs');
File diff suppressed because it is too large. Load diff