ReactOS 0.4.17-dev-1281-g065abb3
XhciRegisters Class Reference

#include <mmio.h>

Collaboration diagram for XhciRegisters:

Public Member Functions

NTSTATUS Prepare (_In_ XhciController *Controller, _In_ WDFCMRESLIST Translated)
 
VOID Release ()
 
NTSTATUS BiosHandoff ()
 
NTSTATUS WaitForReady ()
 
NTSTATUS Stop ()
 
NTSTATUS Reset ()
 
NTSTATUS Run ()
 
NTSTATUS SaveState ()
 
NTSTATUS RestoreState ()
 
ULONG ReadCapability32 (_In_ ULONG Offset) const
 
ULONG ReadOperational32 (_In_ ULONG Offset) const
 
VOID WriteOperational32 (_In_ ULONG Offset, _In_ ULONG Value)
 
ULONG64 ReadOperational64 (_In_ ULONG Offset) const
 
VOID WriteOperational64 (_In_ ULONG Offset, _In_ ULONG64 Value)
 
ULONG ReadRuntime32 (_In_ ULONG Offset) const
 
VOID WriteRuntime32 (_In_ ULONG Offset, _In_ ULONG Value)
 
ULONG64 ReadRuntime64 (_In_ ULONG Offset) const
 
VOID WriteRuntime64 (_In_ ULONG Offset, _In_ ULONG64 Value)
 
VOID RingDoorbell (_In_ ULONG Index, _In_ ULONG Value)
 
ULONG ReadPort32 (_In_ ULONG Port, _In_ ULONG Offset) const
 
VOID WritePort32 (_In_ ULONG Port, _In_ ULONG Offset, _In_ ULONG Value)
 
ULONG FindExtendedCapability (_In_ ULONG Id, _In_ ULONG Start) const
 
ULONG ReadExtended32 (_In_ ULONG Offset) const
 
VOID WriteExtended32 (_In_ ULONG Offset, _In_ ULONG Value)
 
ULONG MaxSlots () const
 
ULONG MaxInterrupters () const
 
ULONG MaxPorts () const
 
ULONG EventRingSegmentTableMax () const
 
ULONG ScratchpadCount () const
 
ULONG ContextSize () const
 
ULONG PageSize () const
 
USHORT InterfaceVersion () const
 
BOOLEAN Addressing64 () const
 
BOOLEAN ContiguousFrameId () const
 
ULONG SupportedStreams () const
 
ULONG Hcsparams3 () const
 
NTSTATUS ResetController (_In_ BOOLEAN AllowRunning)
 
BOOLEAN IsMapped () const
 
ULONG CapLength () const
 
ULONG Hccparams1 () const
 
ULONG Hccparams2 () const
 
UCHAR VersionMajor () const
 
UCHAR VersionMinor () const
 
BOOLEAN MseLengthUsable () const
 
ULONG MaxEventRingSegments () const
 
ULONG LegacySupportOffset () const
 
ULONG DebugCapabilityOffset () const
 
ULONG CurrentFrame (_In_ ULONG Increment) const
 
VOID ProgramSsicPortUnused (_In_ BOOLEAN PowerDown)
 
VOID SaveVendorBits ()
 
VOID RestoreVendorBits ()
 
VOID ApplyD0Workarounds ()
 

Private Member Functions

NTSTATUS MapRegisters (_In_ WDFCMRESLIST Translated)
 
NTSTATUS ParseCapabilities ()
 
VOID ReadFirmwareVersion ()
 
BOOLEAN InRange (_In_ ULONG Offset, _In_ ULONG Size) const
 
UCHAR ReadByte (_In_ ULONG Offset) const
 
VOID WriteByte (_In_ ULONG Offset, _In_ UCHAR Value)
 
VOID ModifyCapability32 (_In_ ULONG Offset, _In_ ULONG Clear, _In_ ULONG Set)
 
ULONG64 Read64 (_In_ PUCHAR Address) const
 
VOID Write64 (_In_ PUCHAR Address, _In_ ULONG64 Value)
 
NTSTATUS WaitForStateOperation (_In_ ULONG BusyBit)
 
NTSTATUS CheckStateOperationAllowed () const
 

Private Attributes

XhciController * m_Controller
 
PUCHAR m_Base
 
ULONG m_Length
 
BOOLEAN m_Mapped
 
PUCHAR m_Operational
 
PUCHAR m_Runtime
 
PUCHAR m_Doorbells
 
ULONG m_ExtendedList
 
ULONG m_LegacySupport
 
ULONG m_DebugCapability
 
ULONG m_CapLength
 
UCHAR m_VersionMajor
 
UCHAR m_VersionMinor
 
BOOLEAN m_MseLengthUsable
 
ULONG m_MaxSlots
 
ULONG m_MaxInterrupters
 
ULONG m_MaxPorts
 
ULONG m_MaxEventRingSegments
 
ULONG m_Scratchpads
 
ULONG m_Hcsparams3
 
ULONG m_Hccparams1
 
ULONG m_Hccparams2
 
ULONG m_Streams
 
ULONG m_VendorBits
 

Detailed Description

Owns the MMIO mapping and every raw register access.

Definition at line 13 of file mmio.h.

Member Function Documentation

◆ Addressing64()

BOOLEAN XhciRegisters::Addressing64 ( ) const

Definition at line 663 of file mmio.cpp.

664{
665 /* Read live, as the reference does */
667}
ULONG ReadCapability32(_In_ ULONG Offset) const
Definition: mmio.cpp:421
#define XHCI_CAP_HCCPARAMS1
Definition: xhcihw.h:339
#define XHCI_HCC1_AC64
Definition: xhcihw.h:368

◆ ApplyD0Workarounds()

VOID XhciRegisters::ApplyD0Workarounds ( )

Definition at line 1052 of file mmio.cpp.

1053{
1055
1059 ModifyCapability32(XHCI_VENDOR_FRESCO_SHADOW, (1UL << 1) | (1UL << 7), 0);
1060 if (m_Controller->HasErrata(XhciErrata::IntelPchAsyncOrderingFix))
1062 if (Fixes & XhciController::FixEtronSet)
1066
1067 if (m_Controller->HasErrata(XhciErrata::PwrTogglePmeEnable))
1068 {
1069 ModifyCapability32(XHCI_VENDOR_PME, 0, 1UL << 28);
1071 ModifyCapability32(XHCI_VENDOR_PME, 1UL << 28, 0);
1072 }
1073}
@ FixFrescoShadow
Definition: hc.h:105
@ FixEtronClear
Definition: hc.h:108
@ FixFrescoControl
Definition: hc.h:106
@ FixEtronSet
Definition: hc.h:107
BOOLEAN HasErrata(_In_ XhciErrata Bit) const
Definition: hc.h:58
ULONG64 m_InternalFlags
Definition: hc.h:111
XhciController * m_Controller
Definition: mmio.h:182
VOID ModifyCapability32(_In_ ULONG Offset, _In_ ULONG Clear, _In_ ULONG Set)
Definition: mmio.cpp:371
#define XHCI_VENDOR_FRESCO_CONTROL
Definition: mmio.cpp:17
#define XHCI_VENDOR_PPT_BULK
Definition: mmio.cpp:18
#define XHCI_VENDOR_ETRON_CONTROL
Definition: mmio.cpp:15
#define XHCI_VENDOR_PME
Definition: mmio.cpp:20
#define XHCI_VENDOR_FRESCO_SHADOW
Definition: mmio.cpp:19
unsigned __int64 ULONG64
Definition: imports.h:198
#define KeStallExecutionProcessor(MicroSeconds)
Definition: precomp.h:27

