ReactOS 0.4.15-dev-7931-gfd331f1
wmi.c File Reference
#include "miniport.h"
#include "BusLogic958.h"
#include "wmistr.h"
#include "BT958dt.h"
Include dependency graph for wmi.c:

Go to the source code of this file.

Macros

#define BT958Wmi_MofResourceName   L"MofResource"
 
#define BT958_SETUP_GUID_INDEX   0
 
#define BT958GuidCount   (sizeof(BT958GuidList) / sizeof(SCSIWMIGUIDREGINFO))
 

Functions

UCHAR BT958ReadExtendedSetupInfo (IN PHW_DEVICE_EXTENSION HwDeviceExtension, OUT PUCHAR Buffer)
 
BOOLEAN BT958QueryWmiDataBlock (IN PVOID Context, IN PSCSIWMI_REQUEST_CONTEXT RequestContext, IN ULONG GuidIndex, IN ULONG InstanceIndex, IN ULONG InstanceCount, IN OUT PULONG InstanceLengthArray, IN ULONG OutBufferSize, OUT PUCHAR Buffer)
 
UCHAR BT958QueryWmiRegInfo (IN PVOID Context, IN PSCSIWMI_REQUEST_CONTEXT RequestContext, OUT PWCHAR *MofResourceName)
 
void BT958WmiInitialize (IN PHW_DEVICE_EXTENSION HwDeviceExtension)
 
BOOLEAN BT958WmiSrb (IN PHW_DEVICE_EXTENSION HwDeviceExtension, IN OUT PSCSI_WMI_REQUEST_BLOCK Srb)
 

Variables

GUID BT958WmiExtendedSetupInfoGuid = BT958Wmi_ExtendedSetupInfo_Guid
 
SCSIWMIGUIDREGINFO BT958GuidList []
 

Macro Definition Documentation

◆ BT958_SETUP_GUID_INDEX

#define BT958_SETUP_GUID_INDEX   0

Definition at line 9 of file wmi.c.

◆ BT958GuidCount

#define BT958GuidCount   (sizeof(BT958GuidList) / sizeof(SCSIWMIGUIDREGINFO))

Definition at line 49 of file wmi.c.

◆ BT958Wmi_MofResourceName

#define BT958Wmi_MofResourceName   L"MofResource"

Definition at line 7 of file wmi.c.

Function Documentation

◆ BT958QueryWmiDataBlock()

BOOLEAN BT958QueryWmiDataBlock ( IN PVOID  Context,
IN PSCSIWMI_REQUEST_CONTEXT  RequestContext,
IN ULONG  GuidIndex,
IN ULONG  InstanceIndex,
IN ULONG  InstanceCount,
IN OUT PULONG  InstanceLengthArray,
IN ULONG  OutBufferSize,
OUT PUCHAR  Buffer 
)

Definition at line 163 of file wmi.c.

