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

Go to the source code of this file.

Macros

#define NDEBUG
 
#define HUB_MAILBOX_READ_TYPE   0xC0
 
#define HUB_MAILBOX_WRITE_TYPE   0x40
 
#define HUB_MAILBOX_READ_REQUEST   0x40
 
#define HUB_MAILBOX_WRITE_REQUEST   0x41
 
#define HUB_MAILBOX_SPACE   0x0400
 
#define HUB_VERIFIER_CONTROL_FAILURE   0x00000002
 
#define DROM_VERSION_OFFSET   13
 
#define DROM_LENGTH_OFFSET   14
 
#define DROM_LENGTH_MASK   0x0FFF
 
#define DROM_FIRST_ENTRY   22
 
#define DROM_ENTRY_HEADER   2
 
#define DROM_ENTRY_ADAPTER   0x80
 
#define DROM_ENTRY_TYPE_MASK   0x3F
 
#define DROM_ENTRY_TYPE_IDENTITY   9
 
#define DROM_IDENTITY_VENDOR   4
 
#define DROM_IDENTITY_PRODUCT   6
 
#define DROM_IDENTITY_BCD   8
 
#define DROM_IDENTITY_REVISION   14
 
#define DROM_IDENTITY_LENGTH   15
 

Functions

static VOID NTAPI HubMailboxComplete (_In_ WDFREQUEST Request, _In_ WDFIOTARGET Target, _In_ PWDF_REQUEST_COMPLETION_PARAMS Params, _In_ WDFCONTEXT Context)
 
static VOID NTAPI HubMailboxTransfer (_In_ HubFdo *Hub, _In_ BOOLEAN Write, _In_ USHORT Register)
 
static USHORT NTAPI HubDromReadUshort (_In_reads_bytes_(2) const UCHAR *Bytes)
 
 _IRQL_requires_ (PASSIVE_LEVEL) VOID NTAPI HubDromReportFirmwareUpdateDevice(_In_ HubFdo *Hub)
 The firmware update child is not supported, so the IDs it would report are only printed.
 

Variables

static EVT_WDF_REQUEST_COMPLETION_ROUTINE HubMailboxComplete
 

Macro Definition Documentation

◆ DROM_ENTRY_ADAPTER

#define DROM_ENTRY_ADAPTER   0x80

Definition at line 29 of file hubdrom.cpp.

◆ DROM_ENTRY_HEADER

#define DROM_ENTRY_HEADER   2

Definition at line 28 of file hubdrom.cpp.

◆ DROM_ENTRY_TYPE_IDENTITY

#define DROM_ENTRY_TYPE_IDENTITY   9

Definition at line 31 of file hubdrom.cpp.

◆ DROM_ENTRY_TYPE_MASK

#define DROM_ENTRY_TYPE_MASK   0x3F

Definition at line 30 of file hubdrom.cpp.

◆ DROM_FIRST_ENTRY

#define DROM_FIRST_ENTRY   22

Definition at line 27 of file hubdrom.cpp.

◆ DROM_IDENTITY_BCD

#define DROM_IDENTITY_BCD   8

Definition at line 36 of file hubdrom.cpp.

◆ DROM_IDENTITY_LENGTH

#define DROM_IDENTITY_LENGTH   15

Definition at line 38 of file hubdrom.cpp.

◆ DROM_IDENTITY_PRODUCT

#define DROM_IDENTITY_PRODUCT   6

Definition at line 35 of file hubdrom.cpp.

◆ DROM_IDENTITY_REVISION

#define DROM_IDENTITY_REVISION   14

Definition at line 37 of file hubdrom.cpp.

◆ DROM_IDENTITY_VENDOR

#define DROM_IDENTITY_VENDOR   4

Definition at line 34 of file hubdrom.cpp.

◆ DROM_LENGTH_MASK

#define DROM_LENGTH_MASK   0x0FFF

Definition at line 26 of file hubdrom.cpp.

◆ DROM_LENGTH_OFFSET

#define DROM_LENGTH_OFFSET   14

Definition at line 25 of file hubdrom.cpp.

◆ DROM_VERSION_OFFSET

#define DROM_VERSION_OFFSET   13

Definition at line 24 of file hubdrom.cpp.

◆ HUB_MAILBOX_READ_REQUEST

#define HUB_MAILBOX_READ_REQUEST   0x40

Definition at line 16 of file hubdrom.cpp.

◆ HUB_MAILBOX_READ_TYPE

#define HUB_MAILBOX_READ_TYPE   0xC0

Definition at line 14 of file hubdrom.cpp.

◆ HUB_MAILBOX_SPACE

#define HUB_MAILBOX_SPACE   0x0400

Definition at line 18 of file hubdrom.cpp.

◆ HUB_MAILBOX_WRITE_REQUEST

#define HUB_MAILBOX_WRITE_REQUEST   0x41

Definition at line 17 of file hubdrom.cpp.

◆ HUB_MAILBOX_WRITE_TYPE

#define HUB_MAILBOX_WRITE_TYPE   0x40

Definition at line 15 of file hubdrom.cpp.

◆ HUB_VERIFIER_CONTROL_FAILURE

#define HUB_VERIFIER_CONTROL_FAILURE   0x00000002

Definition at line 21 of file hubdrom.cpp.

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file hubdrom.cpp.

Function Documentation

◆ _IRQL_requires_()

_IRQL_requires_ ( PASSIVE_LEVEL  )

The firmware update child is not supported, so the IDs it would report are only printed.

