Source tree reorganization: - Move StarForth v3 engine to v3/ (src/, include/, Makefile) - Move kernel to kernel/ (src/, include/, linker/, Makefile) - Create v4/ skeleton for F18-ISA golden model (DECOMPOSITION.md, JUSTIFICATION.md) - Move FABRIC-0..4.md to docs/fabric/ - Move ONTOLOGY.md and ROADMAP.md to docs/ Board infrastructure: - Add boards/ser5/, boards/raspi/, boards/milkv/, boards/zynq7020/ - Each board has board.mk (ISA, CPU flags, boot recipe) and README.md - Root Makefile becomes thin dispatcher: boot_image, all, clean, docs take TARGET - make boot_image TARGET=SER5|RASPI|MILKV builds one GPT/MBR image per board - ZYNQ7020 target exists but stops with clear error (ARMv7 port not built yet) - scripts/mkdiskimage.sh builds disk images for all boards Docs pipeline: - docs/book/ with LaTeX master (main.tex) and Makefile - pandoc converts Markdown to LaTeX at build time - Two Lua filters: table-widths.lua (wide tables wrap), code-breaks.lua (inline code breaks) - make docs builds single PDF (754 pages, 0 missing characters) - make docs TARGET=<board> adds board appendix - build/docs/<book|board>/meta.tex stamps git commit into PDF Bug fixes: - 42 include paths that only worked by accident now use correct relative paths - clang-18 hardcode replaced with configurable CC variable (fixed aarch64 build) - Pi 5: kernel_2712.img linked at 0x80000, .bss zeroed, memory reserved - Doxyfile, .clang-tidy, README.md, Kconfig paths updated Verified: - Hosted v3 build passes 1012 tests, 0 failures - SER5 image boots in QEMU (OVMF), POST passes, K exact (65536 = Q48_ONE) - Milk-V image boots in QEMU (OpenSBI + U-Boot + bootefi), POST passes - make clean TARGET=<board> removes only that board and its ISA objects - make all builds all boards, hosted v3, and docs in one run Co-authored-by: Junie <junie@jetbrains.com>
60 lines
2.8 KiB
C
60 lines
2.8 KiB
C
/*
|
|
* blkio_usb.h — USB Mass Storage (Bulk-Only Transport) blkio_dev backend
|
|
* for StarKernel, Milestone 2h. Presents a blkio_dev_t interface for
|
|
* attachment to the StarForth block subsystem via blk_subsys_attach_device(),
|
|
* matching virtio_blk.h's own precedent — built on top of the xHCI BOT
|
|
* driver's synchronous bridge (xhci_bot_wait_for_idle(), xhci_bot_get_capacity(),
|
|
* xhci_bot_read_block()) from Milestone 2h's foundational increment.
|
|
*
|
|
* Read-write since 2026-08-28 (FABRIC-2.md §F.1): SCSI WRITE(10) is real
|
|
* (xhci_bot_send_write10()/xhci_bot_write_block()/xhci_bot_write_data_out(),
|
|
* xhci.c), mirroring READ(10)'s existing CBW/data-stage/CSW machinery with
|
|
* the data direction flipped. Verified live on amd64: BLK-CONFIRM-FORMAT's
|
|
* BAM/reloc zero-page writes and an explicit block content write both
|
|
* survived a cold reboot and read back correctly.
|
|
*
|
|
* FABRIC-3.md §VII (2026-09-05): multiple simultaneously-attached USB MSC
|
|
* devices are now supported -- each open() call is backed by its own
|
|
* per-slot state (blkio_usb.c's own registry, keyed by xHCI slot ID,
|
|
* mirroring xhci_dev_t's msc_slots[]). The underlying xHCI/BOT command
|
|
* machinery still runs one bulk transfer at a time across the whole
|
|
* controller (real xHCI semantics, not a limitation introduced here) --
|
|
* see xhci_msc_slot_t's own doc comment for the persistent-vs-in-flight
|
|
* distinction this rests on.
|
|
*/
|
|
|
|
#ifndef STARKERNEL_BLKIO_USB_H
|
|
#define STARKERNEL_BLKIO_USB_H
|
|
|
|
#include <stdint.h>
|
|
#include "blkio.h"
|
|
#include "starkernel/xhci_driver.h"
|
|
|
|
/*
|
|
* blkio_usb_open_msc — synchronously query a confirmed Mass Storage/BOT
|
|
* device's capacity (SCSI READ CAPACITY(10), via
|
|
* xhci_bot_get_capacity() + xhci_bot_wait_for_idle())
|
|
* and fill in *dev_out so the caller can pass it to
|
|
* blk_subsys_attach_device().
|
|
*
|
|
* xdev/slot_id identify an already-enumerated, already-configured Mass
|
|
* Storage/BOT device (SET_CONFIGURATION already succeeded) — this function
|
|
* does not enumerate or configure anything itself.
|
|
*
|
|
* MUST be called from outside xhci_poll_events()'s own call frame, same
|
|
* constraint as xhci_bot_wait_for_idle() itself (see its own doc comment
|
|
* in xhci_driver.h) — this function calls it directly.
|
|
*
|
|
* dev_out must point to a zero-initialised blkio_dev_t.
|
|
*
|
|
* Returns 0 on success.
|
|
* Returns -1 if xdev/slot_id are invalid, or the capacity query didn't PASS.
|
|
* Returns -2 if the device's reported SCSI block size doesn't evenly divide
|
|
* BLKIO_FORTH_BLOCK_SIZE (1024) — this backend has no way to
|
|
* serve a partial Forth block, so it refuses rather than
|
|
* silently misbehaving.
|
|
*/
|
|
int blkio_usb_open_msc(blkio_dev_t *dev_out, xhci_dev_t *xdev, uint32_t slot_id);
|
|
|
|
#endif /* STARKERNEL_BLKIO_USB_H */
|