233{
235 ULONG size = 0;
237
238 //
239 // Only ever registers 1 instance per guid
240 ASSERT((InstanceIndex == 0) &&
241 (InstanceCount == 1));
242
243 switch (GuidIndex)
244 {
246 {
247 size = sizeof(BT958ExtendedSetupInfo)-1;
248 if (OutBufferSize < size)
249 {
250 //
251 // The buffer passed to return the data is too small
252 //
254 break;
255 }
256
257 if ( !BT958ReadExtendedSetupInfo(HwDeviceExtension,
258 Buffer))
259 {
260 ASSERT(FALSE);
261 size = 0;
263 }
264 else
265 {
266 *InstanceLengthArray = size;
268 }
269 break;
270 }
271
272 default:
273 {
275 }
276 }
277
278 ScsiPortWmiPostProcess( RequestContext,
279 status,
280 size);
281
282 return status;
283}
struct _BT958ExtendedSetupInfo BT958ExtendedSetupInfo
struct _HW_DEVICE_EXTENSION * PHW_DEVICE_EXTENSION
Definition: bufpool.h:45
_In_ LPGUID _In_ ULONG InstanceIndex
Definition: classpnp.h:1251
_In_ PIRP _In_ ULONG GuidIndex
Definition: classpnp.h:419
#define FALSE
Definition: types.h:117
#define SRB_STATUS_DATA_OVERRUN
Definition: srb.h:357
#define SRB_STATUS_ERROR
Definition: srb.h:344
#define SRB_STATUS_SUCCESS
Definition: srb.h:341
#define BT958_SETUP_GUID_INDEX
Definition: wmi.c:9
UCHAR BT958ReadExtendedSetupInfo(IN PHW_DEVICE_EXTENSION HwDeviceExtension, OUT PUCHAR Buffer)
Definition: wmi.c:342
GLsizeiptr size
Definition: glext.h:5919
#define ASSERT(a)
Definition: mode.c:44
SCSIPORT_API VOID NTAPI ScsiPortWmiPostProcess(_Inout_ PSCSIWMI_REQUEST_CONTEXT RequestContext, _In_ UCHAR SrbStatus, _In_ ULONG BufferUsed)
Definition: ps.c:97
uint32_t ULONG
Definition: typedefs.h:59
_In_ ULONG OutBufferSize
Definition: wdfwmi.h:87
_In_ ULONG InstanceCount
Definition: iofuncs.h:1323
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by BT958WmiInitialize().

◆ BT958QueryWmiRegInfo()

UCHAR BT958QueryWmiRegInfo ( IN PVOID  Context,
IN PSCSIWMI_REQUEST_CONTEXT  RequestContext,
OUT PWCHAR MofResourceName 
)

Definition at line 286 of file wmi.c.

335{
337 return SRB_STATUS_SUCCESS;
338}
#define BT958Wmi_MofResourceName
Definition: wmi.c:7
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING MofResourceName
Definition: wdfdevice.h:2464

Referenced by BT958WmiInitialize().

◆ BT958ReadExtendedSetupInfo()

UCHAR BT958ReadExtendedSetupInfo ( IN PHW_DEVICE_EXTENSION  HwDeviceExtension,
OUT PUCHAR  Buffer 
)

Definition at line 342 of file wmi.c.

