Read USB mass storage sector count and sector size!

This commit is contained in:
2026-04-06 01:00:54 +02:00
parent 90217168be
commit 1cb1bad3dd
17 changed files with 800 additions and 347 deletions

View File

@@ -2,7 +2,10 @@
#define _KERNEL_DEVICE_USB_H
#include <aux/compiler.h>
#include <device/device.h>
#include <libk/std.h>
#include <proc/proc.h>
#include <proc/reschedule.h>
#define USB_DRIVER_MAX_MATCHES 1
@@ -21,6 +24,9 @@
#define USB_DESC_DEV_CAPABILITY 16
#define USB_DESC_SS_USB_EP_COMP 48
struct xhci;
struct xhci_usb_device;
struct usb_desc_hdr {
uint8_t length;
uint8_t desc_type;
@@ -77,34 +83,12 @@ struct usb_endpoint_desc {
uint8_t interval;
} PACKED;
#define USB_CBW_SIGNATURE 0x43425355
/* command block wrapper */
struct usb_cbw {
uint32_t signature;
uint32_t tag;
uint32_t length;
uint8_t dir;
uint8_t lun;
uint8_t cmd_len;
uint8_t data[16];
} PACKED;
#define USB_CSW_SIGNATURE 0x53425355
/* command status wrapper */
struct usb_csw {
uint32_t signature;
uint32_t tag;
uint32_t residue;
uint8_t status;
};
struct usb_driver_info {
uint8_t if_class;
uint8_t if_subclass;
uint8_t if_proto;
bool (*init) (void);
struct device* (*init) (struct xhci* xhci, struct xhci_usb_device* usb_device, struct proc* proc,
struct reschedule_ctx* rctx, uint64_t* lockflags);
};
extern struct usb_driver_info usb_driver_infos[USB_DRIVER_MAX_MATCHES];