Artemis Milestone 2f: SET_CONFIGURATION -- 2f complete
Chains off a confirmed Mass Storage/SCSI/BOT interface match via the existing next_action deferral mechanism: device descriptor -> config descriptor -> SET_CONFIGURATION is now a single automatic sequence. bConfigurationValue is read directly out of the already-fetched config_descriptor buffer, no extra transfer needed. First write control transfer this driver has issued (every prior one was a read), so it needed its own submission helper, xhci_ep0_control_write_nodata() -- SET_CONFIGURATION has no Data Stage (wLength=0), and per USB 2.0 spec 8.5.3 a no-data control transfer's Status Stage is always IN, the reverse of an OUT-data request's status stage. XHCI_SETUP_TRT_NO_DATA already existed in xhci.h, unused until now. Verified live via QMP hotplug, all three architectures, worked first try, byte-identical: "set configuration submitted" -> "device configured", guest stays running throughout (checked via QMP query-status). Disconnect confirmed clean on every arch afterward, no wedge. FABRIC-2.md Section X Milestone 2f updated -- 2f is now fully complete, 2g (Bulk-Only Transport) can start. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QPfdtaXs9ay1nbwuMnrscu
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
b9c540a78b
commit
b4bbd043d0
@@ -229,10 +229,12 @@ typedef struct {
|
||||
uint16_t wLength;
|
||||
} usb_setup_packet_t;
|
||||
|
||||
#define USB_REQ_GET_DESCRIPTOR 6u
|
||||
#define USB_DESC_TYPE_DEVICE 1u
|
||||
#define USB_DESC_TYPE_CONFIG 2u
|
||||
#define USB_DIR_DEVICE_TO_HOST 0x80u
|
||||
#define USB_REQ_GET_DESCRIPTOR 6u
|
||||
#define USB_REQ_SET_CONFIGURATION 9u
|
||||
#define USB_DESC_TYPE_DEVICE 1u
|
||||
#define USB_DESC_TYPE_CONFIG 2u
|
||||
#define USB_DIR_DEVICE_TO_HOST 0x80u
|
||||
#define USB_DIR_HOST_TO_DEVICE 0x00u
|
||||
|
||||
/* Standard USB Interface descriptor field offsets (9 bytes, USB 2.0 spec
|
||||
* table 9-12) -- Mass Storage class detection reads these three fields.
|
||||
@@ -249,6 +251,7 @@ typedef struct {
|
||||
#define USB_DESC_OFF_LENGTH 0u
|
||||
#define USB_DESC_OFF_TYPE 1u
|
||||
#define USB_CONFIG_OFF_TOTAL_LENGTH 2u /* wTotalLength, 2 bytes, Configuration descriptor only */
|
||||
#define USB_CONFIG_OFF_CONFIG_VALUE 5u /* bConfigurationValue -- the value SET_CONFIGURATION needs in wValue */
|
||||
#define USB_DESC_TYPE_INTERFACE 4u
|
||||
#define USB_IFACE_OFF_CLASS 5u
|
||||
#define USB_IFACE_OFF_SUBCLASS 6u
|
||||
|
||||
@@ -99,7 +99,8 @@ typedef struct {
|
||||
XHCI_XFER_NONE = 0,
|
||||
XHCI_XFER_DEVICE_DESC,
|
||||
XHCI_XFER_CONFIG_DESC_SHORT,
|
||||
XHCI_XFER_CONFIG_DESC_FULL
|
||||
XHCI_XFER_CONFIG_DESC_FULL,
|
||||
XHCI_XFER_SET_CONFIG
|
||||
} transfer_purpose;
|
||||
uint32_t pending_transfer_slot_id;
|
||||
uint8_t device_descriptor[18];
|
||||
@@ -120,10 +121,14 @@ typedef struct {
|
||||
enum {
|
||||
XHCI_NEXT_ACTION_NONE = 0,
|
||||
XHCI_NEXT_ACTION_GET_DEVICE_DESC,
|
||||
XHCI_NEXT_ACTION_GET_CONFIG_DESC
|
||||
XHCI_NEXT_ACTION_GET_CONFIG_DESC,
|
||||
XHCI_NEXT_ACTION_SET_CONFIG
|
||||
} next_action;
|
||||
uint32_t next_action_slot_id;
|
||||
uint16_t next_action_length;
|
||||
uint8_t next_action_config_value; /* SET_CONFIGURATION's wValue, staged by
|
||||
* the CONFIG_DESC_FULL handler once
|
||||
* bConfigurationValue is known */
|
||||
} xhci_dev_t;
|
||||
|
||||
/*
|
||||
@@ -267,4 +272,22 @@ int xhci_ep0_get_device_descriptor(xhci_dev_t *dev, uint32_t slot_id);
|
||||
*/
|
||||
int xhci_ep0_get_config_descriptor(xhci_dev_t *dev, uint32_t slot_id, uint16_t length);
|
||||
|
||||
/*
|
||||
* xhci_ep0_set_configuration — issue a SET_CONFIGURATION control transfer
|
||||
* (Setup + Status stage only, no Data stage)
|
||||
* with wValue = config_value. Moves the
|
||||
* device from Addressed into Configured
|
||||
* state -- required before any endpoint
|
||||
* other than EP0 (i.e. the bulk IN/OUT
|
||||
* endpoints 2g needs) can be used.
|
||||
*
|
||||
* Called once the Configuration descriptor read confirms a Mass Storage/
|
||||
* SCSI/BOT device, with config_value = that descriptor's own
|
||||
* bConfigurationValue field -- not called directly by other code.
|
||||
*
|
||||
* Returns 0 if the transfer was posted, -1 if dev/dev->ep0_ring is not
|
||||
* set up.
|
||||
*/
|
||||
int xhci_ep0_set_configuration(xhci_dev_t *dev, uint32_t slot_id, uint8_t config_value);
|
||||
|
||||
#endif /* STARKERNEL_XHCI_DRIVER_H */
|
||||
|
||||
Reference in New Issue
Block a user