364{
365 UCHAR numberOfBytes = sizeof(BT958ExtendedSetupInfo)-1;
366
367 PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
368 BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
369 BusLogic_ExtendedSetupInformation_T ExtendedSetupInformation;
370 BusLogic_RequestedReplyLength_T RequestedReplyLength = sizeof(ExtendedSetupInformation);
372
373 BusLogic_WmiExtendedSetupInformation_T WmiExtendedSetupInfo;
374 PUCHAR SourceBuf = (PUCHAR) &WmiExtendedSetupInfo;
375
376
377 //
378 // Issue the Inquire Extended Setup Information command. Only genuine
379 // BusLogic Host Adapters and TRUE clones support this command. Adaptec 1542C
380 // series Host Adapters that respond to the Geometry Register I/O port will
381 // fail this command.
382 RequestedReplyLength = sizeof(ExtendedSetupInformation);
383 if (BusLogic_Command(HostAdapter,
385 &RequestedReplyLength,
386 sizeof(RequestedReplyLength),
387 &ExtendedSetupInformation,
388 sizeof(ExtendedSetupInformation))
389 != sizeof(ExtendedSetupInformation))
390 {
391 Result = FALSE;
392 }
393
394 WmiExtendedSetupInfo.BusType = ExtendedSetupInformation.BusType;
395 WmiExtendedSetupInfo.BIOS_Address = ExtendedSetupInformation.BIOS_Address;
396 WmiExtendedSetupInfo.ScatterGatherLimit = ExtendedSetupInformation.ScatterGatherLimit;
397 WmiExtendedSetupInfo.MailboxCount = ExtendedSetupInformation.MailboxCount;
398 WmiExtendedSetupInfo.BaseMailboxAddress = ExtendedSetupInformation.BaseMailboxAddress;
399 WmiExtendedSetupInfo.FastOnEISA = ExtendedSetupInformation.Misc.FastOnEISA;
400 WmiExtendedSetupInfo.LevelSensitiveInterrupt = ExtendedSetupInformation.Misc.LevelSensitiveInterrupt;
401 WmiExtendedSetupInfo.FirmwareRevision[0] = ExtendedSetupInformation.FirmwareRevision[0];
402 WmiExtendedSetupInfo.FirmwareRevision[1] = ExtendedSetupInformation.FirmwareRevision[1];
403 WmiExtendedSetupInfo.FirmwareRevision[2] = ExtendedSetupInformation.FirmwareRevision[2];
404 WmiExtendedSetupInfo.HostWideSCSI = ExtendedSetupInformation.HostWideSCSI;
405 WmiExtendedSetupInfo.HostDifferentialSCSI= ExtendedSetupInformation.HostDifferentialSCSI;
406 WmiExtendedSetupInfo.HostSupportsSCAM = ExtendedSetupInformation.HostSupportsSCAM;
407 WmiExtendedSetupInfo.HostUltraSCSI = ExtendedSetupInformation.HostUltraSCSI;
408 WmiExtendedSetupInfo.HostSmartTermination= ExtendedSetupInformation.HostSmartTermination;
409
410 for (; numberOfBytes; numberOfBytes--)
411 {
412 *Buffer++ = *SourceBuf++;
413 }
414 return TRUE;
415}
int BusLogic_Command(BusLogic_HostAdapter_T *HostAdapter, BusLogic_OperationCode_T OperationCode, void *ParameterData, int ParameterLength, void *ReplyData, int ReplyLength)
Definition: BusLogic958.c:606
@ BusLogic_InquireExtendedSetupInformation
Definition: BusLogic958.h:150
UCHAR BusLogic_RequestedReplyLength_T
Definition: BusLogic958.h:169
unsigned char BOOLEAN
#define TRUE
Definition: types.h:120
struct BusLogic_ExtendedSetupInformation::@1323 Misc
BusLogic_BusAddress_T BaseMailboxAddress
Definition: BusLogic958.h:344
BusLogic_BusAddress_T BaseMailboxAddress
Definition: BusLogic958.h:801
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
unsigned char * PUCHAR
Definition: typedefs.h:53
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by BT958QueryWmiDataBlock().

◆ BT958WmiInitialize()

void BT958WmiInitialize ( IN PHW_DEVICE_EXTENSION  HwDeviceExtension)

Definition at line 52 of file wmi.c.

55{
57
58 WmiLibContext = &HwDeviceExtension->WmiLibContext;
59
60 WmiLibContext->GuidList = BT958GuidList;
61 WmiLibContext->GuidCount = BT958GuidCount;
62 WmiLibContext->QueryWmiRegInfo = BT958QueryWmiRegInfo;
63 WmiLibContext->QueryWmiDataBlock = BT958QueryWmiDataBlock;
64 WmiLibContext->SetWmiDataItem = NULL;
65 WmiLibContext->SetWmiDataBlock = NULL;
66 WmiLibContext->WmiFunctionControl = NULL;
67 WmiLibContext->ExecuteWmiMethod = NULL;
68}
_In_ PVOID WmiLibContext
Definition: batclass.h:377
#define NULL
Definition: types.h:112
UCHAR BT958QueryWmiRegInfo(IN PVOID Context, IN PSCSIWMI_REQUEST_CONTEXT RequestContext, OUT PWCHAR *MofResourceName)
Definition: wmi.c:286
#define BT958GuidCount
Definition: wmi.c:49
SCSIWMIGUIDREGINFO BT958GuidList[]
Definition: wmi.c:41
BOOLEAN BT958QueryWmiDataBlock(IN PVOID Context, IN PSCSIWMI_REQUEST_CONTEXT RequestContext, IN ULONG GuidIndex, IN ULONG InstanceIndex, IN ULONG InstanceCount, IN OUT PULONG InstanceLengthArray, IN ULONG OutBufferSize, OUT PUCHAR Buffer)
Definition: wmi.c:163

◆ BT958WmiSrb()

