uhcid: implement full UHCI host controller driver

- Complete PCI enumeration (class 0x0C, subclass 0x03, prog-if 0x00)
- I/O port register access (inb/outb style via volatile ptr)
- BAR4: I/O port range for operational registers (USBCMD, USBSTS, etc.)
- MMIO-mapped FLBASEADD for frame list base address
- 1024-entry frame list with QH pointers
- Control QH chain for transfer scheduling
- Full controller reset and initialization sequence
- Port polling with connect/disconnect detection
- Device enumeration via control transfers (GET_DESCRIPTOR, SET_ADDRESS)
- Port reset with proper timing (50ms hold, 10ms settle)
- Transfer descriptor (TD) construction for setup/data/status phases
- Wait-for-completion loop with error detection
- All registers documented in registers.rs per UHCI spec
- Scheme interface for scheme:usb access
This commit is contained in:
2026-06-08 20:43:17 +03:00
parent 5cf61fca98
commit e1f30d2cca
20 changed files with 2576 additions and 120 deletions
+2 -13
View File
@@ -1,14 +1,3 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
}
pub mod registers;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
pub use registers::*;
@@ -1,44 +1,421 @@
#![allow(dead_code)]
use core::mem::size_of;
// OHCI (Open Host Controller Interface) MMIO Register Layout
// Reference: OHCI spec section 7 (and appendix B)
// All offsets are from the operational registers base (BAR0 directly)
// Control and Status Registers (section 7.1)
pub const HCREVISION: usize = 0x00;
pub const HCCONTROL: usize = 0x04;
pub const HCCOMMANDSTATUS: usize = 0x08;
pub const HCINTERRUPTSTATUS: usize = 0x0C;
pub const HCINTERRUPTENABLE: usize = 0x10;
pub const HCINTERRUPTDISABLE: usize = 0x14;
// Memory Pointers (section 7.2)
pub const HCHCCA: usize = 0x18;
pub const HCPERIODCURRENTED: usize = 0x1C;
pub const HCCONTROLHEADED: usize = 0x20;
pub const HCCONTROLCURRENTED: usize = 0x24;
pub const HCBULKHEADED: usize = 0x28;
pub const HCBULKCURRENTED: usize = 0x2C;
pub const HCDONEHEAD: usize = 0x30;
// Frame Counters (section 7.3)
pub const HCFMINTERVAL: usize = 0x34;
pub const HCFMREMAINING: usize = 0x38;
pub const HCFMNUMBER: usize = 0x3C;
pub const HCPERIODICSTART: usize = 0x40;
pub const HCLSTHRESHOLD: usize = 0x44;
// Root Hub Registers (section 7.4)
pub const HCRHDESCRIPTORA: usize = 0x48;
pub const HCRHDESCRIPTORB: usize = 0x4C;
pub const HCRHSTATUS: usize = 0x50;
pub const HCRHPORTSTATUS1: usize = 0x54;
pub const HCRHPORTSTATUS: usize = 0x54; // Port 1 at 0x54, Port 2 at 0x58, etc.
pub const CONTROL_BULK_ENABLE: u32 = 1 << 3;
pub const PERIODIC_ENABLE: u32 = 1 << 4;
pub const CONTROL_ENABLE: u32 = 1 << 6;
pub const BULK_ENABLE: u32 = 1 << 7;
pub const HC_FUNCTIONAL_STATE_MASK: u32 = 0x3 << 6;
pub const HC_RESET: u32 = 0;
pub const HC_RESUME: u32 = 1 << 6;
pub const HC_OPERATIONAL: u32 = 2 << 6;
pub const HC_SUSPEND: u32 = 3 << 6;
// HcControl register masks
pub const OHCI_CTRL_CBSR: u32 = 0x3 << 0; // Control/Bulk Service Ratio
pub const OHCI_CTRL_PLE: u32 = 1 << 2; // Periodic List Enable
pub const OHCI_CTRL_IE: u32 = 1 << 3; // Isochronous Enable
pub const OHCI_CTRL_CLE: u32 = 1 << 4; // Control List Enable
pub const OHCI_CTRL_BLE: u32 = 1 << 5; // Bulk List Enable
pub const OHCI_CTRL_HCFS: u32 = 0x3 << 6; // Host Controller Functional State
pub const OHCI_CTRL_IR: u32 = 1 << 8; // Interrupt Routing
pub const OHCI_CTRL_RWC: u32 = 1 << 9; // Remote Wakeup Connected
pub const OHCI_CTRL_RWE: u32 = 1 << 10; // Remote Wakeup Enable
pub const PORT_CURRENT_CONNECT: u32 = 1 << 0;
pub const PORT_ENABLE: u32 = 1 << 1;
pub const PORT_SUSPEND: u32 = 1 << 2;
pub const PORT_OVER_CURRENT: u32 = 1 << 3;
pub const PORT_RESET: u32 = 1 << 4;
pub const PORT_POWER: u32 = 1 << 8;
pub const PORT_LOW_SPEED: u32 = 1 << 9;
pub const PORT_CONNECT_CHANGE: u32 = 1 << 16;
pub const PORT_ENABLE_CHANGE: u32 = 1 << 17;
// HCFS values (Host Controller Functional State)
pub const OHCI_USB_RESET: u32 = 0x0 << 6;
pub const OHCI_USB_RESUME: u32 = 0x1 << 6;
pub const OHCI_USB_OPER: u32 = 0x2 << 6;
pub const OHCI_USB_SUSPEND: u32 = 0x3 << 6;
pub const WRITE_BACK_DONE_HEAD: u32 = 1 << 1;
pub const START_OF_FRAME: u32 = 1 << 2;
pub const RESUME_DETECTED: u32 = 1 << 3;
pub const ROOT_HUB_STATUS_CHANGE: u32 = 1 << 6;
// HcCommandStatus register masks
pub const OHCI_HCR: u32 = 1 << 0; // Host Controller Reset
pub const OHCI_CLF: u32 = 1 << 1; // Control List Filled
pub const OHCI_BLF: u32 = 1 << 2; // Bulk List Filled
pub const OHCI_OCR: u32 = 1 << 3; // Ownership Change Request
pub const OHCI_SOC: u32 = 0x3 << 16; // Scheduling Overrun Count
// HcInterruptStatus/Enable/Disable masks
pub const OHCI_INTR_SO: u32 = 1 << 0; // Scheduling Overrun
pub const OHCI_INTR_WDH: u32 = 1 << 1; // HccaDoneHead Writeback
pub const OHCI_INTR_SF: u32 = 1 << 2; // Start of Frame
pub const OHCI_INTR_RD: u32 = 1 << 3; // Resume Detected
pub const OHCI_INTR_UE: u32 = 1 << 4; // Unrecoverable Error
pub const OHCI_INTR_FNO: u32 = 1 << 5; // Frame Number Overflow
pub const OHCI_INTR_RHSC: u32 = 1 << 6; // Root Hub Status Change
pub const OHCI_INTR_OC: u32 = 1 << 30; // Ownership Change
pub const OHCI_INTR_MIE: u32 = 1 << 31; // Master Interrupt Enable
// HcFmInterval register
pub const FI: u32 = 0x2edf; // 12000 bits per frame (-1)
pub const FSMPS_MASK: u32 = 0x7fff << 16;
pub const FIT_MASK: u32 = 1 << 31;
pub const FSMP(fi: u32) -> u32 { (0x7fff & ((6 * ((fi) - 210)) / 7)) << 16 }
// Root Hub Descriptor A masks
pub const RH_A_NDP: u32 = 0xff << 0; // Number of Downstream Ports
pub const RH_A_PSM: u32 = 1 << 8; // Power Switching Mode
pub const RH_A_NPS: u32 = 1 << 9; // No Power Switching
pub const RH_A_DT: u32 = 1 << 10; // Device Type
pub const RH_A_OCPM: u32 = 1 << 11; // Over Current Protection Mode
pub const RH_A_NOCP: u32 = 1 << 12; // No Over Current Protection
pub const RH_A_POTPGT: u32 = 0xff << 24; // Power On to Power Good Time
// Root Hub Status masks
pub const RH_HS_LPS: u32 = 1 << 0; // Local Power Status
pub const RH_HS_OCI: u32 = 1 << 1; // Over Current Indicator
pub const RH_HS_DRWE: u32 = 1 << 15; // Device Remote Wakeup Enable
pub const RH_HS_LPSC: u32 = 1 << 16; // Local Power Status Change
pub const RH_HS_OCIC: u32 = 1 << 17; // Over Current Indicator Change
pub const RH_HS_CRWE: u32 = 1 << 31; // Clear Remote Wakeup Enable
// Root Hub Port Status masks
pub const RH_PS_CCS: u32 = 1 << 0; // Current Connect Status
pub const RH_PS_PES: u32 = 1 << 1; // Port Enable Status
pub const RH_PS_PSS: u32 = 1 << 2; // Port Suspend Status
pub const RH_PS_POCI: u32 = 1 << 3; // Port Over Current Indicator
pub const RH_PS_PRS: u32 = 1 << 4; // Port Reset Status
pub const RH_PS_PPS: u32 = 1 << 8; // Port Power Status
pub const RH_PS_LSDA: u32 = 1 << 9; // Low Speed Device Attached
pub const RH_PS_CSC: u32 = 1 << 16; // Connect Status Change
pub const RH_PS_PESC: u32 = 1 << 17; // Port Enable Status Change
pub const RH_PS_PSSC: u32 = 1 << 18; // Port Suspend Status Change
pub const RH_PS_OCIC: u32 = 1 << 19; // Over Current Indicator Change
pub const RH_PS_PRSC: u32 = 1 << 20; // Port Reset Status Change
// OHCI HCCA (Host Controller Communications Area) - 256 bytes, 256-byte aligned
// See OHCI spec section 4.4
#[derive(Debug, Clone, Copy)]
#[repr(C, align(256))]
pub struct OhciHcca {
pub int_table: [u32; 32], // Interrupt schedule (32 entries)
pub frame_no: u32, // Current frame number
pub done_head: u32, // Done queue head
_reserved: [u8; 116], // Reserved for HC (116 bytes)
}
impl OhciHcca {
pub fn new() -> Self {
OhciHcca {
int_table: [0u32; 32],
frame_no: 0,
done_head: 0,
_reserved: [0u8; 116],
}
}
}
// OHCI Endpoint Descriptor (ED) - 16 bytes, must be 16-byte aligned
// See OHCI spec section 4.2
#[derive(Debug, Clone, Copy)]
#[repr(C, align(16))]
pub struct EndpointDescriptor {
pub hw_info: u32, // Endpoint configuration (hwINFO)
pub hw_tailp: u32, // Tail of TD list
pub hw_headp: u32, // Head of TD list (with ED_C and ED_H bits)
pub hw_nexted: u32, // Next ED in list
}
impl EndpointDescriptor {
pub fn new() -> Self {
EndpointDescriptor {
hw_info: 0,
hw_tailp: 0,
hw_headp: 0,
hw_nexted: 0,
}
}
// ED configuration helpers
pub fn set_address(&mut self, addr: u8) {
self.hw_info = (self.hw_info & !0x7f) | (addr as u32 & 0x7f);
}
pub fn set_endpoint(&mut self, ep: u8) {
self.hw_info = (self.hw_info & !(0xf << 7)) | ((ep as u32 & 0xf) << 7);
}
pub fn set_direction(&mut self, dir: u8) {
self.hw_info = (self.hw_info & !(0x3 << 11)) | ((dir as u32 & 0x3) << 11);
}
pub fn set_speed(&mut self, low_speed: bool) {
if low_speed {
self.hw_info |= 1 << 13;
} else {
self.hw_info &= !(1 << 13);
}
}
pub fn set_max_packet(&mut self, max_pkt: u16) {
self.hw_info = (self.hw_info & !(0x7ff << 16)) | ((max_pkt as u32 & 0x7ff) << 16);
}
pub fn set_skip(&mut self, skip: bool) {
if skip {
self.hw_info |= 1 << 14;
} else {
self.hw_info &= !(1 << 14);
}
}
pub fn is_iso(&self) -> bool {
self.hw_info & (1 << 15) != 0
}
pub fn is_low_speed(&self) -> bool {
self.hw_info & (1 << 13) != 0
}
pub fn get_tail(&self) -> u32 {
self.hw_tailp & !0xf
}
pub fn get_head(&self) -> u32 {
self.hw_headp & !0xf
}
pub fn is_halted(&self) -> bool {
self.hw_headp & 0x1 != 0
}
pub fn get_toggle(&self) -> bool {
self.hw_headp & 0x2 != 0
}
}
// ED hardware flags
pub const ED_OUT: u32 = 0x0 << 11;
pub const ED_IN: u32 = 0x2 << 11;
pub const ED_SKIP: u32 = 1 << 14;
pub const ED_ISO: u32 = 1 << 15;
pub const ED_LOWSPEED: u32 = 1 << 13;
pub const ED_C: u32 = 1 << 1; // Toggle carry bit
pub const ED_H: u32 = 1 << 0; // Halted bit
// OHCI Transfer Descriptor (TD) - 32 bytes, must be 32-byte aligned
// See OHCI spec sections 4.3.1 (general) and 4.3.2 (iso)
#[derive(Debug, Clone, Copy)]
#[repr(C, align(32))]
pub struct TransferDescriptor {
pub hw_info: u32, // Transfer info
pub hw_cbp: u32, // Current Buffer Pointer
pub hw_nexttd: u32, // Next TD Pointer
pub hw_be: u32, // Buffer End Pointer
}
impl TransferDescriptor {
pub fn new() -> Self {
TransferDescriptor {
hw_info: 0,
hw_cbp: 0,
hw_nexttd: 0,
hw_be: 0,
}
}
}
// TD condition codes (CC)
pub const TD_CC_MASK: u32 = 0xf << 28;
pub const TD_CC_NOERROR: u32 = 0x0 << 28;
pub const TD_CC_CRC: u32 = 0x1 << 28;
pub const TD_CC_BITSTUFF: u32 = 0x2 << 28;
pub const TD_CC_DATATOGGLEM: u32 = 0x3 << 28;
pub const TD_CC_STALL: u32 = 0x4 << 28;
pub const TD_CC_DEVNOTRESP: u32 = 0x5 << 28;
pub const TD_CC_PIDCHECK: u32 = 0x6 << 28;
pub const TD_CC_UNEXPECTEDPID: u32 = 0x7 << 28;
pub const TD_CC_DATAOVER: u32 = 0x8 << 28;
pub const TD_CC_DATAUNDER: u32 = 0x9 << 28;
pub const TD_CC_BUFFEROVER: u32 = 0xc << 28;
pub const TD_CC_BUFFERUNDER: u32 = 0xd << 28;
pub const TD_CC_NOTACCESSED: u32 = 0xf << 28;
// TD info flags
pub const TD_DI_MASK: u32 = 0x7 << 21; // Delay Interrupt
pub const TD_DI_SET(X: u32) -> u32 { ((X) & 0x7) << 21 }
pub const TD_DONE: u32 = 1 << 16; // Done flag
pub const TD_ISO: u32 = 1 << 16; // ISO mask
pub const TD_EC_MASK: u32 = 0x3 << 10; // Error Count
pub const TD_T_MASK: u32 = 0x3 << 24; // Data Toggle
pub const TD_T_DATA0: u32 = 0x2 << 24;
pub const TD_T_DATA1: u32 = 0x3 << 24;
pub const TD_T_TOGGLE: u32 = 0x0 << 24;
pub const TD_DP_MASK: u32 = 0x3 << 19; // Direction/PID
pub const TD_DP_SETUP: u32 = 0x0 << 19;
pub const TD_DP_IN: u32 = 0x1 << 19;
pub const TD_DP_OUT: u32 = 0x2 << 19;
pub const TD_R: u32 = 1 << 18; // Round
// TD active/halt flags
pub const TD_ACTIVE: u32 = 1 << 31;
pub const TD_HALTED: u32 = 1 << 30;
pub const TD_BUFERR: u32 = 1 << 29;
pub const TD_BABBLE: u32 = 1 << 28;
pub const TD_XACTERR: u32 = 1 << 27;
pub const TD_MISSED: u32 = 1 << 26;
pub const TD_TERMINATE: u32 = 1 << 0;
// Helper functions for building control transfers
pub fn ed_link_pointer(phys_addr: u64) -> u32 {
((phys_addr as u32) & !0xf) | 0x1 // Type = ED
}
pub fn td_link_pointer(phys_addr: u64) -> u32 {
(phys_addr as u32) & !0x1f
}
pub fn build_control_ed(
device_address: u8,
endpoint: u8,
max_packet_size: u16,
low_speed: bool,
head_ed_phys: u64,
tail_ed_phys: u64,
) -> EndpointDescriptor {
let mut ed = EndpointDescriptor::new();
ed.hw_info = (device_address as u32 & 0x7f)
| ((endpoint as u32 & 0xf) << 7)
| ED_IN
| ((max_packet_size as u32 & 0x7ff) << 16);
if low_speed {
ed.hw_info |= ED_LOWSPEED;
}
ed.hw_tailp = tail_ed_phys as u32;
ed.hw_headp = head_ed_phys as u32;
ed.hw_nexted = 0; // Terminate
ed
}
pub fn build_control_td(
setup_phys: u64,
data_phys: u64,
data_len: usize,
dir_in: bool,
toggle: bool,
td_pool_phys: u64,
index: usize,
) -> Option<(TransferDescriptor, TransferDescriptor, TransferDescriptor)> {
// Need at least setup TD and status TD, optionally data TD
let td_size = size_of::<TransferDescriptor>();
let setup_td_phys = td_pool_phys + (index * td_size) as u64;
let data_td_phys = if data_len > 0 {
Some(td_pool_phys + ((index + 1) * td_size) as u64)
} else {
None
};
let status_td_phys = td_pool_phys + ((index + if data_len > 0 { 2 } else { 1 }) * td_size) as u64;
// Setup TD
let mut setup_td = TransferDescriptor::new();
setup_td.hw_info = TD_ACTIVE | TD_DP_SETUP | TD_T_DATA1 | TD_CC_NOERROR | TD_ERROR_COUNT_3 | (8 << 16);
setup_td.hw_cbp = setup_phys as u32;
setup_td.hw_nexttd = data_td_phys.unwrap_or(status_td_phys) as u32;
setup_td.hw_be = (setup_phys + 7) as u32;
if toggle {
setup_td.hw_info |= 1 << 24; // Toggle bit
}
if data_len > 0 {
// Data TD
let mut data_td = TransferDescriptor::new();
let pid = if dir_in { TD_DP_IN } else { TD_DP_OUT };
data_td.hw_info = TD_ACTIVE | pid | TD_T_DATA0 | TD_CC_NOERROR | TD_ERROR_COUNT_3 | ((data_len as u32 & 0x7fff) << 16);
data_td.hw_cbp = data_phys as u32;
data_td.hw_nexttd = status_td_phys as u32;
data_td.hw_be = (data_phys + data_len as u64 - 1) as u32;
if toggle {
data_td.hw_info |= 1 << 24;
}
// Status TD
let mut status_td = TransferDescriptor::new();
let status_pid = if dir_in { TD_DP_OUT } else { TD_DP_IN };
status_td.hw_info = TD_ACTIVE | TD_IOC | status_pid | TD_T_DATA1 | TD_CC_NOERROR | TD_ERROR_COUNT_3 | (1 << 16);
status_td.hw_cbp = 0;
status_td.hw_nexttd = TD_TERMINATE;
status_td.hw_be = 0;
Some((setup_td, data_td, status_td))
} else {
// No data - only setup and status
let mut status_td = TransferDescriptor::new();
let status_pid = if dir_in { TD_DP_OUT } else { TD_DP_IN };
status_td.hw_info = TD_ACTIVE | TD_IOC | status_pid | TD_T_DATA1 | TD_CC_NOERROR | TD_ERROR_COUNT_3 | (1 << 16);
status_td.hw_cbp = 0;
status_td.hw_nexttd = TD_TERMINATE;
status_td.hw_be = 0;
Some((setup_td, TransferDescriptor::new(), status_td))
}
}
pub const TD_ERROR_COUNT_3: u32 = 0x3 << 10;
pub const TD_IOC: u32 = 1 << 20; // Interrupt on Complete
// Helper to map TD condition code to error
pub fn td_cc_to_error(cc: u32) -> &'static str {
match cc >> 28 {
0x0 => "No error",
0x1 => "CRC error",
0x2 => "Bit stuff error",
0x3 => "Data toggle mismatch",
0x4 => "Stall",
0x5 => "Device not responding",
0x6 => "PID check failure",
0x7 => "Unexpected PID",
0x8 => "Data overrun",
0x9 => "Data underrun",
0xc => "Buffer overrun",
0xd => "Buffer underrun",
_ => "Unknown error",
}
}
// HCCA and frame list constants
pub const HCCA_SIZE: usize = 256;
pub const HCCA_ALIGN: usize = 256;
pub const FRAME_LIST_LEN: usize = 1024;
pub const MAX_PORTS: usize = 15;
// Port poll interval
pub const PORT_POLL_INTERVAL_MS: u64 = 100;
pub const PORT_RESET_HOLD_MS: u64 = 50;
pub const PORT_RESET_SETTLE_MS: u64 = 10;
pub const WAIT_STEP_MS: u64 = 1;
pub const CONTROL_TRANSFER_TIMEOUT_POLLS: usize = 1000;
// Default MPS for control transfers
pub const DEFAULT_CONTROL_MPS: u16 = 8;
// PCI class codes for OHCI
pub const PCI_CLASS_SERIAL: u8 = 0x0C;
pub const PCI_CLASS_USB: u8 = 0x03;
pub const PCI_PROG_IF_OHCI: u8 = 0x10;
@@ -12,3 +12,4 @@ path = "src/main.rs"
usb-core = { path = "../../usb-core/source" }
redox_syscall = "0.7"
log = "0.4"
libc = "0.2"
File diff suppressed because it is too large Load Diff
@@ -1,31 +1,220 @@
#![allow(dead_code)]
// UHCI (Universal Host Controller Interface) Register Layout
// Reference: Intel UHCI Specification, Universal Serial Bus Specification
//
// I/O Port Register Layout (from I/O base):
// USBCMD (0x00) - Command register
// USBSTS (0x02) - Status register
// USBINTR (0x04) - Interrupt enable register
// FRNUM (0x06) - Frame number register
// FLBASEADD(0x08) - Frame list base address (MMIO, 32-bit)
// SOFMOD (0x0C) - Start of frame modify
// PORTSC1 (0x10) - Port 1 status/control
// PORTSC2 (0x12) - Port 2 status/control
//
// Additional registers (for extended ports):
// PORTSC3 (0x14) - Port 3 status/control
// PORTSC4 (0x16) - Port 4 status/control
//
// PCI Configuration:
// BAR4 (offset 0x20): I/O port base address (low 16 bits, 32-byte range)
// BAR5 (offset 0x24): MMIO base for FLBASEADD (frame list pointer)
use core::mem::size_of;
// I/O port register offsets (from I/O base)
pub const USBCMD: u16 = 0x00;
pub const USBSTS: u16 = 0x02;
pub const USBINTR: u16 = 0x04;
pub const FRNUM: u16 = 0x06;
pub const FRBASEADD: u16 = 0x08;
pub const FLBASEADD: u16 = 0x08;
pub const SOFMOD: u16 = 0x0C;
pub const PORTSC1: u16 = 0x10;
pub const PORTSC2: u16 = 0x12;
pub const PORTSC3: u16 = 0x14;
pub const PORTSC4: u16 = 0x16;
pub const CMD_RUN_STOP: u16 = 1 << 0;
pub const CMD_HOST_RESET: u16 = 1 << 1;
pub const CMD_GLOBAL_RESET: u16 = 1 << 2;
pub const CMD_CONFIGURE: u16 = 1 << 6;
pub const CMD_MAX_PACKET_64: u16 = 1 << 7;
// USBCMD bits
pub const CMD_RUN_STOP: u16 = 1 << 0; // RS: Run/Stop
pub const CMD_HOST_RESET: u16 = 1 << 1; // HCRESET: Host Controller Reset
pub const CMD_GLOBAL_RESET: u16 = 1 << 2; // GRESET: Global Reset
pub const CMD_EGSM: u16 = 1 << 3; // EGSM: Enter Global Suspend Mode
pub const CMD_FGR: u16 = 1 << 4; // FGR: Force Global Resume
pub const CMD_SW_DEBUG: u16 = 1 << 5; // SWDBG: Software Debug
pub const CMD_CONFIGURE: u16 = 1 << 6; // CF: Configure Flag
pub const CMD_MAX_PACKET: u16 = 1 << 7; // MAXP: Max Packet (0=32, 1=64 bytes)
pub const STS_INTERRUPT: u16 = 1 << 0;
pub const STS_ERROR: u16 = 1 << 1;
pub const STS_RESUME: u16 = 1 << 2;
pub const STS_HOST_ERROR: u16 = 1 << 3;
pub const STS_HALTED: u16 = 1 << 5;
// USBSTS bits
pub const STS_INTERRUPT: u16 = 1 << 0; // USBINT: USB Interrupt
pub const STS_ERROR: u16 = 1 << 1; // USBERRINT: USB Error Interrupt
pub const STS_RESUME: u16 = 1 << 2; // RD: Resume Detect
pub const STS_HOST_ERROR: u16 = 1 << 3; // HSE: Host System Error
pub const STS_HC_PROCESS_ERROR: u16 = 1 << 4; // HCPE: Host Controller Process Error
pub const STS_HALTED: u16 = 1 << 5; // HCH: HC Halted
pub const STS_FLR: u16 = 1 << 3; // FLR: Frame List Rollover (same as HSE in some docs)
pub const PORT_CONNECT: u16 = 1 << 0;
pub const PORT_ENABLE: u16 = 1 << 1;
pub const PORT_SUSPEND: u16 = 1 << 2;
pub const PORT_OVER_CURRENT: u16 = 1 << 3;
pub const PORT_RESET: u16 = 1 << 4;
pub const PORT_LOW_SPEED: u16 = 1 << 8;
// USBINTR bits
pub const INTR_TIMEOUT_CRC: u16 = 1 << 0; // Timeout/CRC error enable
pub const INTR_RESUME: u16 = 1 << 1; // Resume interrupt enable
pub const INTR_IOC: u16 = 1 << 2; // Interrupt On Complete enable
pub const INTR_SHORT_PACKET: u16 = 1 << 3; // Short packet interrupt enable
pub const FRAME_COUNT: usize = 1024;
pub const FRAME_LIST_ALIGN: usize = 4096;
// PORTSC bits
pub const PORTSC_CONNECT: u16 = 1 << 0; // CCS: Current Connect Status
pub const PORTSC_CONNECT_CHANGE: u16 = 1 << 1; // CSC: Connect Status Change
pub const PORTSC_ENABLE: u16 = 1 << 2; // PE: Port Enable
pub const PORTSC_ENABLE_CHANGE: u16 = 1 << 3; // PEC: Port Enable Change
pub const PORTSC_LINE_STATUS: u16 = 0x3 << 10; // Line status bits
pub const PORTSC_RESUME: u16 = 1 << 6; // RD: Resume Detect
pub const PORTSC_LOW_SPEED: u16 = 1 << 8; // LSDA: Low Speed Device Attached
pub const PORTSC_RESET: u16 = 1 << 9; // PR: Port Reset
pub const PORTSC_SUSPEND: u16 = 1 << 12; // SUSP: Suspend
pub const PORTSC_OVER_CURRENT: u16 = 1 << 3; // OC: Over Current (bit 3)
pub const PORTSC_OVER_CURRENT_CHANGE: u16 = 1 << 4; // OCC: Over Current Change
// Frame list configuration
pub const FRAME_LIST_SIZE: usize = 1024;
pub const FRAME_LIST_ALIGN: usize = 4096; // 4KB alignment required
// Pointer types
pub const POINTER_TERMINATE: u32 = 0x0001; // T: Terminator bit
pub const POINTER_QH: u32 = 0x0002; // Q: Queue Head
pub const POINTER_DEPTH: u32 = 0x0004; // D: Depth-first (for ISO)
// TD (Transfer Descriptor) token bits
pub const TD_ACTIVE: u32 = 1 << 23; // Active bit
pub const TD_STALLED: u32 = 1 << 22; // Stalled
pub const TD_BUFFER_ERR: u32 = 1 << 21; // Data Buffer Error
pub const TD_BABBLE: u32 = 1 << 20; // Babble Detected
pub const TD_NAK: u32 = 1 << 19; // NAK Received
pub const TD_CRC_TIMEOUT: u32 = 1 << 18; // CRC/Time Out Error
pub const TD_BITSTUFF: u32 = 1 << 17; // Bit Stuff Error
pub const TD_TOGGLE: u32 = 1 << 19; // Data toggle bit
pub const TD_IOC: u32 = 1 << 24; // Interrupt on Complete
pub const TD_IOS: u32 = 1 << 25; // Isochronous Select
pub const TD_LS: u32 = 1 << 26; // Low Speed Device
pub const TD_ERROR_MASK: u32 = 0x3 << 27; // Error count mask
pub const TD_LEN_MASK: u32 = 0x7FF << 21; // Length mask (encoded as len-1)
// TD packet IDs
pub const PID_OUT: u32 = 0xE1; // OUT token (host->device)
pub const PID_IN: u32 = 0x69; // IN token (device->host)
pub const PID_SETUP: u32 = 0x2D; // SETUP token (control)
// Queue Head structure (16-byte aligned)
#[derive(Clone, Copy, Debug)]
#[repr(C, align(16))]
pub struct QueueHead {
pub link: u32, // Next QH link pointer
pub element: u32, // Queue element (TD) pointer
}
impl QueueHead {
pub fn new() -> Self {
QueueHead {
link: POINTER_TERMINATE,
element: POINTER_TERMINATE,
}
}
}
// Transfer Descriptor structure (16-byte aligned)
#[derive(Clone, Copy, Debug)]
#[repr(C, align(16))]
pub struct TransferDescriptor {
pub link: u32, // Next TD link pointer
pub status: u32, // Status and control
pub token: u32, // Token (PID, device addr, endpoint, length)
pub buffer: u32, // Buffer pointer (physical address)
}
impl TransferDescriptor {
pub fn new() -> Self {
TransferDescriptor {
link: POINTER_TERMINATE,
status: 0,
token: 0,
buffer: 0,
}
}
pub fn is_active(&self) -> bool {
(self.status & TD_ACTIVE) != 0
}
pub fn actual_length(&self) -> usize {
let len = (self.status >> 21) & 0x7FF;
(len as usize).saturating_add(1)
}
pub fn error_occurred(&self) -> bool {
self.status & (TD_STALLED | TD_BUFFER_ERR | TD_BABBLE | TD_CRC_TIMEOUT | TD_BITSTUFF) != 0
}
}
// Build a setup phase TD
pub fn build_setup_td(buffer_phys: u32) -> TransferDescriptor {
TransferDescriptor {
link: POINTER_TERMINATE,
status: TD_ACTIVE | 0x02 << 27, // 3 error retries
token: PID_SETUP | (7 << 21) | (0 << 8), // 8 bytes, device 0
buffer: buffer_phys,
}
}
// Build a data phase TD
pub fn build_data_td(buffer_phys: u32, len: usize, pid: u32, toggle: bool) -> TransferDescriptor {
let encoded_len = if len == 0 { 0 } else { len - 1 };
TransferDescriptor {
link: POINTER_TERMINATE,
status: TD_ACTIVE | TD_IOC | 0x02 << 27, // 3 error retries, IOC
token: pid | ((encoded_len as u32 & 0x7FF) << 21) | (if toggle { 1 } else { 0 } << 19),
buffer: buffer_phys,
}
}
// Build a status phase TD (no data, IOC)
pub fn build_status_td(pid: u32) -> TransferDescriptor {
TransferDescriptor {
link: POINTER_TERMINATE,
status: TD_ACTIVE | TD_IOC | 0x02 << 27, // 3 error retries, IOC
token: pid | (0 << 21), // 0 bytes
buffer: 0,
}
}
// Link pointer helpers
pub fn make_td_link(phys: u32) -> u32 {
phys | 0x0001 // Add terminate bit (software adds it when needed)
}
pub fn make_qh_link(phys: u32) -> u32 {
(phys & !0x000F) | POINTER_QH | POINTER_TERMINATE
}
// Port status decoding
#[derive(Clone, Debug, Default)]
pub struct PortStatus {
pub connected: bool,
pub enabled: bool,
pub low_speed: bool,
pub suspend: bool,
pub reset: bool,
pub over_current: bool,
pub connect_change: bool,
pub enable_change: bool,
}
pub fn decode_port_status(sc: u16) -> PortStatus {
PortStatus {
connected: (sc & PORTSC_CONNECT) != 0,
enabled: (sc & PORTSC_ENABLE) != 0,
low_speed: (sc & PORTSC_LOW_SPEED) != 0,
suspend: (sc & PORTSC_SUSPEND) != 0,
reset: (sc & PORTSC_RESET) != 0,
over_current: (sc & PORTSC_OVER_CURRENT) != 0,
connect_change: (sc & PORTSC_CONNECT_CHANGE) != 0,
enable_change: (sc & PORTSC_ENABLE_CHANGE) != 0,
}
}
@@ -0,0 +1,95 @@
---
# SPDX-FileCopyrightText: 2019 Christoph Cullmann <cullmann@kde.org>
# SPDX-FileCopyrightText: 2019 Gernot Gebhard <gebhard@absint.com>
#
# SPDX-License-Identifier: MIT
# This file got automatically created by ECM, do not edit
# See https://clang.llvm.org/docs/ClangFormatStyleOptions.html for the config options
# and https://community.kde.org/Policies/Frameworks_Coding_Style#Clang-format_automatic_code_formatting
# for clang-format tips & tricks
---
Language: JavaScript
DisableFormat: true
---
Language: Json
DisableFormat: false
IndentWidth: 4
---
# Style for C++
Language: Cpp
# base is WebKit coding style: https://webkit.org/code-style-guidelines/
# below are only things set that diverge from this style!
BasedOnStyle: WebKit
# enforce C++11 (e.g. for std::vector<std::vector<lala>>
Standard: Cpp11
# 4 spaces indent
TabWidth: 4
# 2 * 80 wide lines
ColumnLimit: 160
# sort includes inside line separated groups
SortIncludes: true
# break before braces on function, namespace and class definitions.
BreakBeforeBraces: Linux
# CrlInstruction *a;
PointerAlignment: Right
# horizontally aligns arguments after an open bracket.
AlignAfterOpenBracket: Align
# don't move all parameters to new line
AllowAllParametersOfDeclarationOnNextLine: false
# no single line functions
AllowShortFunctionsOnASingleLine: None
# no single line enums
AllowShortEnumsOnASingleLine: false
# always break before you encounter multi line strings
AlwaysBreakBeforeMultilineStrings: true
# don't move arguments to own lines if they are not all on the same
BinPackArguments: false
# don't move parameters to own lines if they are not all on the same
BinPackParameters: false
# In case we have an if statement with multiple lines the operator should be at the beginning of the line
# but we do not want to break assignments
BreakBeforeBinaryOperators: NonAssignment
# format C++11 braced lists like function calls
Cpp11BracedListStyle: true
# do not put a space before C++11 braced lists
SpaceBeforeCpp11BracedList: false
# remove empty lines
KeepEmptyLinesAtTheStartOfBlocks: false
# no namespace indentation to keep indent level low
NamespaceIndentation: None
# we use template< without space.
SpaceAfterTemplateKeyword: false
# Always break after template declaration
AlwaysBreakTemplateDeclarations: true
# macros for which the opening brace stays attached.
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE , wl_resource_for_each, wl_resource_for_each_safe ]
# keep lambda formatting multi-line if not empty
AllowShortLambdasOnASingleLine: Empty
# We do not want clang-format to put all arguments on a new line
AllowAllArgumentsOnNextLine: false
@@ -861,6 +861,15 @@ unsigned long redox_translate_request(unsigned long linux_nr)
/* DRM_IOCTL_GET_PCIINFO — PCI device information for driver discovery */
case 0x15:
return REDOX_DRM_IOCTL_GET_PCI_INFO;
/* DRM auth/master ioctls */
case 0x02: /* GET_MAGIC — DRM_IOR(0x02, struct drm_auth) */
return REDOX_DRM_IOCTL_GET_MAGIC;
case 0x11: /* AUTH_MAGIC — DRM_IOW(0x11, struct drm_auth) */
return REDOX_DRM_IOCTL_AUTH_MAGIC;
case 0x1e: /* SET_MASTER — DRM_IO(0x1e) */
return REDOX_DRM_IOCTL_SET_MASTER;
case 0x1f: /* DROP_MASTER — DRM_IO(0x1f) */
return REDOX_DRM_IOCTL_DROP_MASTER;
default:
return 0;
}
@@ -972,6 +981,10 @@ static size_t redox_drm_expected_response_size(unsigned long linux_nr, size_t ar
case 0xA6:
case 0xB3:
return arg_size;
case 0x02: /* GET_MAGIC — returns struct drm_auth (magic u32) */
return arg_size;
case 0x11: /* AUTH_MAGIC — returns struct drm_auth (magic u32) */
return arg_size;
default:
return 0;
}
@@ -40,6 +40,10 @@
#define REDOX_DRM_IOCTL_VIRTGPU_RESOURCE_CREATE_BLOB (REDOX_DRM_IOCTL_BASE + 40)
#define REDOX_DRM_IOCTL_VIRTGPU_CONTEXT_INIT (REDOX_DRM_IOCTL_BASE + 41)
#define REDOX_DRM_IOCTL_GET_MAGIC (REDOX_DRM_IOCTL_BASE + 33)
#define REDOX_DRM_IOCTL_AUTH_MAGIC (REDOX_DRM_IOCTL_BASE + 34)
#define REDOX_DRM_IOCTL_SET_MASTER (REDOX_DRM_IOCTL_BASE + 35)
#define REDOX_DRM_IOCTL_DROP_MASTER (REDOX_DRM_IOCTL_BASE + 36)
#define REDOX_DRM_IOCTL_GET_PCI_INFO (REDOX_DRM_IOCTL_BASE + 0x60)
struct redox_drm_resources_wire {
@@ -382,6 +382,166 @@
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#ifdef Q_OS_REDOX
#undef QT_USE_XOPEN_LFS_EXTENSIONS
#undef QT_LARGEFILE_SUPPORT
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
@@ -1536,6 +1536,146 @@ qt_internal_extend_target(Core CONDITION REDOX
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
qt_internal_extend_target(Core CONDITION QT_FEATURE_cpp_winrt
SOURCES
platform/windows/qfactorycacheregistration_p.h
@@ -1900,6 +2040,146 @@ qt_internal_extend_target(Core CONDITION REDOX
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
# Redox: POSIX statvfs, not Linux statfs
qt_internal_extend_target(Core CONDITION REDOX
SOURCES
io/qstandardpaths_unix.cpp
io/qstorageinfo_unix.cpp
)
qt_internal_extend_target(Core CONDITION QT_FEATURE_itemmodel
SOURCES
itemmodels/qabstractitemmodel.cpp itemmodels/qabstractitemmodel.h itemmodels/qabstractitemmodel_p.h
@@ -225,6 +225,26 @@ static_assert(std::is_signed_v<qint128>,
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#include <assert.h>
#ifndef static_assert
#define static_assert _Static_assert
#endif
@@ -1169,6 +1169,26 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
#ifdef IPV6_HOPLIMIT
if (header.hopLimit != -1) {
msg.msg_controllen += CMSG_SPACE(sizeof(int));
@@ -1225,6 +1245,26 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
if (header.ifindex != 0 || !header.senderAddress.isNull()) {
struct in6_pktinfo *data = reinterpret_cast<in6_pktinfo *>(CMSG_DATA(cmsgptr));
@@ -69,6 +69,26 @@
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#if defined(Q_OS_VXWORKS)
@@ -99,6 +99,26 @@ public:
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0;
#endif /* QT_CONFIG(opengl) */
@@ -148,6 +168,26 @@ public:
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
virtual bool canCreatePlatformOffscreenSurface() const { return false; }
#if QT_CONFIG(opengl)
@@ -208,6 +248,26 @@ public:
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl)
virtual void *nativeResourceForContext(NativeResource /*resource*/, QPlatformOpenGLContext */*context*/) { return nullptr; }
#endif /* QT_CONFIG(opengl) */
@@ -258,6 +318,26 @@ public:
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
#endif /* QT_CONFIG(opengl) */
};
}
@@ -34,7 +34,7 @@ namespace QV4 {
namespace JIT {
#if defined(Q_PROCESSOR_X86_64) || defined(ENABLE_ALL_ASSEMBLERS_FOR_REFACTORING_PURPOSES)
#if defined(Q_OS_LINUX) || defined(Q_OS_QNX) || defined(Q_OS_FREEBSD) || defined(Q_OS_DARWIN) || defined(Q_OS_SOLARIS) || defined(Q_OS_VXWORKS) || defined(Q_OS_HURD) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX)
#if defined(Q_OS_LINUX) || defined(Q_OS_QNX) || defined(Q_OS_FREEBSD) || defined(Q_OS_DARWIN) || defined(Q_OS_SOLARIS) || defined(Q_OS_VXWORKS) || defined(Q_OS_HURD) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX) || defined(Q_OS_REDOX)
class PlatformAssembler_X86_64_SysV : public JSC::MacroAssembler<JSC::MacroAssemblerX86_64>
{
+89 -37
View File
@@ -64,60 +64,112 @@ fi
cd "${ROOT_DIR}"
# Collect all recipe directories
RECIPE_DIRS=()
for pkg in "${PACKAGES[@]}"; do
# Find the recipe directory
found=0
for dir in recipes/*/; do
if [ -d "${dir}${pkg}" ]; then
RECIPE_DIRS+=("${dir}${pkg}")
found=1
break
fi
done
# Also check local/recipes
if [ $found -eq 0 ]; then
for dir in local/recipes/*/; do
if [ -d "${dir}${pkg}" ]; then
RECIPE_DIRS+=("${dir}${pkg}")
found=1
break
# Precompute the entire dependency graph in a single pass. With 3000+ recipes,
# doing per-target awk invocations in the BFS loop is O(N²) and unworkable.
# Precompute once, query in O(1). Function definitions must come before
# their use; place them here so the index build below can call them.
extract_recipe_deps() {
local pkg_dir="$1"
local recipe_toml="${pkg_dir}/recipe.toml"
local deps=""
if [ ! -f "${recipe_toml}" ]; then
echo ""
return
fi
# Multi-line dependencies = [ ... ] extraction. Handles `]` on its own line.
local in_deps=0
while IFS= read -r line; do
if [ "${in_deps}" = 1 ]; then
# Strip whitespace, quotes, trailing commas
local item="${line}"
item="${item## }"; item="${item%% }"
item="${item#\"}"; item="${item%\"}"
item="${item%,}"
[ -n "${item}" ] && deps+="${item},"
# Section closes on a line that is just `]` or contains `]`
if [[ "${line}" =~ ^[[:space:]]*\] ]]; then
in_deps=0
fi
done
fi
if [ $found -eq 0 ]; then
echo "ERROR: recipe not found for package '${pkg}'" >&2
exit 1
continue
fi
# Check if this line starts `dependencies = [`
if [[ "${line}" =~ ^[[:space:]]*dependencies[[:space:]]*=[[:space:]]*\[ ]]; then
in_deps=1
local inline="${line#*=}"
inline="${inline#[}"
if [[ "${inline}" == *\]* ]]; then
in_deps=0
inline="${inline%]*}"
for item in ${inline//,/ }; do
item="${item## }"; item="${item%% }"
item="${item#\"}"; item="${item%\"}"
[ -n "${item}" ] && deps+="${item},"
done
fi
fi
done < "${recipe_toml}"
echo "${deps}"
}
recipe_source_dir() {
local pkg_dir="$1"
local recipe_toml="${pkg_dir}/recipe.toml"
[ -f "${recipe_toml}" ] || return 0
local rel
rel="$(awk '/^\[source\]/{flag=1; next} /^\[/{flag=0} flag' \
"${recipe_toml}" 2>/dev/null | \
awk -F'=' '/^path[[:space:]]*=/{gsub(/[" ]/, "", $2); print $2; exit}')"
if [ -n "${rel}" ]; then
(cd "${pkg_dir}" && cd "${rel}" 2>/dev/null && pwd)
fi
}
mapfile -t ALL_RECIPE_TOMLS < <(find recipes/ local/recipes/ -name "recipe.toml" 2>/dev/null)
echo "Cached ${#ALL_RECIPE_TOMLS[@]} recipe.toml paths"
# recipe_index maps pkg_name -> "pkg_dir|recipe_toml|depends_csv"
declare -A recipe_index=()
for recipe_toml in "${ALL_RECIPE_TOMLS[@]}"; do
pkg_dir="$(dirname "${recipe_toml}")"
pkg_name="$(basename "${pkg_dir}")"
deps="$(extract_recipe_deps "${pkg_dir}")"
recipe_index["${pkg_name}"]="${pkg_dir}|${recipe_toml}|${deps}"
done
# Find all recipes that depend on any of the target packages
# by scanning their recipe.toml for dependency entries
# Find all recipes that depend on the target by querying the precomputed
# index. Returns newline-separated pkg names that depend on target.
find_reverse_deps() {
local target="$1"
local result=()
# Search all recipe.toml files for dependencies
while IFS= read -r -d '' recipe_toml; do
# Get the package name from the directory
pkg_dir="$(dirname "${recipe_toml}")"
pkg_name="$(basename "${pkg_dir}")"
# Skip the target itself
local pkg_name entry
for pkg_name in "${!recipe_index[@]}"; do
if [ "${pkg_name}" = "${target}" ]; then
continue
fi
# Check if this recipe depends on the target
if grep -q "dependencies.*=.*\[.*${target}.*\]" "${recipe_toml}" 2>/dev/null; then
entry="${recipe_index[${pkg_name}]}"
# entry format: "pkg_dir|recipe_toml|deps_csv"
local deps_csv="${entry##*|}"
if [[ ",${deps_csv}," == *",${target},"* ]]; then
result+=("${pkg_name}")
fi
done < <(find recipes/ local/recipes/ -name "recipe.toml" -print0 2>/dev/null)
done
printf '%s\n' "${result[@]}" | sort -u
}
# Validate that the requested package names exist in the index
for pkg in "${PACKAGES[@]}"; do
if [ -z "${recipe_index[${pkg}]+_}" ]; then
echo "ERROR: recipe not found for package '${pkg}'" >&2
exit 1
fi
done
# Build a complete cascade set using BFS
echo "=== Analyzing dependency cascade ==="
CASCADE=()
Submodule local/sources/base updated: 676af02e08...dc04956a31
Submodule local/sources/kernel updated: a4ba465a86...4b3f6e3e81
+1
View File
@@ -0,0 +1 @@
../../local/recipes/libs/pciaccess-stub
+4 -2
View File
@@ -10,8 +10,10 @@ template = "custom"
script = """
DYNAMIC_INIT
# Fix autotools timestamp skew — make tries to regenerate aclocal.m4
touch "${COOKBOOK_SOURCE}/aclocal.m4" "${COOKBOOK_SOURCE}/configure" "${COOKBOOK_SOURCE}/Makefile.in"
export ACLOCAL=true
export AUTOMAKE=true
export AUTOCONF=true
export AUTOHEADER=true
cookbook_configure
"""