Referenced by XhciController::D0Entry().

◆ BiosHandoff()

NTSTATUS XhciRegisters::BiosHandoff ( )

Definition at line 712 of file mmio.cpp.

713{
714 ULONG Waits;
716
718 return STATUS_SUCCESS;
719
720 if (m_LegacySupport != 0)
721 {
724
726 {
727 if (Waits == XHCI_HANDOFF_WAITS)
728 {
729 if (!m_Controller->HasErrata(XhciErrata::BootTolerateBiosHold))
730 {
731 DPRINT1("BIOS kept ownership of the controller\n");
732 return STATUS_UNSUCCESSFUL;
733 }
734
735 DPRINT1("BIOS kept ownership of the controller, continuing\n");
736 break;
737 }
738
740 }
741 }
742 else
743 {
744 DPRINT1("No USB legacy support capability, skipping the BIOS handoff\n");
745 }
746
748 {
749 if (m_Controller->HasErrata(XhciErrata::BootStrictBiosRelease))
750 {
751 DPRINT1("Controller still running after the BIOS handoff\n");
752 return STATUS_UNSUCCESSFUL;
753 }
754
755 Status = Stop();
756 if (!NT_SUCCESS(Status))
757 {
758 DPRINT1("Stopping the controller after the BIOS handoff failed 0x%lx\n", Status);
759 return Status;
760 }
761 }
762
763 /* Keeps the BIOS SMI handler quiet, notably on S3 resume */
764 if (m_LegacySupport != 0)
765 {
767
769 }
770
771 return STATUS_SUCCESS;
772}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
BOOLEAN IsAccessible() const
Definition: hc.cpp:193
NTSTATUS Stop()
Definition: mmio.cpp:775
ULONG ReadOperational32(_In_ ULONG Offset) const
Definition: mmio.cpp:431
ULONG m_LegacySupport
Definition: mmio.h:191
VOID WriteByte(_In_ ULONG Offset, _In_ UCHAR Value)
Definition: mmio.cpp:363
VOID WriteExtended32(_In_ ULONG Offset, _In_ ULONG Value)
Definition: mmio.cpp:332
UCHAR ReadByte(_In_ ULONG Offset) const
Definition: mmio.cpp:356
ULONG ReadExtended32(_In_ ULONG Offset) const
Definition: mmio.cpp:319
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:24
static VOID NTAPI XhciSleepMs(_In_ ULONG Milliseconds)
Definition: mmio.cpp:46
#define XHCI_HANDOFF_WAIT_MS
Definition: mmio.cpp:30
#define XHCI_HANDOFF_WAITS
Definition: mmio.cpp:29
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define XHCI_LEGSUP_OWNED
Definition: xhcihw.h:433
#define XHCI_LEGCTLSTS_KEEP_MASK
Definition: xhcihw.h:437
#define XHCI_LEGSUP_CTLSTS
Definition: xhcihw.h:434
#define XHCI_LEGSUP_BIOS_OWNED_BYTE
Definition: xhcihw.h:431
#define XHCI_LEGSUP_OS_OWNED_BYTE
Definition: xhcihw.h:432
#define XHCI_OP_USBSTS
Definition: xhcihw.h:382
#define XHCI_USBSTS_HCH
Definition: xhcihw.h:401

Referenced by XhciController::D0Entry(), and Prepare().

◆ CapLength()

ULONG XhciRegisters::CapLength ( ) const

Definition at line 609 of file mmio.cpp.

610{
611 return m_CapLength;
612}
ULONG m_CapLength
Definition: mmio.h:194

◆ CheckStateOperationAllowed()

NTSTATUS XhciRegisters::CheckStateOperationAllowed ( ) const
private

Definition at line 914 of file mmio.cpp.

915{
917
918 if (!(Usbsts & XHCI_USBSTS_HCH))
919 {
920 DPRINT1("State save or restore refused, controller running\n");
922 }
923
924 if (Usbsts & (XHCI_USBSTS_SSS | XHCI_USBSTS_RSS))
925 {
926 DPRINT1("State save or restore already in progress, USBSTS 0x%08lx\n", Usbsts);
928 }
929
930 return STATUS_SUCCESS;
931}
#define STATUS_ADAPTER_HARDWARE_ERROR
Definition: ntstatus.h:524
#define XHCI_USBSTS_RSS
Definition: xhcihw.h:406
#define XHCI_USBSTS_SSS
Definition: xhcihw.h:405

Referenced by RestoreState(), and SaveState().

◆ ContextSize()

ULONG XhciRegisters::ContextSize ( ) const

◆ ContiguousFrameId()

BOOLEAN XhciRegisters::ContiguousFrameId ( ) const

Definition at line 670 of file mmio.cpp.

671{
672 if (m_Controller->HasErrata(XhciErrata::IsochNoFrameIdContinuity))
673 return FALSE;
674
675 return (m_Hccparams1 & XHCI_HCC1_CFC) != 0;
676}
#define FALSE
Definition: types.h:117
#define XHCI_HCC1_CFC
Definition: xhcihw.h:370

◆ CurrentFrame()

ULONG XhciRegisters::CurrentFrame ( _In_ ULONG  Increment) const

Current 11 bit frame, Increment microframes ahead.

Definition at line 679 of file mmio.cpp.

681{
683
684 return ((Index + Increment) >> 3) & 0x7FF;
685}
ULONG ReadRuntime32(_In_ ULONG Offset) const
Definition: mmio.cpp:469
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:46
_In_ WDFCOLLECTION _In_ ULONG Index
#define XHCI_MFINDEX_MASK
Definition: xhcihw.h:419
#define XHCI_RT_MFINDEX
Definition: xhcihw.h:418

Referenced by XhciController::InitFrameSnapshot().

◆ DebugCapabilityOffset()

ULONG XhciRegisters::DebugCapabilityOffset ( ) const

Definition at line 645 of file mmio.cpp.

646{
647 return m_DebugCapability;
648}
ULONG m_DebugCapability
Definition: mmio.h:192

◆ EventRingSegmentTableMax()

ULONG XhciRegisters::EventRingSegmentTableMax ( ) const

Definition at line 561 of file mmio.cpp.

562{
564}
ULONG m_MaxEventRingSegments
Definition: mmio.h:201