BOOLEAN BT958WmiSrb ( IN PHW_DEVICE_EXTENSION  HwDeviceExtension,
IN OUT PSCSI_WMI_REQUEST_BLOCK  Srb 
)

Definition at line 73 of file wmi.c.

99{
101 SCSIWMI_REQUEST_CONTEXT requestContext;
102 ULONG retSize;
103 BOOLEAN pending;
104
105 // Validate our assumptions.
108 ASSERT(Srb->DataTransferLength >= sizeof(ULONG));
110
111 // Check if the WMI SRB is targeted for the adapter or one of the disks
112 if (!(Srb->WMIFlags & SRB_WMI_FLAGS_ADAPTER_REQUEST))
113 {
114
115 // This is targeted to one of the disks, since there are no per disk
116 // wmi information we return an error. Note that if there was per
117 // disk information, then you'd likely have a differen WmiLibContext
118 // and a different set of guids.
121
122 }
123 else
124 {
125 // Process the incoming WMI request.
126 pending = ScsiPortWmiDispatchFunction(&HwDeviceExtension->WmiLibContext,
127 Srb->WMISubFunction,
128 HwDeviceExtension,
129 &requestContext,
130 Srb->DataPath,
132 Srb->DataBuffer);
133
134 // We assume that the wmi request will never pend so that we can
135 // allocate the requestContext from stack. If the WMI request could
136 // ever pend then we'd need to allocate the request context from
137 // the SRB extension.
138 //
139 ASSERT(! pending);
140
141 retSize = ScsiPortWmiGetReturnSize(&requestContext);
142 status = ScsiPortWmiGetReturnStatus(&requestContext);
143
144 // We can do this since we assume it is done synchronously
145 Srb->DataTransferLength = retSize;
146
147 //
148 // Adapter ready for next request.
149 //
150
152 }
153
154 ScsiPortNotification(RequestComplete, HwDeviceExtension, Srb);
155 ScsiPortNotification(NextRequest, HwDeviceExtension, NULL);
156
157 return TRUE;
158}
VOID __cdecl ScsiPortNotification(IN SCSI_NOTIFICATION_TYPE NotificationType, IN PVOID HwDeviceExtension, IN ...)
Definition: scsiport.c:1324
_In_ PSCSI_REQUEST_BLOCK Srb
Definition: cdrom.h:989
#define SRB_FUNCTION_WMI
Definition: srb.h:331
#define SRB_WMI_FLAGS_ADAPTER_REQUEST
Definition: srb.h:427
@ RequestComplete
Definition: srb.h:531
@ NextRequest
Definition: srb.h:532
_Must_inspect_result_ SCSIPORT_API BOOLEAN NTAPI ScsiPortWmiDispatchFunction(_In_ PSCSI_WMILIB_CONTEXT WmiLibInfo, _In_ UCHAR MinorFunction, _In_ PVOID DeviceContext, _In_ PSCSIWMI_REQUEST_CONTEXT RequestContext, _In_ PVOID DataPath, _In_ ULONG BufferSize, _In_ PVOID Buffer)
#define ScsiPortWmiGetReturnSize(RequestContext)
Definition: scsiwmi.h:182
#define ScsiPortWmiGetReturnStatus(RequestContext)
Definition: scsiwmi.h:189
PVOID DataBuffer
Definition: srb.h:263
UCHAR Function
Definition: srb.h:250
ULONG DataTransferLength
Definition: srb.h:261
USHORT Length
Definition: srb.h:249
UCHAR SrbStatus
Definition: srb.h:251

Variable Documentation

◆ BT958GuidList

SCSIWMIGUIDREGINFO BT958GuidList[]
Initial value:
=
{
1,
0
},
}
GUID BT958WmiExtendedSetupInfoGuid
Definition: wmi.c:11

Definition at line 41 of file wmi.c.

Referenced by BT958WmiInitialize().

◆ BT958WmiExtendedSetupInfoGuid

GUID BT958WmiExtendedSetupInfoGuid = BT958Wmi_ExtendedSetupInfo_Guid

Definition at line 11 of file wmi.c.