ReactOS 0.4.17-dev-1281-g065abb3
devdesc.cpp File Reference
#include "usbhub3.h"
#include "devreq.h"
#include <debug.h>
Include dependency graph for devdesc.cpp:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define DESC_FIRST_READ_KEEP   8
 
#define DESC_SLOW_ENUM_VENDOR   0x13FE
 
#define DESC_SLOW_ENUM_PRODUCT   0x5200
 
#define DESC_CLASS_MISCELLANEOUS   0xEF
 
#define DESC_SUBCLASS_COMMON   0x02
 
#define DESC_PROTOCOL_IAD   0x01
 
#define DESC_SUBCLASS_SCSI   0x06
 
#define DESC_PROTOCOL_UAS   0x62
 
#define DESC_MODE_CONFIGURED   3
 

Functions

VOID NTAPI HubDeviceDescContext (_In_ HubChild *Child, _Out_ HubDescContext *Context)
 
static VOID NTAPI HubSetSqmFlag (_In_ HubChild *Child, _In_ ChildSqm Flag)
 
static BOOLEAN NTAPI HubIsCompositeLayout (_In_ const USB_DEVICE_DESCRIPTOR *Device, _In_ const USB_CONFIGURATION_DESCRIPTOR *Config)
 
static VOID NTAPI HubPickCompatIdInterface (_In_ HubChild *Child, _In_ PUSB_CONFIGURATION_DESCRIPTOR Config)
 
static UCHAR NTAPI HubBillboardModeCount (_In_ PUSB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR Caps)
 
VOID NTAPI HubFreeBillboardInfo (_In_ HubChild *Child)
 
static VOID NTAPI HubKeepBillboardData (_In_ HubChild *Child, _In_ PUSB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR Caps)
 
static BOOLEAN NTAPI HubCacheSublinkSpeeds (_In_ HubChild *Child, _In_ PUSB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR Caps)
 
 _IRQL_requires_ (PASSIVE_LEVEL) static VOID NTAPI HubPublishDualRolePartner(_In_ HubPort *Port
 Sends a synchronous IOCTL to the specified device object.
 
 HubPublishDualRolePartner (Child->m_Port, TRUE, Child->m_DualRolePartnerFeatures)
 
static VOID NTAPI HubCacheMsOs20SetInfoFromBos (_In_ HubChild *Child, _In_ const HubMsOs20SetInfo *SetInfo)
 
static BOOLEAN NTAPI HubBosSpanFits (_In_ const VOID *Start, _In_ ULONG Length, _In_ const UCHAR *End)
 
static VOID NTAPI HubDropCapsPastEnd (_Inout_ HubBosInfo *Info, _In_ const UCHAR *End)
 
static VOID NTAPI HubNoteAltMode (_In_ HubBillboardInfo *Billboard)
 
static BOOLEAN NTAPI HubCacheString (_In_ HubChild *Child, _In_ ULONG BadReason, _Outptr_result_maybenull_ PUSB_STRING_DESCRIPTOR *Cache)
 
VOID NTAPI HubReleaseTransferState (_In_ HubChild *Child)
 

Variables

_In_ BOOLEAN Attached
 
_In_ BOOLEAN _In_ ULONG Features
 
Child m_DualRoleRequestCode = Features->VendorCommand
 
HubQueryLocalDualRoleFeatures & Child
 
Child m_DualRolePartnerFeatures = Features->Features
 

Macro Definition Documentation

◆ DESC_CLASS_MISCELLANEOUS

#define DESC_CLASS_MISCELLANEOUS   0xEF

Definition at line 22 of file devdesc.cpp.

◆ DESC_FIRST_READ_KEEP

#define DESC_FIRST_READ_KEEP   8

Definition at line 15 of file devdesc.cpp.

◆ DESC_MODE_CONFIGURED

#define DESC_MODE_CONFIGURED   3

Definition at line 31 of file devdesc.cpp.

◆ DESC_PROTOCOL_IAD

#define DESC_PROTOCOL_IAD   0x01

Definition at line 24 of file devdesc.cpp.

◆ DESC_PROTOCOL_UAS

#define DESC_PROTOCOL_UAS   0x62

Definition at line 28 of file devdesc.cpp.

◆ DESC_SLOW_ENUM_PRODUCT

#define DESC_SLOW_ENUM_PRODUCT   0x5200

Definition at line 19 of file devdesc.cpp.

◆ DESC_SLOW_ENUM_VENDOR

#define DESC_SLOW_ENUM_VENDOR   0x13FE

Definition at line 18 of file devdesc.cpp.

◆ DESC_SUBCLASS_COMMON

#define DESC_SUBCLASS_COMMON   0x02

Definition at line 23 of file devdesc.cpp.

◆ DESC_SUBCLASS_SCSI

#define DESC_SUBCLASS_SCSI   0x06

Definition at line 27 of file devdesc.cpp.

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file devdesc.cpp.

Function Documentation

◆ _IRQL_requires_()

_IRQL_requires_ ( PASSIVE_LEVEL  )

Sends a synchronous IOCTL to the specified device object.

Parameters
[in]IoControlCodeThe IOCTL to send to the device.
[in]DeviceObjectPointer to the device object that will handle the IOCTL.
[in]InputBufferOptional pointer to a buffer containing input data for the IOCTL. When specified, the buffer should be at least of InputBufferLength size.
[in]InputBufferLengthSize in bytes, of the buffer pointed by InputBuffer.
[out]OutputBufferOptional pointer to a buffer that will receive output data from the IOCTL. When specified, the buffer should be at least of OutputBufferLength size.
[in]OutputBufferLengthSize in bytes, of the buffer pointed by OutputBuffer.
[in]FileObjectOptional pointer to a file object that may be necessary for the IOCTL.
Returns
An NTSTATUS code indicating success or failure of this function.
Note
Must be called at PASSIVE_LEVEL with all APCs enabled.

Nothing is found unless the PCI bus driver publishes the properties.

The root hub name without its prefix; NULL when the PDO has no name.

Grows a private buffer to what the helper asks for.

Lets KMDF handle the IRP, then hands it back here still uncompleted.

Waits for the device machine to answer a PnP or power event; returns the PnP status.

Definition at line 2121 of file class.c.

13175{
13177
13178 PAGED_CODE();
13179
13180 TracePrint((TRACE_LEVEL_VERBOSE,
13181 TRACE_FLAG_PNP,
13182 "ClassDetermineTokenOperationCommandSupport (%p): Entering function.\n",
13183 DeviceObject));
13184
13185 //
13186 // Send down Inquiry for VPD_THIRD_PARTY_COPY_PAGE and cache away the device parameters
13187 // from WINDOWS_BLOCK_DEVICE_TOKEN_LIMITS_DESCRIPTOR.
13188 //
13190
13191 if (NT_SUCCESS(status)) {
13192
13193 ULONG maxListIdentifier = MaxTokenOperationListIdentifier;
13194
13195 //
13196 // Query the maximum list identifier to use for TokenOperation commands.
13197 //
13198 if (NT_SUCCESS(ClasspGetMaximumTokenListIdentifier(DeviceObject, REG_DISK_CLASS_CONTROL, &maxListIdentifier))) {
13199 if (maxListIdentifier >= MIN_TOKEN_LIST_IDENTIFIERS) {
13200
13201 NT_ASSERT(maxListIdentifier <= MAX_TOKEN_LIST_IDENTIFIERS);
13202 MaxTokenOperationListIdentifier = maxListIdentifier;
13203 }
13204 }
13205
13206 }
13207
13208 TracePrint((TRACE_LEVEL_VERBOSE,
13209 TRACE_FLAG_PNP,
13210 "ClassDetermineTokenOperationCommandSupport (%p): Exiting function with status %x.\n",
13212 status));
13213
13214 return status;
13215}
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
#define REG_DISK_CLASS_CONTROL
Definition: classp.h:218
#define MAX_TOKEN_LIST_IDENTIFIERS
Definition: classp.h:215
#define MIN_TOKEN_LIST_IDENTIFIERS
Definition: classp.h:214
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
ULONG MaxTokenOperationListIdentifier
Definition: class.c:107
_IRQL_requires_same_ NTSTATUS ClasspGetBlockDeviceTokenLimitsInfo(_Inout_ PDEVICE_OBJECT DeviceObject)
Definition: class.c:13220
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
Definition: ps.c:97
uint32_t ULONG
Definition: typedefs.h:59
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
#define NT_ASSERT
Definition: rtlfuncs.h:3334

◆ HubBillboardModeCount()

static UCHAR NTAPI HubBillboardModeCount ( _In_ PUSB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR  Caps)
static

Definition at line 333 of file devdesc.cpp.

335{
337 ULONG Room;
338
339 if (Caps->bLength <= First)
340 return 0;
341
342 Room = (Caps->bLength - First) / sizeof(Caps->AlternateMode[0]);
343 return (UCHAR)min(Room, (ULONG)Caps->bNumberOfAlternateModes);
344}
WCHAR First[]
Definition: FormatMessage.c:11
#define min(a, b)
Definition: monoChain.cc:55
unsigned char UCHAR
Definition: typedefs.h:53
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by DeviceMachine::AltModeStringWanted().

◆ HubBosSpanFits()

static BOOLEAN NTAPI HubBosSpanFits ( _In_ const VOID *  Start,
_In_ ULONG  Length,
_In_ const UCHAR *  End 
)
static

Definition at line 490 of file devdesc.cpp.

494{
495 return (const UCHAR*)Start + Length <= End;
496}
static _Out_opt_ PULONGLONG Start
PUCHAR End
Definition: desccheck.cpp:2229
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102

Referenced by HubDropCapsPastEnd().

◆ HubCacheMsOs20SetInfoFromBos()

static VOID NTAPI HubCacheMsOs20SetInfoFromBos ( _In_ HubChild *  Child,
_In_ const HubMsOs20SetInfo *  SetInfo 
)
static

Definition at line 471 of file devdesc.cpp.

474{
475 RtlCopyMemory(&Child->m_MsOs20SetInfo, SetInfo, sizeof(Child->m_MsOs20SetInfo));
476 Child->m_MsOs20.Flags |= HUB_MSOS20_SET_INFO;
477
478 if (Child->m_MsOs20SetInfo.bAltEnumCode != 0 && !Child->m_AltEnumCached)
479 {
480 Child->m_MsOsVendorCode = Child->m_MsOs20SetInfo.bVendorCode;
481 Child->m_MsOs20.Flags |= HUB_MSOS20_ALT_ENUM;
482 }
483}
_In_ ULONG _In_ const HubMsOs20SetInfo * SetInfo
Definition: desccheck.cpp:3183
#define HUB_MSOS20_ALT_ENUM
Definition: desccheck.h:490
#define HUB_MSOS20_SET_INFO
Definition: desccheck.h:488
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536

Referenced by DeviceMachine::BosValid().

◆ HubCacheString()

static BOOLEAN NTAPI HubCacheString ( _In_ HubChild *  Child,
_In_ ULONG  BadReason,
_Outptr_result_maybenull_ PUSB_STRING_DESCRIPTOR *  Cache 
)
static

Definition at line 765 of file devdesc.cpp.

769{
774
775 *Cache = NULL;
776
779 {
780 Child->m_EnumMessageId = BadReason;
781 return FALSE;
782 }
783
785 if (Copy == NULL)
786 {
787 DPRINT1("Device %p no memory for a %u byte string\n", Child, String->bLength);
788 return FALSE;
789 }
790
792 *Cache = Copy;
793 return TRUE;
794}
#define DPRINT1
Definition: precomp.h:8
BOOLEAN NTAPI HubDescCheckString(_In_ const HubDescContext *Context, _In_reads_bytes_(Length) PUSB_STRING_DESCRIPTOR Descriptor, _In_ ULONG Length, _Out_opt_ PULONG AdjustedLength)
Definition: desccheck.cpp:2400
VOID NTAPI HubDeviceDescContext(_In_ HubChild *Child, _Out_ HubDescContext *Context)
Definition: devdesc.cpp:35
ULONG Copy
Definition: devhcd.cpp:1449
FORCEINLINE ULONG NTAPI HubDeviceBytesReturned(_In_ HubChild *Child)
Definition: devreq.h:37
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NonPagedPool
Definition: env_spec_w32.h:307
#define HUB_TAG_DEVICE
Definition: hubutil.h:13
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
_In_ UINT Bytes
Definition: mmcopy.h:9
static PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
struct _USB_STRING_DESCRIPTOR * PUSB_STRING_DESCRIPTOR
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2439

Referenced by DeviceMachine::LanguageIdsValid(), and DeviceMachine::ProductNameValid().

◆ HubCacheSublinkSpeeds()

static BOOLEAN NTAPI HubCacheSublinkSpeeds ( _In_ HubChild *  Child,
_In_ PUSB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR  Caps 
)
static

Definition at line 408 of file devdesc.cpp.

411{
413 ULONG Count = Caps->bmAttributes.SublinkSpeedAttrCount + 1;
414 ULONG Room = (Caps->bLength > First) ? (Caps->bLength - First) / sizeof(Caps->bmSublinkSpeedAttr[0]) : 0;
415 ULONG Size;
416
417 Count = min(Count, Room);
418 if (Count == 0)
419 return TRUE;
420
421 Size = Count * sizeof(Caps->bmSublinkSpeedAttr[0]);
423 Size,
425 if (Child->m_SublinkSpeedAttr == NULL)
426 {
427 DPRINT1("Device %p no memory for %lu sublink speeds\n", Child, Count);
428 return FALSE;
429 }
430
431 RtlCopyMemory(Child->m_SublinkSpeedAttr, Caps->bmSublinkSpeedAttr, Size);
432 Child->m_SublinkSpeedAttrCount = Count;
433 return TRUE;
434}
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
union _USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED * PUSB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED
USHORT Count
Definition: userreq.cpp:200
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539

Referenced by DeviceMachine::BosValid().

◆ HubDeviceDescContext()

VOID NTAPI HubDeviceDescContext ( _In_ HubChild *  Child,
_Out_ HubDescContext *  Context 
)

Validator context for a device, with its validation bits and hacks.

Definition at line 35 of file devdesc.cpp.

38{
40 Child->m_DeviceDescriptor.bcdUSB,
41 Child->Speed(),
43 Child->m_Port->m_Info.SspIsochBurstCount,
44 Child->m_ValidationBits);
45
46 /* Only names the device in the validator's debug prints */
47 Context->LogContext = Child;
48}
VOID NTAPI HubDescInitDeviceContext(_Out_ HubDescContext *Context, _In_ USHORT BcdUsb, _In_ USB_DEVICE_SPEED Speed, _In_ BOOLEAN Win8Behavior, _In_ ULONG SspIsochBurstCount, _In_opt_ PULONG Bitmap)
Definition: desccheck.cpp:91
HubQueryLocalDualRoleFeatures & Child
Definition: devdesc.cpp:459
@ UseWin8DescriptorValidation

Referenced by DeviceMachine::AltModeStringValid(), DeviceMachine::BillboardStringValid(), DeviceMachine::BosHeaderValid(), DeviceMachine::BosValid(), DeviceMachine::ConfigDescriptorValid(), DeviceMachine::ContainerIdHeaderValid(), DeviceMachine::ContainerIdKnown(), DeviceMachine::DeviceDescriptorValid(), DeviceMachine::ExtendedConfigHeaderValid(), DeviceMachine::ExtendedConfigValid(), DeviceMachine::FirstDescriptorValid(), HubCacheString(), DeviceMachine::MsOs20SetValid(), and DeviceMachine::MsOsDescriptorValid().

◆ HubDropCapsPastEnd()

static VOID NTAPI HubDropCapsPastEnd ( _Inout_ HubBosInfo *  Info,
_In_ const UCHAR *  End 
)
static

Definition at line 502 of file devdesc.cpp.

505{
506 if (Info->SuperSpeedPlus != NULL &&
507 !HubBosSpanFits(Info->SuperSpeedPlus,
508 max((ULONG)Info->SuperSpeedPlus->bLength,
510 End))
511 {
512 DPRINT1("SuperSpeedPlus capability runs past the BOS, ignored\n");
513 Info->SuperSpeedPlus = NULL;
514 }
515
516 if (Info->Billboard != NULL &&
517 !HubBosSpanFits(Info->Billboard,
518 max((ULONG)Info->Billboard->bLength,
520 End))
521 {
522 DPRINT1("Billboard capability runs past the BOS, ignored\n");
523 Info->Billboard = NULL;
524 }
525
526 if (Info->ContainerId != NULL && !HubBosSpanFits(Info->ContainerId, sizeof(*Info->ContainerId), End))
527 {
528 DPRINT1("Container id capability runs past the BOS, ignored\n");
529 Info->ContainerId = NULL;
530 }
531
532 if (Info->PlatformFeatures != NULL && !HubBosSpanFits(Info->PlatformFeatures, sizeof(*Info->PlatformFeatures), End))
533 {
534 DPRINT1("Platform features capability runs past the BOS, ignored\n");
535 Info->PlatformFeatures = NULL;
536 }
537
538 if (Info->MsOs20SetInfo != NULL && !HubBosSpanFits(Info->MsOs20SetInfo, sizeof(*Info->MsOs20SetInfo), End))
539 {
540 DPRINT1("MS OS 2.0 set info runs past the BOS, ignored\n");
541 Info->MsOs20SetInfo = NULL;
542 }
543}
static BOOLEAN NTAPI HubBosSpanFits(_In_ const VOID *Start, _In_ ULONG Length, _In_ const UCHAR *End)
Definition: devdesc.cpp:490
#define max(a, b)
Definition: svc.c:63
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690

Referenced by DeviceMachine::BosValid().

◆ HubFreeBillboardInfo()

VOID NTAPI HubFreeBillboardInfo ( _In_ HubChild *  Child)

Frees the billboard record and its descriptor copy, if any.

Definition at line 348 of file devdesc.cpp.

350{
351 HubBillboardInfo* Billboard = Child->m_Billboard;
352
353 if (Billboard == NULL)
354 return;
355
356 if (Billboard->Descriptor != NULL)
358
359 ExFreePoolWithTag(Billboard, HUB_TAG_HUB);
360 Child->m_Billboard = NULL;
361}
#define HUB_TAG_HUB
Definition: hubutil.h:12
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
PUSB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR Descriptor
Definition: hubchild.h:232

Referenced by HubKeepBillboardData(), HubReleaseTransferState(), and DeviceMachine::ReadBosHeader().

◆ HubIsCompositeLayout()

static BOOLEAN NTAPI HubIsCompositeLayout ( _In_ const USB_DEVICE_DESCRIPTOR *  Device,
_In_ const USB_CONFIGURATION_DESCRIPTOR *  Config 
)
static

Definition at line 142 of file devdesc.cpp.

145{
146 if (Device->bNumConfigurations != 1 || Config->bNumInterfaces <= 1)
147 return FALSE;
148
149 if (Device->bDeviceClass == 0)
150 return TRUE;
151
152 return Device->bDeviceClass == DESC_CLASS_MISCELLANEOUS &&
153 Device->bDeviceSubClass == DESC_SUBCLASS_COMMON &&
154 Device->bDeviceProtocol == DESC_PROTOCOL_IAD;
155}
#define DESC_CLASS_MISCELLANEOUS
Definition: devdesc.cpp:22
#define DESC_SUBCLASS_COMMON
Definition: devdesc.cpp:23
#define DESC_PROTOCOL_IAD
Definition: devdesc.cpp:24
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
Definition: hubucx.h:258
_Must_inspect_result_ _In_ WDFDEVICE _In_ PUCX_CONTROLLER_CONFIG Config

Referenced by DeviceMachine::ConfigDescriptorValid().

◆ HubKeepBillboardData()

static VOID NTAPI HubKeepBillboardData ( _In_ HubChild *  Child,
_In_ PUSB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR  Caps 
)
static

Definition at line 367 of file devdesc.cpp.

370{
371 HubBillboardInfo* Billboard;
372 ULONG Size;
373
375
376 Billboard = (HubBillboardInfo*)ExAllocatePoolZero(NonPagedPool, sizeof(*Billboard), HUB_TAG_HUB);
377 if (Billboard == NULL)
378 {
379 DPRINT1("Device %p no memory for the billboard record\n", Child);
380 return;
381 }
382
384
385 /* Readers walk every mode the descriptor claims, which may run past bLength */
387 Caps->bNumberOfAlternateModes * sizeof(Caps->AlternateMode[0]);
388 Size = max(Size, (ULONG)Caps->bLength);
389
391 Size,
393 if (Billboard->Descriptor == NULL)
394 {
395 DPRINT1("Device %p no memory for a %lu byte billboard copy\n", Child, Size);
396 ExFreePoolWithTag(Billboard, HUB_TAG_HUB);
397 return;
398 }
399
400 RtlCopyMemory(Billboard->Descriptor, Caps, Caps->bLength);
401 Child->m_Billboard = Billboard;
402}
VOID NTAPI HubFreeBillboardInfo(_In_ HubChild *Child)
Definition: devdesc.cpp:348
#define HUB_BILLBOARD_NO_MODE
Definition: hubchild.h:227
UCHAR CurrentMode
Definition: hubchild.h:233
struct _USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR * PUSB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR

Referenced by DeviceMachine::BosValid().

◆ HubNoteAltMode()

static VOID NTAPI HubNoteAltMode ( _In_ HubBillboardInfo *  Billboard)
static

Definition at line 685 of file devdesc.cpp.

687{
688 UCHAR Mode = Billboard->CurrentMode;
689 UCHAR Configured = (Billboard->Descriptor->bmConfigured[Mode / 4] >> ((Mode % 4) * 2)) & 3;
690
691 DPRINT("Billboard %p alternate mode %u configuration state %u\n", Billboard, Mode, Configured);
692
694 Billboard->ModeSuccess = TRUE;
695 else
696 Billboard->ModeError = TRUE;
697}
#define DESC_MODE_CONFIGURED
Definition: devdesc.cpp:31
_In_ ULONG Mode
Definition: hubbusif.h:303
#define DPRINT
Definition: sndvol32.h:73

Referenced by DeviceMachine::AltModeStringValid(), and DeviceMachine::AltModeStringWanted().

◆ HubPickCompatIdInterface()

static VOID NTAPI HubPickCompatIdInterface ( _In_ HubChild *  Child,
_In_ PUSB_CONFIGURATION_DESCRIPTOR  Config 
)
static

Definition at line 164 of file devdesc.cpp.

167{
170 USB_DEVICE_SPEED Speed = Child->Speed();
171 BOOLEAN FastEnough;
172
173 Interface = HubDescFindInterface(Config, Config, -1, -1, -1, -1, -1, NULL);
174 Child->m_CompatIdInterface = Interface;
175 if (Interface == NULL)
176 return;
177
178 if (Interface->bInterfaceClass == USB_DEVICE_CLASS_HUB)
179 {
180 Child->SetProperty(ChildProperty::IsHub);
182 return;
183 }
184
185 /* QUIRK: only UsbSuperSpeed qualifies, not a SuperSpeedPlus speed value */
186 FastEnough = (Speed == UsbSuperSpeed && Child->m_Hub->m_StreamsSupported) || Speed == UsbHighSpeed;
187
188 if (Child->HasProperty(ChildProperty::IsComposite) ||
189 Child->m_DeviceDescriptor.bcdUSB <= 0x0200 ||
190 Child->HasHack(ChildHack::DisableUasp) ||
191 !FastEnough)
192 {
193 return;
194 }
195
197 Config,
198 Interface->bInterfaceNumber,
199 -1,
203 NULL);
204 if (Uas != NULL)
205 {
207 Child->m_CompatIdInterface = Uas;
208 }
209}
unsigned char BOOLEAN
Definition: actypes.h:127
PUSB_INTERFACE_DESCRIPTOR NTAPI HubDescFindInterface(_In_ PUSB_CONFIGURATION_DESCRIPTOR Config, _In_ PVOID Position, _In_ LONG Number, _In_ LONG Alternate, _In_ LONG Class, _In_ LONG SubClass, _In_ LONG Protocol, _Out_opt_ PBOOLEAN HasAlternates)
Definition: desccheck.cpp:3371
#define DESC_PROTOCOL_UAS
Definition: devdesc.cpp:28
#define DESC_SUBCLASS_SCSI
Definition: devdesc.cpp:27
_In_ UCXUSBDEVICE _In_ ULONG Interface
Definition: ucxusbdevice.h:428
#define USB_DEVICE_CLASS_STORAGE
Definition: usb100.h:98
#define USB_DEVICE_CLASS_HUB
Definition: usb100.h:99
@ UsbSuperSpeed
Definition: usb200.h:45
@ UsbHighSpeed
Definition: usb200.h:44
enum _USB_DEVICE_SPEED USB_DEVICE_SPEED

Referenced by DeviceMachine::ConfigDescriptorValid().

◆ HubPublishDualRolePartner()

HubPublishDualRolePartner ( Child->  m_Port,
TRUE  ,
Child->  m_DualRolePartnerFeatures 
)

◆ HubReleaseTransferState()

VOID NTAPI HubReleaseTransferState ( _In_ HubChild *  Child)

Frees the buffers only the transfer module owns. Call when the device object is destroyed.

Definition at line 973 of file devdesc.cpp.

975{
977
978 if (Child->m_SublinkSpeedAttr != NULL)
979 {
980 ExFreePoolWithTag(Child->m_SublinkSpeedAttr, HUB_TAG_DEVICE);
981 Child->m_SublinkSpeedAttr = NULL;
982 Child->m_SublinkSpeedAttrCount = 0;
983 }
984
985 if (Child->m_MsOsExtConfig != NULL)
986 {
987 ExFreePoolWithTag(Child->m_MsOsExtConfig, HUB_TAG_DEVICE);
988 Child->m_MsOsExtConfig = NULL;
989 }
990}

◆ HubSetSqmFlag()

static VOID NTAPI HubSetSqmFlag ( _In_ HubChild *  Child,
_In_ ChildSqm  Flag 
)
static

Definition at line 53 of file devdesc.cpp.

56{
57 InterlockedOr(&Child->m_SqmFlags, (LONG)Flag);
58}
#define InterlockedOr
Definition: interlocked.h:239
long LONG
Definition: pedump.c:60
Definition: xml2sdb.h:103

Referenced by DeviceMachine::BosValid(), and DeviceMachine::ConfigDescriptorValid().

Variable Documentation

◆ Attached

◆ Child

HubQueryLocalDualRoleFeatures& Child

Definition at line 459 of file devdesc.cpp.

Referenced by HubDeviceDescContext().

◆ Features

Initial value:
{
DPRINT("Port %p dual role partner %u features 0x%lx\n", Port, Attached, Features)
_In_ BOOLEAN Attached
Definition: devdesc.cpp:443
_In_ BOOLEAN _In_ ULONG Features
Definition: devdesc.cpp:445
CPPORT Port[4]
Definition: headless.c:38

Definition at line 444 of file devdesc.cpp.

Referenced by CheckCDType(), DetermineCpuFeatures(), DumpVirtIOFeatures(), PataExecutePacketCommand(), DeviceMachine::SendUsbFeatures(), SvwSataLoadTaskFile(), and test_user_shared_data().

◆ m_DualRolePartnerFeatures

Child m_DualRolePartnerFeatures = Features->Features

Definition at line 460 of file devdesc.cpp.

◆ m_DualRoleRequestCode

Child m_DualRoleRequestCode = Features->VendorCommand

Definition at line 458 of file devdesc.cpp.