◆ FindExtendedCapability()

ULONG XhciRegisters::FindExtendedCapability ( _In_ ULONG  Id,
_In_ ULONG  Start 
) const

Next extended capability with Id after Start (0 starts at the first); 0 when none.

Definition at line 284 of file mmio.cpp.

287{
290 ULONG Next;
291
292 if (!m_Mapped || m_ExtendedList == 0)
293 return 0;
294
295 Offset = (Start == 0) ? m_ExtendedList : Start;
297
298 /* A given start is skipped; only entries after it are candidates */
299 if (Start == 0 && (Header & XHCI_EXTCAP_ID_MASK) == Id)
300 return Offset;
301
302 for (;;)
303 {
305 if (Next == 0)
306 return 0;
307
308 Offset += Next;
309 if (Offset >= m_Length)
310 return 0;
311
313 if ((Header & XHCI_EXTCAP_ID_MASK) == Id)
314 return Offset;
315 }
316}
DWORD Id
static _Out_opt_ PULONGLONG Start
Definition: Header.h:9
ULONG m_ExtendedList
Definition: mmio.h:190
ULONG m_Length
Definition: mmio.h:184
BOOLEAN m_Mapped
Definition: mmio.h:185
PACPI_METHOD_ARGUMENT Next
Definition: slotdev.cpp:96
#define XHCI_EXTCAP_ID_MASK
Definition: xhcihw.h:425
#define XHCI_EXTCAP_NEXT_MASK
Definition: xhcihw.h:427
#define XHCI_EXTCAP_NEXT_SHIFT
Definition: xhcihw.h:426

Referenced by ParseCapabilities(), and XhciRootHub::Prepare().

◆ Hccparams1()

ULONG XhciRegisters::Hccparams1 ( ) const

Definition at line 597 of file mmio.cpp.

598{
599 return m_Hccparams1;
600}

◆ Hccparams2()

ULONG XhciRegisters::Hccparams2 ( ) const

Definition at line 603 of file mmio.cpp.

604{
605 return m_Hccparams2;
606}
ULONG m_Hccparams2
Definition: mmio.h:205

Referenced by XhciController::QueryUsbCapability().

◆ Hcsparams3()

ULONG XhciRegisters::Hcsparams3 ( ) const

Definition at line 591 of file mmio.cpp.

592{
593 return m_Hcsparams3;
594}
ULONG m_Hcsparams3
Definition: mmio.h:203

Referenced by XhciRootHub::Prepare().

◆ InRange()

BOOLEAN XhciRegisters::InRange ( _In_ ULONG  Offset,
_In_ ULONG  Size 
) const
private

Definition at line 348 of file mmio.cpp.

351{
352 return m_Mapped && Offset < m_Length && Size <= m_Length - Offset;
353}
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539

Referenced by ModifyCapability32(), ParseCapabilities(), ReadExtended32(), ReadFirmwareVersion(), and WriteExtended32().

◆ InterfaceVersion()

USHORT XhciRegisters::InterfaceVersion ( ) const

Definition at line 657 of file mmio.cpp.

658{
659 return (USHORT)((m_VersionMajor << 8) | m_VersionMinor);
660}
UCHAR m_VersionMinor
Definition: mmio.h:196
UCHAR m_VersionMajor
Definition: mmio.h:195
unsigned short USHORT
Definition: pedump.c:61

◆ IsMapped()

BOOLEAN XhciRegisters::IsMapped ( ) const

Definition at line 633 of file mmio.cpp.

634{
635 return m_Mapped;
636}

Referenced by XhciController::IsAccessible().

◆ LegacySupportOffset()

ULONG XhciRegisters::LegacySupportOffset ( ) const

Definition at line 639 of file mmio.cpp.

640{
641 return m_LegacySupport;
642}

◆ MapRegisters()

NTSTATUS XhciRegisters::MapRegisters ( _In_ WDFCMRESLIST  Translated)
private

Definition at line 57 of file mmio.cpp.