Sends a synchronous IOCTL to the specified device object.

Definition at line 256 of file hubdrom.cpp.

261{
263
264 if (!Identity->Known || Hub->IsRootHub() || Hub->m_FwUpdateProtocol == 0)
265 return;
266
267 DPRINT1("Hub %p firmware update device USB\\VID_%04X&PID_%04X&BCD_%04X&REV_%04X&GFU is not supported\n",
268 Hub, Identity->VendorId, Identity->ProductId, Identity->BcdDevice, Identity->Revision);
269}
#define DPRINT1
Definition: precomp.h:8
HubFdo * Hub
Definition: bootdev.cpp:261
ULONG m_FwUpdateProtocol
Definition: fdo.h:453
BOOLEAN IsRootHub() const
Definition: fdo.h:174
HubRouterIdentity m_RouterIdentity
Definition: fdo.h:461
static GLfloat Identity[16]
Definition: matrix.c:127

◆ HubDromReadUshort()

static USHORT NTAPI HubDromReadUshort ( _In_reads_bytes_(2) const UCHAR *  Bytes)
static

Definition at line 106 of file hubdrom.cpp.

108{
109 return (USHORT)(Bytes[0] | (Bytes[1] << 8));
110}
_In_ UINT Bytes
Definition: mmcopy.h:9
unsigned short USHORT
Definition: pedump.c:61

Referenced by HubMachine::DromDataLength(), and HubMachine::ParseDromIdentity().

◆ HubMailboxComplete()

static VOID NTAPI HubMailboxComplete ( _In_ WDFREQUEST  Request,
_In_ WDFIOTARGET  Target,
_In_ PWDF_REQUEST_COMPLETION_PARAMS  Params,
_In_ WDFCONTEXT  Context 
)
static

Definition at line 45 of file hubdrom.cpp.

50{
52 NTSTATUS Status = Params->IoStatus.Status;
53
56
58
59 if (!NT_SUCCESS(Status))
60 {
61 DPRINT1("Hub %p mailbox register %u access failed 0x%lx, URB status 0x%lx\n",
62 Hub, Hub->m_Control.Urb.SetupPacket[4], Status, Hub->m_Control.Urb.Hdr.Status);
63
65 return;
66 }
67
69}
LONG NTSTATUS
Definition: precomp.h:26
Definition: fdo.h:132
VOID Post(_In_ HubEvent Event)
Definition: fdo.h:194
HubControlRequest m_Control
Definition: fdo.h:413
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:24
@ TransferFailed
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
struct _URB_CONTROL_TRANSFER_EX Urb
Definition: hubreq.h:21
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFREQUEST Request
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:308

◆ HubMailboxTransfer()

static VOID NTAPI HubMailboxTransfer ( _In_ HubFdo *  Hub,
_In_ BOOLEAN  Write,
_In_ USHORT  Register 
)
static

Definition at line 75 of file hubdrom.cpp.

79{
81
86 sizeof(Hub->m_DromMailbox));
87
89 Hub->UsbDevice(),
91 Hub,
93 sizeof(Hub->m_DromMailbox),
94 FALSE,
96 if (!NT_SUCCESS(Status))
97 {
98 DPRINT1("Hub %p mailbox register %u %s not sent 0x%lx\n", Hub, Register, Write ? "write" : "read", Status);
100 }
101}
WDFIOTARGET m_RootHubTarget
Definition: fdo.h:368
UCXUSBDEVICE UsbDevice() const
Definition: fdo.h:180
BOOLEAN NeedsForwardProgress() const
Definition: fdo.h:208
ULONG m_DromMailbox
Definition: fdo.h:460
#define FALSE
Definition: types.h:117
static EVT_WDF_REQUEST_COMPLETION_ROUTINE HubMailboxComplete
Definition: hubdrom.cpp:40
#define HUB_MAILBOX_READ_REQUEST
Definition: hubdrom.cpp:16
#define HUB_MAILBOX_READ_TYPE
Definition: hubdrom.cpp:14
#define HUB_MAILBOX_WRITE_TYPE
Definition: hubdrom.cpp:15
#define HUB_MAILBOX_WRITE_REQUEST
Definition: hubdrom.cpp:17
#define HUB_MAILBOX_SPACE
Definition: hubdrom.cpp:18
Config Register
Definition: hubwmi.cpp:126
NTSTATUS Send(_In_ WDFIOTARGET Target, _In_opt_ UCXUSBDEVICE Device, _In_ PFN_WDF_REQUEST_COMPLETION_ROUTINE Completion, _In_ WDFCONTEXT Context, _In_reads_bytes_opt_(Length) PVOID Buffer, _In_ ULONG Length, _In_ BOOLEAN ShortTransferOk, _In_ BOOLEAN ForwardProgress)
Definition: hubreq.cpp:62
VOID SetSetup(_In_ UCHAR RequestType, _In_ UCHAR RequestCode, _In_ USHORT Value, _In_ USHORT Index, _In_ USHORT Length)
Definition: hubreq.h:34
static BOOL Write(PBYTE Address, PBYTE Data, SIZE_T Size)
Definition: vmhorizon.c:15

Referenced by HubMachine::ReadDromRegister(), and HubMachine::WriteDromRegister().

Variable Documentation

◆ HubMailboxComplete

EVT_WDF_REQUEST_COMPLETION_ROUTINE HubMailboxComplete
static

Definition at line 40 of file hubdrom.cpp.

Referenced by HubMailboxTransfer().