59{
61 ULONG Count = WdfCmResourceListGetCount(Translated);
63
64 for (Index = 0; Index < Count; Index++)
65 {
66 Descriptor = WdfCmResourceListGetDescriptor(Translated, Index);
68 continue;
69
70 /* Only the first memory range is the register BAR */
71 m_Base = (PUCHAR)MmMapIoSpace(Descriptor->u.Memory.Start,
72 Descriptor->u.Memory.Length,
74 if (m_Base == NULL)
75 {
76 DPRINT1("Mapping %lu register bytes at 0x%I64x failed\n",
77 Descriptor->u.Memory.Length, Descriptor->u.Memory.Start.QuadPart);
79 }
80
81 m_Length = Descriptor->u.Memory.Length;
82 m_Mapped = TRUE;
83 return STATUS_SUCCESS;
84 }
85
86 /* QUIRK: a missing memory resource reports STATUS_UNSUCCESSFUL */
87 DPRINT1("No memory resource for the register BAR\n");
89}
PUCHAR m_Base
Definition: mmio.h:183
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
#define CmResourceTypeMemory
Definition: restypes.h:106
unsigned char * PUCHAR
Definition: typedefs.h:53
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
USHORT Count
Definition: userreq.cpp:200
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
@ MmNonCached
Definition: mmtypes.h:129

Referenced by Prepare().

◆ MaxEventRingSegments()

ULONG XhciRegisters::MaxEventRingSegments ( ) const

Definition at line 567 of file mmio.cpp.

568{
570}

◆ MaxInterrupters()

ULONG XhciRegisters::MaxInterrupters ( ) const

Definition at line 549 of file mmio.cpp.

550{
551 return m_MaxInterrupters;
552}
ULONG m_MaxInterrupters
Definition: mmio.h:199

Referenced by XhciInterrupters::Prepare().

◆ MaxPorts()

ULONG XhciRegisters::MaxPorts ( ) const

Definition at line 555 of file mmio.cpp.

556{
557 return m_MaxPorts;
558}
ULONG m_MaxPorts
Definition: mmio.h:200

Referenced by XhciRootHub::Prepare().

◆ MaxSlots()

ULONG XhciRegisters::MaxSlots ( ) const

Definition at line 543 of file mmio.cpp.

544{
545 return m_MaxSlots;
546}
ULONG m_MaxSlots
Definition: mmio.h:198

Referenced by _IRQL_requires_().

◆ ModifyCapability32()

VOID XhciRegisters::ModifyCapability32 ( _In_ ULONG  Offset,
_In_ ULONG  Clear,
_In_ ULONG  Set 
)
private

Definition at line 371 of file mmio.cpp.

375{
377
378 if (!InRange(Offset, sizeof(ULONG)))
379 return;
380
383}
#define WRITE_REGISTER_ULONG(r, v)
Definition: arm.h:11
#define READ_REGISTER_ULONG(r)
Definition: arm.h:10
BOOLEAN InRange(_In_ ULONG Offset, _In_ ULONG Size) const
Definition: mmio.cpp:348
Config Register
Definition: hubwmi.cpp:126
static void Clear(void)
Definition: treeview.c:388
static BOOL Set
Definition: pageheap.c:10
uint32_t * PULONG
Definition: typedefs.h:59

Referenced by ApplyD0Workarounds(), ProgramSsicPortUnused(), and RestoreVendorBits().

◆ MseLengthUsable()

BOOLEAN XhciRegisters::MseLengthUsable ( ) const

Definition at line 627 of file mmio.cpp.

628{
629 return m_MseLengthUsable;
630}
BOOLEAN m_MseLengthUsable
Definition: mmio.h:197

◆ PageSize()

ULONG XhciRegisters::PageSize ( ) const

Definition at line 579 of file mmio.cpp.

580{
581 return PAGE_SIZE;
582}
#define PAGE_SIZE
Definition: env_spec_w32.h:49

◆ ParseCapabilities()

NTSTATUS XhciRegisters::ParseCapabilities ( )
private

Definition at line 171 of file mmio.cpp.

172{
173 ULONG Value;
174 ULONG Psa;
176
178
183
184 if (m_VersionMajor == 0)
185 m_Controller->SetErrata(XhciErrata::IntPrimaryOnly);
186 else if (m_VersionMinor >= 0x10 || m_VersionMajor > 1)
188
190
195 if (m_MaxSlots == 0)
196 {
197 DPRINT1("HCSPARAMS1 0x%08lx reports no device slots\n", Value);
199 }
200 if (m_MaxInterrupters == 0 || m_MaxInterrupters > 0x400)
201 {
202 DPRINT1("HCSPARAMS1 0x%08lx reports %lu interrupters\n", Value, m_MaxInterrupters);
204 }
205 if (m_MaxPorts == 0)
206 {
207 DPRINT1("HCSPARAMS1 0x%08lx reports no ports\n", Value);
209 }
210
215
218 {
219 DPRINT1("HCSPARAMS3 0x%08lx U1 exit latency out of range\n", m_Hcsparams3);
221 }
223 {
224 DPRINT1("HCSPARAMS3 0x%08lx U2 exit latency out of range\n", m_Hcsparams3);
226 }
227
230
231 /* A 4 KB stream context array holds at most 256 entries */
233 if (Psa > 7)
234 Psa = 7;
235 if (Psa == 0 || m_Controller->HasErrata(XhciErrata::StrmUnsupported))
236 m_Streams = 0;
237 else
238 m_Streams = (2UL << Psa) - 1;
239
241 if (Offset == 0 || Offset >= m_Length)
242 {
243 DPRINT1("Extended capability pointer 0x%lx outside the %lu byte BAR\n", Offset, m_Length);
245 }
249
250 /* DBOFF and RTSOFF must fall inside the mapping */
252 if (Offset == 0 || !InRange(Offset, XHCI_DOORBELL_STRIDE * (m_MaxSlots + 1)))
253 {
254 DPRINT1("Doorbell offset 0x%lx invalid for a %lu byte BAR\n", Offset, m_Length);
256 }
258
260 if (Offset == 0 ||
262 {
263 DPRINT1("Runtime offset 0x%lx invalid for a %lu byte BAR\n", Offset, m_Length);
265 }
267
269 if (Value != XHCI_PAGESIZE_4K)
270 {
271 DPRINT1("PAGESIZE 0x%lx is not 4 KB only\n", Value);
273 }
274
275 DPRINT("xHCI %x.%02x: %lu slots, %lu interrupters, %lu ports, %lu scratchpads, HCC 0x%08lx/0x%08lx\n",
278 return STATUS_SUCCESS;
279}
VOID SetErrata(_In_ XhciErrata Bit)
Definition: hc.cpp:183
ULONG m_Streams
Definition: mmio.h:206
ULONG FindExtendedCapability(_In_ ULONG Id, _In_ ULONG Start) const
Definition: mmio.cpp:284
PUCHAR m_Doorbells
Definition: mmio.h:188
VOID ReadFirmwareVersion()
Definition: mmio.cpp:147
PUCHAR m_Runtime
Definition: mmio.h:187
ULONG m_Scratchpads
Definition: mmio.h:202
PUCHAR m_Operational
Definition: mmio.h:186
#define DPRINT
Definition: sndvol32.h:73
unsigned char UCHAR
Definition: typedefs.h:53
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
#define XHCI_EXTCAP_DEBUG
Definition: xhcihw.h:311
#define XHCI_CAP_HCSPARAMS1
Definition: xhcihw.h:336
#define XHCI_HCS1_MAX_INTRS_SHIFT
Definition: xhcihw.h:350
#define XHCI_OP_PAGESIZE
Definition: xhcihw.h:383
#define XHCI_HCS2_ERST_MAX_MASK
Definition: xhcihw.h:357
#define XHCI_HCS3_U2_LATENCY_SHIFT
Definition: xhcihw.h:365
#define XHCI_CAP_DBOFF
Definition: xhcihw.h:340
#define XHCI_HCC1_XECP_SHIFT
Definition: xhcihw.h:373
#define XHCI_HCIVERSION_MAJOR_SHIFT
Definition: xhcihw.h:345
#define XHCI_INTERRUPTER_STRIDE
Definition: xhcihw.h:152
#define XHCI_CAP_HCSPARAMS3
Definition: xhcihw.h:338
#define XHCI_CAP_HCSPARAMS2
Definition: xhcihw.h:337
#define XHCI_HCIVERSION_MINOR_SHIFT
Definition: xhcihw.h:346
#define XHCI_HCS1_MAX_PORTS_SHIFT
Definition: xhcihw.h:352
#define XHCI_CAP_RTSOFF
Definition: xhcihw.h:341
#define XHCI_CAPLENGTH_MASK
Definition: xhcihw.h:344
#define XHCI_HCC1_MAX_PSA_MASK
Definition: xhcihw.h:372
#define XHCI_HCS2_SCRATCH_HI_MASK
Definition: xhcihw.h:359
#define XHCI_HCS2_ERST_MAX_SHIFT
Definition: xhcihw.h:356
#define XHCI_HCS1_MAX_SLOTS_MASK
Definition: xhcihw.h:349
#define XHCI_HCS1_MAX_INTRS_MASK
Definition: xhcihw.h:351
#define XHCI_CAP_HCCPARAMS2
Definition: xhcihw.h:342
#define XHCI_RUNTIME_INTERRUPTER_BASE
Definition: xhcihw.h:151
#define XHCI_EXTCAP_LEGACY
Definition: xhcihw.h:428
#define XHCI_HCS2_SCRATCH_HI_SHIFT
Definition: xhcihw.h:358
#define XHCI_HCC1_MAX_PSA_SHIFT
Definition: xhcihw.h:371
#define XHCI_HCS2_SCRATCH_LO_SHIFT
Definition: xhcihw.h:361
#define XHCI_DOORBELL_STRIDE
Definition: xhcihw.h:422
#define XHCI_HCS3_U1_LATENCY_MASK
Definition: xhcihw.h:364
#define XHCI_PAGESIZE_4K
Definition: xhcihw.h:412
#define XHCI_CAP_LENGTH_VERSION
Definition: xhcihw.h:335

Referenced by Prepare().

◆ Prepare()

NTSTATUS XhciRegisters::Prepare ( _In_ XhciController *  Controller,
_In_ WDFCMRESLIST  Translated 
)

Definition at line 92 of file mmio.cpp.

95{
97
99
100 Status = MapRegisters(Translated);
101 if (!NT_SUCCESS(Status))
102 return Status;
103
105 if (!NT_SUCCESS(Status))
106 {
107 DPRINT1("Capability registers rejected 0x%lx\n", Status);
108 return Status;
109 }
110
112 if (!NT_SUCCESS(Status))
113 {
114 DPRINT1("BIOS handoff failed 0x%lx\n", Status);
115 return Status;
116 }
117
119 if (!NT_SUCCESS(Status))
120 DPRINT1("Initial controller reset failed 0x%lx\n", Status);
121
122 return Status;
123}
NTSTATUS ParseCapabilities()
Definition: mmio.cpp:171
NTSTATUS ResetController(_In_ BOOLEAN AllowRunning)
Definition: mmio.cpp:806
NTSTATUS MapRegisters(_In_ WDFCMRESLIST Translated)
Definition: mmio.cpp:57
NTSTATUS BiosHandoff()
Definition: mmio.cpp:712
_Must_inspect_result_ _In_ WDFDEVICE _In_ PUCX_CONTROLLER_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ UCXCONTROLLER * Controller

Referenced by XhciController::PrepareHardware().

◆ ProgramSsicPortUnused()

VOID XhciRegisters::ProgramSsicPortUnused ( _In_ BOOLEAN  PowerDown)

Definition at line 1004 of file mmio.cpp.

1006{
1007 if (!m_Controller->HasErrata(XhciErrata::PortParkIdleSsic))
1008 return;
1009
1011 if (PowerDown)
1013 else
1016}
#define XHCI_SSIC_PROG_UNUSED
Definition: mmio.cpp:23
#define XHCI_VENDOR_SSIC_PORT
Definition: mmio.cpp:21
#define XHCI_SSIC_PROG_DONE
Definition: mmio.cpp:22

Referenced by XhciController::D0Exit(), ResetController(), and XhciController::RunD0Pass().

◆ Read64()

ULONG64 XhciRegisters::Read64 ( _In_ PUCHAR  Address) const
private

Definition at line 386 of file mmio.cpp.

388{
389 ULONG Low;
390 ULONG High;
391
392#ifdef _WIN64
393 if (!m_Controller->HasErrata(XhciErrata::RegSplit64BitAccess))
394 return READ_REGISTER_ULONG64((PULONG64)Address);
395#endif
396
399 return ((ULONG64)High << 32) | Low;
400}
unsigned __int64 * PULONG64
Definition: imports.h:198
static WCHAR Address[46]
Definition: ping.c:68
@ High
Definition: strmini.h:378
@ Low
Definition: strmini.h:380

Referenced by ReadOperational64(), and ReadRuntime64().

◆ ReadByte()

UCHAR XhciRegisters::ReadByte ( _In_ ULONG  Offset) const
private

Definition at line 356 of file mmio.cpp.

358{
360}
NTKERNELAPI UCHAR NTAPI READ_REGISTER_UCHAR(IN PUCHAR Register)

Referenced by BiosHandoff().

◆ ReadCapability32()

ULONG XhciRegisters::ReadCapability32 ( _In_ ULONG  Offset) const

Definition at line 421 of file mmio.cpp.

423{
424 if (!m_Mapped)
425 return MAXULONG;
426
428}
#define MAXULONG
Definition: typedefs.h:251

Referenced by Addressing64(), XhciController::D0Entry(), FindExtendedCapability(), ParseCapabilities(), and ReadFirmwareVersion().

◆ ReadExtended32()

ULONG XhciRegisters::ReadExtended32 ( _In_ ULONG  Offset) const

Definition at line 319 of file mmio.cpp.

321{
322 if (!InRange(Offset, sizeof(ULONG)))
323 {
324 DPRINT1("Extended capability read at 0x%lx outside the BAR\n", Offset);
325 return MAXULONG;
326 }
327
329}

Referenced by BiosHandoff(), XhciRootHub::FillSpeeds(), XhciRootHub::IsHiddenDebugPort(), XhciRootHub::ParseProtocol(), XhciRootHub::Prepare(), XhciRootHub::QueryTunnelState(), and SaveVendorBits().

◆ ReadFirmwareVersion()

VOID XhciRegisters::ReadFirmwareVersion ( )
private

Definition at line 147 of file mmio.cpp.

148{
150 BOOLEAN Qualcomm;
151
152 if (Id->FirmwareVersion != XHCI_FIRMWARE_UNKNOWN)
153 return;
154
155 Qualcomm = (Id->ParentBus == UcxControllerParentBusTypeAcpi &&
156 _strnicmp(Id->AcpiVendorId, "QCOM", 4) == 0);
157
158 if (Id->PciVendorId == 0x1B6F)
159 {
162 }
163 else if (Id->PciVendorId == 0x104C || Qualcomm)
164 {
166 Id->FirmwareVersion = ReadCapability32(XHCI_VENDOR_TI_FIRMWARE) & 0xFFFF;
167 }
168}
unsigned char BOOLEAN
Definition: actypes.h:127
XhciIdentity m_Identity
Definition: hc.h:100
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
#define XHCI_FIRMWARE_UNKNOWN
Definition: hc.h:21
#define XHCI_VENDOR_ETRON_FIRMWARE
Definition: mmio.cpp:14
#define XHCI_VENDOR_TI_FIRMWARE
Definition: mmio.cpp:16
@ UcxControllerParentBusTypeAcpi
Definition: ucxcontroller.h:18

Referenced by ParseCapabilities().

◆ ReadOperational32()

◆ ReadOperational64()

ULONG64 XhciRegisters::ReadOperational64 ( _In_ ULONG  Offset) const

Definition at line 450 of file mmio.cpp.

452{
453 if (!m_Mapped)
454 return ~0ULL;
455
456 return Read64(m_Operational + Offset);
457}
ULONG64 Read64(_In_ PUCHAR Address) const
Definition: mmio.cpp:386
#define ULL(a, b)
Definition: format_msg.c:27

Referenced by XhciCommandRing::OnTimer().

◆ ReadPort32()

ULONG XhciRegisters::ReadPort32 ( _In_ ULONG  Port,
_In_ ULONG  Offset 
) const

PORTSC and the three registers after it for a 1 based port number.

Definition at line 516 of file mmio.cpp.

519{
520 if (!m_Mapped || Port == 0 || Port > m_MaxPorts)
521 return MAXULONG;
522
524 XHCI_OP_PORT_STRIDE * (Port - 1) + Offset));
525}
CPPORT Port[4]
Definition: headless.c:38
#define XHCI_OP_PORT_STRIDE
Definition: xhcihw.h:387
#define XHCI_OP_PORT_BASE
Definition: xhcihw.h:386

Referenced by XhciRootHub::DisableLpmForSlot(), XhciRootHub::GetPortErrorCount(), XhciRootHub::GetPortStatus(), XhciRootHub::ParseProtocol(), XhciRootHub::ReadPortSc(), and XhciRootHub::UpdatePortReg().

◆ ReadRuntime32()

ULONG XhciRegisters::ReadRuntime32 ( _In_ ULONG  Offset) const

Definition at line 469 of file mmio.cpp.

471{
472 if (!m_Mapped)
473 return MAXULONG;
474
476}

Referenced by CurrentFrame().

◆ ReadRuntime64()

ULONG64 XhciRegisters::ReadRuntime64 ( _In_ ULONG  Offset) const

Definition at line 488 of file mmio.cpp.

490{
491 if (!m_Mapped)
492 return ~0ULL;
493
494 return Read64(m_Runtime + Offset);
495}

◆ Release()

VOID XhciRegisters::Release ( )

Definition at line 126 of file mmio.cpp.

127{
128 if (m_Mapped)
129 {
131 m_Mapped = FALSE;
132 }
133
134 m_Base = NULL;
135 m_Length = 0;
137 m_Runtime = NULL;
139 m_ExtendedList = 0;
140 m_LegacySupport = 0;
142}
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:192

Referenced by XhciController::ReleaseHardware().

◆ Reset()

NTSTATUS XhciRegisters::Reset ( )

Definition at line 800 of file mmio.cpp.

801{
802 return ResetController(FALSE);
803}

Referenced by XhciController::D0Entry().

◆ ResetController()

NTSTATUS XhciRegisters::ResetController ( _In_ BOOLEAN  AllowRunning)

HCRST sequence. Reset() is this with AllowRunning FALSE.

Definition at line 806 of file mmio.cpp.

808{
809 ULONG Waits;
810 ULONG Step = 1;
811 ULONG Elapsed = 0;
813
815 return STATUS_SUCCESS;
816
818 if (!NT_SUCCESS(Status))
819 {
820 DPRINT1("Controller not ready before reset\n");
821 return Status;
822 }
823
824 if (!AllowRunning && !(ReadOperational32(XHCI_OP_USBSTS) & XHCI_USBSTS_HCH))
825 {
826 DPRINT1("Reset refused, controller not halted\n");
827 return STATUS_UNSUCCESSFUL;
828 }
829
831
833
834 /* QUIRK: Intel controllers can hang the system if a register is read within 1 ms of HCRST */
836
837 for (Waits = 0; ReadOperational32(XHCI_OP_USBCMD) & XHCI_USBCMD_HCRST; Waits++)
838 {
839 if (Waits == XHCI_RESET_WAITS)
840 {
841 DPRINT1("Host controller reset did not finish in %lu ms\n", Elapsed);
842 return STATUS_UNSUCCESSFUL;
843 }
844
845 XhciSleepMs(Step);
846 Elapsed += Step;
847 if (Step < XHCI_RESET_MAX_STEP_MS)
848 Step *= 2;
849 }
850
851 if (Elapsed > XHCI_RESET_SLOW_MS)
852 DPRINT1("Host controller reset took %lu ms, over the %u ms limit\n", Elapsed, XHCI_RESET_SLOW_MS);
853
855 if (!NT_SUCCESS(Status))
856 {
857 DPRINT1("Controller not ready after reset\n");
858 return Status;
859 }
860
862 XhciSleepMs(100);
863
864 return STATUS_SUCCESS;
865}
@ FixAsmediaResetDelay
Definition: hc.h:109
VOID ProgramSsicPortUnused(_In_ BOOLEAN PowerDown)
Definition: mmio.cpp:1004
NTSTATUS WaitForReady()
Definition: mmio.cpp:690
VOID WriteOperational32(_In_ ULONG Offset, _In_ ULONG Value)
Definition: mmio.cpp:441
#define XHCI_RESET_MAX_STEP_MS
Definition: mmio.cpp:35
#define XHCI_RESET_WAITS
Definition: mmio.cpp:34
#define XHCI_RESET_SLOW_MS
Definition: mmio.cpp:36
#define XHCI_USBCMD_HCRST
Definition: xhcihw.h:391
#define XHCI_OP_USBCMD
Definition: xhcihw.h:381

Referenced by XhciController::D0Exit(), XhciController::InternalReset(), Prepare(), and Reset().

◆ RestoreState()

NTSTATUS XhciRegisters::RestoreState ( )

Definition at line 984 of file mmio.cpp.

985{
987
989 return STATUS_SUCCESS;
990
992 if (!NT_SUCCESS(Status))
993 return Status;
994
995 /* DNCTRL is not part of the saved state and must be back before CRS */
999}
NTSTATUS CheckStateOperationAllowed() const
Definition: mmio.cpp:914
NTSTATUS WaitForStateOperation(_In_ ULONG BusyBit)
Definition: mmio.cpp:934
#define XHCI_DNCTRL_FUNCTION_WAKE
Definition: xhcihw.h:415
#define XHCI_OP_DNCTRL
Definition: xhcihw.h:384
#define XHCI_USBCMD_CRS
Definition: xhcihw.h:395

Referenced by XhciController::D0Entry().

◆ RestoreVendorBits()

VOID XhciRegisters::RestoreVendorBits ( )

Definition at line 1035 of file mmio.cpp.

1036{
1037 ULONG Index;
1038
1039 if (!m_Controller->HasErrata(XhciErrata::PwrPreserveVendorRegs))
1040 return;
1041
1043 {
1044 if (m_VendorBits & (1UL << Index))
1046 else
1048 }
1049}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
ULONG m_VendorBits
Definition: mmio.h:209
#define XHCI_VENDOR_SAVED_BIT
Definition: mmio.cpp:24
static const ULONG XhciVendorBitRegisters[]
Definition: mmio.cpp:26

Referenced by XhciController::RunD0Pass().

◆ RingDoorbell()

VOID XhciRegisters::RingDoorbell ( _In_ ULONG  Index,
_In_ ULONG  Value 
)

◆ Run()

NTSTATUS XhciRegisters::Run ( )

Definition at line 868 of file mmio.cpp.

869{
871 ULONG Index;
872
874 return STATUS_SUCCESS;
875
877 {
878 DPRINT1("Start refused, controller not halted\n");
880 }
881
883
884 /* QUIRK: HSEE is left as it reads */
892
893 for (Index = 0; Index < XHCI_RUN_STALLS; Index++)
894 {
897 return STATUS_SUCCESS;
898 }
899
900 /* Then poll with 5 ms sleeps */
901 for (Index = 0; Index < XHCI_RUN_WAITS; Index++)
902 {
905 return STATUS_SUCCESS;
906 }
907
908 /* QUIRK: still halted is only reported */
909 DPRINT1("Controller still halted after start, USBSTS 0x%08lx\n", ReadOperational32(XHCI_OP_USBSTS));
910 return STATUS_SUCCESS;
911}
#define XHCI_RUN_STALL_US
Definition: mmio.cpp:38
#define XHCI_RUN_WAITS
Definition: mmio.cpp:39
#define XHCI_RUN_STALLS
Definition: mmio.cpp:37
#define XHCI_RUN_WAIT_MS
Definition: mmio.cpp:40
Definition: shell.h:41
#define XHCI_USBCMD_INTE
Definition: xhcihw.h:392
#define XHCI_USBCMD_CME
Definition: xhcihw.h:397
#define XHCI_USBCMD_ETE
Definition: xhcihw.h:398
#define XHCI_HCC2_CMC
Definition: xhcihw.h:376
#define XHCI_USBCMD_RS
Definition: xhcihw.h:390
#define XHCI_HCC2_ETC
Definition: xhcihw.h:378
#define XHCI_HCC2_LEC
Definition: xhcihw.h:377

Referenced by XhciController::StartController().

◆ SaveState()

NTSTATUS XhciRegisters::SaveState ( )

Definition at line 968 of file mmio.cpp.

Referenced by XhciController::D0Exit().

◆ SaveVendorBits()

VOID XhciRegisters::SaveVendorBits ( )

Definition at line 1019 of file mmio.cpp.

1020{
1021 ULONG Index;
1022
1023 if (!m_Controller->HasErrata(XhciErrata::PwrPreserveVendorRegs))
1024 return;
1025
1026 m_VendorBits = 0;
1028 {
1030 m_VendorBits |= 1UL << Index;
1031 }
1032}

Referenced by XhciController::D0Exit().

◆ ScratchpadCount()

ULONG XhciRegisters::ScratchpadCount ( ) const

Definition at line 573 of file mmio.cpp.

574{
575 return m_Scratchpads;
576}

Referenced by _IRQL_requires_().

◆ Stop()

NTSTATUS XhciRegisters::Stop ( )

Definition at line 775 of file mmio.cpp.

776{
777 ULONG Waits;
778
780 return STATUS_SUCCESS;
781
783
784 /* QUIRK: each 1 ms wait lasts a full timer tick */
785 for (Waits = 0; !(ReadOperational32(XHCI_OP_USBSTS) & XHCI_USBSTS_HCH); Waits++)
786 {
787 if (Waits == XHCI_HALT_WAITS)
788 {
789 DPRINT1("Controller did not halt, USBSTS 0x%08lx\n", ReadOperational32(XHCI_OP_USBSTS));
790 return STATUS_UNSUCCESSFUL;
791 }
792
793 XhciSleepMs(1);
794 }
795
796 return STATUS_SUCCESS;
797}
#define XHCI_HALT_WAITS
Definition: mmio.cpp:33

Referenced by BiosHandoff(), XhciController::D0Exit(), and XhciController::InternalReset().

◆ SupportedStreams()

ULONG XhciRegisters::SupportedStreams ( ) const

Definition at line 585 of file mmio.cpp.

586{
587 return m_Streams;
588}

Referenced by XhciEndpoint::Initialize(), XhciEndpoint::OpenStreams(), and XhciController::QueryUsbCapability().

◆ VersionMajor()

UCHAR XhciRegisters::VersionMajor ( ) const

Definition at line 615 of file mmio.cpp.

616{
617 return m_VersionMajor;
618}

Referenced by XhciTransferRing::PacketCount(), XhciController::ReadVerifierFlags(), and XhciTransferRing::TdSize().

◆ VersionMinor()

UCHAR XhciRegisters::VersionMinor ( ) const

Definition at line 621 of file mmio.cpp.

622{
623 return m_VersionMinor;
624}

◆ WaitForReady()

NTSTATUS XhciRegisters::WaitForReady ( )

Definition at line 690 of file mmio.cpp.

691{
692 ULONG Waits;
693
695 return STATUS_SUCCESS;
696
697 for (Waits = 0; ReadOperational32(XHCI_OP_USBSTS) & XHCI_USBSTS_CNR; Waits++)
698 {
699 if (Waits == XHCI_CNR_WAITS)
700 {
701 DPRINT1("Controller Not Ready still set after %lu ms\n", XHCI_CNR_WAITS * XHCI_CNR_WAIT_MS);
702 return STATUS_UNSUCCESSFUL;
703 }
704
706 }
707
708 return STATUS_SUCCESS;
709}
#define XHCI_CNR_WAITS
Definition: mmio.cpp:31
#define XHCI_CNR_WAIT_MS
Definition: mmio.cpp:32
#define XHCI_USBSTS_CNR
Definition: xhcihw.h:408

Referenced by ResetController().

◆ WaitForStateOperation()

NTSTATUS XhciRegisters::WaitForStateOperation ( _In_ ULONG  BusyBit)
private

Polls USBSTS for a save or restore to finish.

Definition at line 934 of file mmio.cpp.

936{
938 ULONG Usbsts;
939 ULONG Waits = 0;
940
941 Interval.QuadPart = -2000;
942
943 for (;;)
944 {
946 if (Usbsts & XHCI_USBSTS_SRE)
947 {
948 DPRINT1("Save/Restore Error reported, USBSTS 0x%08lx\n", Usbsts);
951 }
952
953 if (!(Usbsts & BusyBit))
954 return STATUS_SUCCESS;
955
956 if (Waits == XHCI_STATE_WAITS)
957 {
958 DPRINT1("State save or restore timed out, USBSTS 0x%08lx\n", Usbsts);
960 }
961
962 Waits++;
964 }
965}
#define KeDelayExecutionThread(mode, foo, t)
Definition: env_spec_w32.h:484
#define XHCI_STATE_WAITS
Definition: mmio.cpp:41
#define KernelMode
Definition: asm.h:38
DWORD Interval
Definition: netstat.c:28
#define XHCI_USBSTS_SRE
Definition: xhcihw.h:407

Referenced by RestoreState(), and SaveState().

◆ Write64()

VOID XhciRegisters::Write64 ( _In_ PUCHAR  Address,
_In_ ULONG64  Value 
)
private

Definition at line 403 of file mmio.cpp.

406{
407#ifdef _WIN64
408 if (!m_Controller->HasErrata(XhciErrata::RegSplit64BitAccess))
409 {
410 WRITE_REGISTER_ULONG64((PULONG64)Address, Value);
411 return;
412 }
413#endif
414
415 /* Low dword first; CRCR, ERSTBA and ERDP latch on the high dword write */
417 WRITE_REGISTER_ULONG((PULONG)(Address + sizeof(ULONG)), (ULONG)(Value >> 32));
418}

Referenced by WriteOperational64(), and WriteRuntime64().

◆ WriteByte()

VOID XhciRegisters::WriteByte ( _In_ ULONG  Offset,
_In_ UCHAR  Value 
)
private

Definition at line 363 of file mmio.cpp.

366{
368}
NTKERNELAPI VOID NTAPI WRITE_REGISTER_UCHAR(IN PUCHAR Register, IN UCHAR Value)

Referenced by BiosHandoff().

◆ WriteExtended32()

VOID XhciRegisters::WriteExtended32 ( _In_ ULONG  Offset,
_In_ ULONG  Value 
)

Definition at line 332 of file mmio.cpp.

335{
336 if (!InRange(Offset, sizeof(ULONG)))
337 {
338 DPRINT1("Extended capability write at 0x%lx outside the BAR\n", Offset);
339 return;
340 }
341
343}

Referenced by BiosHandoff().

◆ WriteOperational32()

VOID XhciRegisters::WriteOperational32 ( _In_ ULONG  Offset,
_In_ ULONG  Value 
)

◆ WriteOperational64()

VOID XhciRegisters::WriteOperational64 ( _In_ ULONG  Offset,
_In_ ULONG64  Value 
)

Definition at line 460 of file mmio.cpp.

463{
464 if (m_Mapped)
466}
VOID Write64(_In_ PUCHAR Address, _In_ ULONG64 Value)
Definition: mmio.cpp:403

Referenced by XhciCommandRing::InitializeRing(), XhciCommandRing::OnTimer(), XhciSlotTable::Program(), XhciCommandRing::Release(), and XhciCommandRing::RestartStoppedRingLocked().

◆ WritePort32()

VOID XhciRegisters::WritePort32 ( _In_ ULONG  Port,
_In_ ULONG  Offset,
_In_ ULONG  Value 
)

Definition at line 528 of file mmio.cpp.

532{
533 if (!m_Mapped || Port == 0 || Port > m_MaxPorts)
534 return;
535
538}

Referenced by XhciRootHub::UpdatePortReg(), and XhciRootHub::UpdatePortScLocked().

◆ WriteRuntime32()

VOID XhciRegisters::WriteRuntime32 ( _In_ ULONG  Offset,
_In_ ULONG  Value 
)

Definition at line 479 of file mmio.cpp.

482{
483 if (m_Mapped)
485}

◆ WriteRuntime64()

VOID XhciRegisters::WriteRuntime64 ( _In_ ULONG  Offset,
_In_ ULONG64  Value 
)

Definition at line 498 of file mmio.cpp.

501{
502 if (m_Mapped)
504}

Member Data Documentation

◆ m_Base

◆ m_CapLength

ULONG XhciRegisters::m_CapLength
private

Definition at line 194 of file mmio.h.

Referenced by CapLength(), and ParseCapabilities().

◆ m_Controller

◆ m_DebugCapability

ULONG XhciRegisters::m_DebugCapability
private

Definition at line 192 of file mmio.h.

Referenced by DebugCapabilityOffset(), ParseCapabilities(), and Release().

◆ m_Doorbells

PUCHAR XhciRegisters::m_Doorbells
private

Definition at line 188 of file mmio.h.

Referenced by ParseCapabilities(), Release(), and RingDoorbell().

◆ m_ExtendedList

ULONG XhciRegisters::m_ExtendedList
private

Definition at line 190 of file mmio.h.

Referenced by FindExtendedCapability(), ParseCapabilities(), and Release().

◆ m_Hccparams1

ULONG XhciRegisters::m_Hccparams1
private

Definition at line 204 of file mmio.h.

Referenced by ContextSize(), ContiguousFrameId(), Hccparams1(), and ParseCapabilities().

◆ m_Hccparams2

ULONG XhciRegisters::m_Hccparams2
private

Definition at line 205 of file mmio.h.

Referenced by Hccparams2(), ParseCapabilities(), and Run().

◆ m_Hcsparams3

ULONG XhciRegisters::m_Hcsparams3
private

Definition at line 203 of file mmio.h.

Referenced by Hcsparams3(), and ParseCapabilities().

◆ m_LegacySupport

ULONG XhciRegisters::m_LegacySupport
private

Definition at line 191 of file mmio.h.

Referenced by BiosHandoff(), LegacySupportOffset(), ParseCapabilities(), and Release().

◆ m_Length

ULONG XhciRegisters::m_Length
private

Definition at line 184 of file mmio.h.

Referenced by FindExtendedCapability(), InRange(), MapRegisters(), ParseCapabilities(), and Release().

◆ m_Mapped

◆ m_MaxEventRingSegments

ULONG XhciRegisters::m_MaxEventRingSegments
private

Definition at line 201 of file mmio.h.

Referenced by EventRingSegmentTableMax(), MaxEventRingSegments(), and ParseCapabilities().

◆ m_MaxInterrupters

ULONG XhciRegisters::m_MaxInterrupters
private

Definition at line 199 of file mmio.h.

Referenced by MaxInterrupters(), and ParseCapabilities().

◆ m_MaxPorts

ULONG XhciRegisters::m_MaxPorts
private

Definition at line 200 of file mmio.h.

Referenced by MaxPorts(), ParseCapabilities(), ReadPort32(), and WritePort32().

◆ m_MaxSlots

ULONG XhciRegisters::m_MaxSlots
private

Definition at line 198 of file mmio.h.

Referenced by MaxSlots(), ParseCapabilities(), and RingDoorbell().

◆ m_MseLengthUsable

BOOLEAN XhciRegisters::m_MseLengthUsable
private

Definition at line 197 of file mmio.h.

Referenced by MseLengthUsable(), and ParseCapabilities().

◆ m_Operational

PUCHAR XhciRegisters::m_Operational
private

◆ m_Runtime

PUCHAR XhciRegisters::m_Runtime
private

◆ m_Scratchpads

ULONG XhciRegisters::m_Scratchpads
private

Definition at line 202 of file mmio.h.

Referenced by ParseCapabilities(), and ScratchpadCount().

◆ m_Streams

ULONG XhciRegisters::m_Streams
private

Definition at line 206 of file mmio.h.

Referenced by ParseCapabilities(), and SupportedStreams().

◆ m_VendorBits

ULONG XhciRegisters::m_VendorBits
private

Bit 25 of the three errata 55 registers, one bit each.

Definition at line 209 of file mmio.h.

Referenced by RestoreVendorBits(), and SaveVendorBits().

◆ m_VersionMajor

UCHAR XhciRegisters::m_VersionMajor
private

Definition at line 195 of file mmio.h.

Referenced by InterfaceVersion(), ParseCapabilities(), and VersionMajor().

◆ m_VersionMinor

UCHAR XhciRegisters::m_VersionMinor
private

Definition at line 196 of file mmio.h.

Referenced by InterfaceVersion(), ParseCapabilities(), and VersionMinor().


The documentation for this class was generated from the following files: