mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Import VMware open source BusLogic driver
Hartmut made it work in ReactOS. svn path=/trunk/; revision=17434
This commit is contained in:
parent
20d4ebeffc
commit
a4c7ecd803
19 changed files with 4790 additions and 0 deletions
|
@ -611,6 +611,10 @@ for(;;);
|
|||
if (!LoadDriver(SourcePath, "atapi.sys"))
|
||||
return;
|
||||
|
||||
/* Load buslogic.sys (depends on hardware detection) */
|
||||
if (!LoadDriver(SourcePath, "buslogic.sys"))
|
||||
return;
|
||||
|
||||
/* Load class2.sys */
|
||||
if (!LoadDriver(SourcePath, "class2.sys"))
|
||||
return;
|
||||
|
|
|
@ -376,6 +376,14 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Atapi","Start",0x00010001,0x00000000
|
|||
HKLM,"SYSTEM\CurrentControlSet\Services\Atapi","Type",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Atapi","Tag",0x00010001,0x00000010
|
||||
|
||||
; BusLogic 958 miniport driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\BusLogic","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\BusLogic","Group",0x00000000,"SCSI Miniport"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\BusLogic","ImagePath",0x00020000,"system32\drivers\buslogic.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\BusLogic","Start",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\BusLogic","Type",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\BusLogic","Tag",0x00010001,0x00000020
|
||||
|
||||
; ACPI driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\ACPI","ErrorControl",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\ACPI","Group",0x00000000,"Boot Bus Extender"
|
||||
|
|
|
@ -14,6 +14,7 @@ Signature = "$ReactOS$"
|
|||
[SourceFiles]
|
||||
; <filename> = <directory_id>
|
||||
atapi.sys = 3
|
||||
buslogic.sys = 3
|
||||
blue.sys = 3
|
||||
c_437.nls = 2
|
||||
c_1252.nls = 2
|
||||
|
|
BIN
reactos/drivers/storage/buslogic/BT958.bmf
Normal file
BIN
reactos/drivers/storage/buslogic/BT958.bmf
Normal file
Binary file not shown.
30
reactos/drivers/storage/buslogic/BT958.mof
Normal file
30
reactos/drivers/storage/buslogic/BT958.mof
Normal file
|
@ -0,0 +1,30 @@
|
|||
[
|
||||
Dynamic, Provider("WMIProv"),
|
||||
WMI,
|
||||
Description ("BT958 Extended Setup Information (Operation Code 8Dh)"),
|
||||
guid ("{CBD60D59-CE49-4cf4-AB7A-DEC6F4988D1A}"),
|
||||
HeaderName("BT958ExtendedSetupInfo"),
|
||||
GuidName1("BT958Wmi_ExtendedSetupInfo_Guid"),
|
||||
WmiExpense(0)
|
||||
]
|
||||
class BT958ExtendedSetupInfoGuid
|
||||
{
|
||||
[read,key] String InstanceName;
|
||||
[read] boolean Active;
|
||||
|
||||
[read, WmiDataId(1), WmiVersion(1)] uint8 BusType;
|
||||
[read, WmiDataId(2), WmiVersion(1)] uint8 BIOS_Address;
|
||||
[read, WmiDataId(3), WmiVersion(1)] uint16 ScatterGatherLimit;
|
||||
[read, WmiDataId(4), WmiVersion(1)] uint8 MailboxCount;
|
||||
[read, WmiDataId(5), WmiVersion(1)] uint32 BaseMailboxAddress;
|
||||
[read, WmiDataId(6), WmiVersion(1)] boolean FastOnEISA:1;
|
||||
[read, WmiDataId(7), WmiVersion(1)] boolean LevelSensitiveInterrupt:1;
|
||||
[read, WmiDataId(8), WmiVersion(1), max(3)] uint8 FirmwareRevision[];
|
||||
[read, WmiDataId(9), WmiVersion(1)] boolean HostWideSCSI:1;
|
||||
[read, WmiDataId(10), WmiVersion(1)] boolean HostDifferentialSCSI:1;
|
||||
[read, WmiDataId(11), WmiVersion(1)] boolean HostSupportsSCAM:1;
|
||||
[read, WmiDataId(12), WmiVersion(1)] boolean HostUltraSCSI:1;
|
||||
[read, WmiDataId(13), WmiVersion(1)] boolean HostSmartTermination:1;
|
||||
};
|
||||
|
||||
|
105
reactos/drivers/storage/buslogic/BT958dt.h
Normal file
105
reactos/drivers/storage/buslogic/BT958dt.h
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* vmscsi-- Miniport driver for the Buslogic BT 958 SCSI Controller
|
||||
* under Windows 2000/XP/Server 2003
|
||||
*
|
||||
* Based in parts on the buslogic driver for the same device
|
||||
* available with the GNU Linux Operating System.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _BT958dt_h_
|
||||
#define _BT958dt_h_
|
||||
|
||||
// BT958ExtendedSetupInfoGuid - BT958ExtendedSetupInfo
|
||||
// BT958 Extended Setup Information (Operation Code 8Dh)
|
||||
#define BT958Wmi_ExtendedSetupInfo_Guid \
|
||||
{ 0xcbd60d59,0xce49,0x4cf4, { 0xab,0x7a,0xde,0xc6,0xf4,0x98,0x8d,0x1a } }
|
||||
|
||||
DEFINE_GUID(BT958ExtendedSetupInfoGuid_GUID, \
|
||||
0xcbd60d59,0xce49,0x4cf4,0xab,0x7a,0xde,0xc6,0xf4,0x98,0x8d,0x1a);
|
||||
|
||||
|
||||
typedef struct _BT958ExtendedSetupInfo
|
||||
{
|
||||
//
|
||||
UCHAR BusType;
|
||||
#define BT958ExtendedSetupInfo_BusType_SIZE sizeof(UCHAR)
|
||||
#define BT958ExtendedSetupInfo_BusType_ID 1
|
||||
|
||||
//
|
||||
UCHAR BIOS_Address;
|
||||
#define BT958ExtendedSetupInfo_BIOS_Address_SIZE sizeof(UCHAR)
|
||||
#define BT958ExtendedSetupInfo_BIOS_Address_ID 2
|
||||
|
||||
//
|
||||
USHORT ScatterGatherLimit;
|
||||
#define BT958ExtendedSetupInfo_ScatterGatherLimit_SIZE sizeof(USHORT)
|
||||
#define BT958ExtendedSetupInfo_ScatterGatherLimit_ID 3
|
||||
|
||||
//
|
||||
UCHAR MailboxCount;
|
||||
#define BT958ExtendedSetupInfo_MailboxCount_SIZE sizeof(UCHAR)
|
||||
#define BT958ExtendedSetupInfo_MailboxCount_ID 4
|
||||
|
||||
//
|
||||
ULONG BaseMailboxAddress;
|
||||
#define BT958ExtendedSetupInfo_BaseMailboxAddress_SIZE sizeof(ULONG)
|
||||
#define BT958ExtendedSetupInfo_BaseMailboxAddress_ID 5
|
||||
|
||||
//
|
||||
BOOLEAN FastOnEISA;
|
||||
#define BT958ExtendedSetupInfo_FastOnEISA_SIZE sizeof(BOOLEAN)
|
||||
#define BT958ExtendedSetupInfo_FastOnEISA_ID 6
|
||||
|
||||
//
|
||||
BOOLEAN LevelSensitiveInterrupt;
|
||||
#define BT958ExtendedSetupInfo_LevelSensitiveInterrupt_SIZE sizeof(BOOLEAN)
|
||||
#define BT958ExtendedSetupInfo_LevelSensitiveInterrupt_ID 7
|
||||
|
||||
//
|
||||
UCHAR FirmwareRevision[3];
|
||||
#define BT958ExtendedSetupInfo_FirmwareRevision_SIZE sizeof(UCHAR[3])
|
||||
#define BT958ExtendedSetupInfo_FirmwareRevision_ID 8
|
||||
|
||||
//
|
||||
BOOLEAN HostWideSCSI;
|
||||
#define BT958ExtendedSetupInfo_HostWideSCSI_SIZE sizeof(BOOLEAN)
|
||||
#define BT958ExtendedSetupInfo_HostWideSCSI_ID 9
|
||||
|
||||
//
|
||||
BOOLEAN HostDifferentialSCSI;
|
||||
#define BT958ExtendedSetupInfo_HostDifferentialSCSI_SIZE sizeof(BOOLEAN)
|
||||
#define BT958ExtendedSetupInfo_HostDifferentialSCSI_ID 10
|
||||
|
||||
//
|
||||
BOOLEAN HostSupportsSCAM;
|
||||
#define BT958ExtendedSetupInfo_HostSupportsSCAM_SIZE sizeof(BOOLEAN)
|
||||
#define BT958ExtendedSetupInfo_HostSupportsSCAM_ID 11
|
||||
|
||||
//
|
||||
BOOLEAN HostUltraSCSI;
|
||||
#define BT958ExtendedSetupInfo_HostUltraSCSI_SIZE sizeof(BOOLEAN)
|
||||
#define BT958ExtendedSetupInfo_HostUltraSCSI_ID 12
|
||||
|
||||
//
|
||||
BOOLEAN HostSmartTermination;
|
||||
#define BT958ExtendedSetupInfo_HostSmartTermination_SIZE sizeof(BOOLEAN)
|
||||
#define BT958ExtendedSetupInfo_HostSmartTermination_ID 13
|
||||
|
||||
} BT958ExtendedSetupInfo, *PBT958ExtendedSetupInfo;
|
||||
|
||||
#endif
|
2754
reactos/drivers/storage/buslogic/BusLogic958.c
Normal file
2754
reactos/drivers/storage/buslogic/BusLogic958.c
Normal file
File diff suppressed because it is too large
Load diff
1179
reactos/drivers/storage/buslogic/BusLogic958.h
Normal file
1179
reactos/drivers/storage/buslogic/BusLogic958.h
Normal file
File diff suppressed because it is too large
Load diff
116
reactos/drivers/storage/buslogic/BusLogic958.rc
Normal file
116
reactos/drivers/storage/buslogic/BusLogic958.rc
Normal file
|
@ -0,0 +1,116 @@
|
|||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,2,0,0
|
||||
PRODUCTVERSION 1,2,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x3L
|
||||
FILESUBTYPE 0x7L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "\0"
|
||||
VALUE "CompanyName", "VMware, Inc.\0"
|
||||
VALUE "FileDescription", "VMware SCSI Controller\0"
|
||||
VALUE "FileVersion", "1, 2, 0, 0\0"
|
||||
VALUE "InternalName", "vmscsi.sys\0"
|
||||
VALUE "LegalCopyright", "Copyright © 1998-2003 VMware, Inc.\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "vmscsi.sys\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "VMware, Inc. Script1 Application\0"
|
||||
VALUE "ProductVersion", "1, 2, 0, 0\0"
|
||||
VALUE "SpecialBuild", "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// MOFDATA
|
||||
//
|
||||
|
||||
MOFRESOURCE MOFDATA MOVEABLE PURE "BT958.bmf"
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
104
reactos/drivers/storage/buslogic/Log.c
Normal file
104
reactos/drivers/storage/buslogic/Log.c
Normal file
|
@ -0,0 +1,104 @@
|
|||
#include "Log.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#pragma hdrstop
|
||||
|
||||
BOOLEAN LogMessage(PCHAR szFormat, ...)
|
||||
{
|
||||
ULONG Length;
|
||||
char messagebuf[256];
|
||||
va_list va;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
OBJECT_ATTRIBUTES objectAttributes;
|
||||
NTSTATUS status;
|
||||
HANDLE FileHandle;
|
||||
UNICODE_STRING fileName;
|
||||
|
||||
|
||||
//format the string
|
||||
va_start(va,szFormat);
|
||||
vsprintf(messagebuf,szFormat,va);
|
||||
va_end(va);
|
||||
|
||||
//get a handle to the log file object
|
||||
fileName.Buffer = NULL;
|
||||
fileName.Length = 0;
|
||||
fileName.MaximumLength = sizeof(DEFAULT_LOG_FILE_NAME) + sizeof(UNICODE_NULL);
|
||||
fileName.Buffer = ExAllocatePool(PagedPool,
|
||||
fileName.MaximumLength);
|
||||
if (!fileName.Buffer)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
RtlZeroMemory(fileName.Buffer, fileName.MaximumLength);
|
||||
status = RtlAppendUnicodeToString(&fileName, (PWSTR)DEFAULT_LOG_FILE_NAME);
|
||||
|
||||
//DbgPrint("\n Initializing Object attributes");
|
||||
|
||||
InitializeObjectAttributes (&objectAttributes,
|
||||
(PUNICODE_STRING)&fileName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL );
|
||||
|
||||
DbgPrint("\n BusLogic - Creating the file");
|
||||
|
||||
status = ZwCreateFile(&FileHandle,
|
||||
FILE_APPEND_DATA,
|
||||
&objectAttributes,
|
||||
&IoStatus,
|
||||
0,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
FILE_SHARE_WRITE,
|
||||
FILE_OPEN_IF,
|
||||
FILE_SYNCHRONOUS_IO_NONALERT,
|
||||
NULL,
|
||||
0 );
|
||||
|
||||
if(NT_SUCCESS(status))
|
||||
{
|
||||
CHAR buf[300];
|
||||
LARGE_INTEGER time;
|
||||
KeQuerySystemTime(&time);
|
||||
|
||||
DbgPrint("\n BusLogic - Created the file");
|
||||
|
||||
//put a time stamp on the output message
|
||||
sprintf(buf,"%10u-%10u %s",time.HighPart,time.LowPart,messagebuf);
|
||||
|
||||
//format the string to make sure it appends a newline carrage-return to the
|
||||
//end of the string.
|
||||
Length=strlen(buf);
|
||||
if(buf[Length-1]=='\n')
|
||||
{
|
||||
buf[Length-1]='\r';
|
||||
strcat(buf,"\n");
|
||||
Length++;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(buf,"\r\n");
|
||||
Length+=2;
|
||||
}
|
||||
|
||||
buf[Length+1] = '\0';
|
||||
DbgPrint("\n BusLogic - Writing to the file");
|
||||
DbgPrint("\n BusLogic - Buf = %s", buf);
|
||||
|
||||
status = ZwWriteFile(FileHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&IoStatus,
|
||||
buf,
|
||||
Length,
|
||||
NULL,
|
||||
NULL );
|
||||
|
||||
ZwClose(FileHandle);
|
||||
}
|
||||
if (fileName.Buffer)
|
||||
ExFreePool (fileName.Buffer);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
5
reactos/drivers/storage/buslogic/Log.h
Normal file
5
reactos/drivers/storage/buslogic/Log.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "ntddk.h"
|
||||
|
||||
#define DEFAULT_LOG_FILE_NAME L"\\??\\D:\\Temp\\BL958.log"
|
||||
|
||||
BOOLEAN LogMessage(PCHAR szFormat, ...);
|
11
reactos/drivers/storage/buslogic/README.ReactOS
Normal file
11
reactos/drivers/storage/buslogic/README.ReactOS
Normal file
|
@ -0,0 +1,11 @@
|
|||
This code was published by VMware on their website at
|
||||
http://www.vmware.com/download/open_sources.html. The intro there says:
|
||||
|
||||
This open source software is licensed under the terms of various open source
|
||||
license agreements included with the materials relating to the open source
|
||||
software. Copyrights in the open source software are held by the copyright
|
||||
holders indicated in the copyright notices in the open source files. You may
|
||||
download this software free of charge.
|
||||
|
||||
The source files indicate they are GPL licenced, so we're ok to include it
|
||||
in ReactOS.
|
10
reactos/drivers/storage/buslogic/buslogic.xml
Normal file
10
reactos/drivers/storage/buslogic/buslogic.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<module name="buslogic" type="kernelmodedriver" installbase="system32/drivers" installname="buslogic.sys">
|
||||
<bootstrap base="reactos" />
|
||||
<define name="__USE_W32API" />
|
||||
<include base="buslogic">.</include>
|
||||
<library>ntoskrnl</library>
|
||||
<library>hal</library>
|
||||
<library>scsiport</library>
|
||||
<file>BusLogic958.c</file>
|
||||
<file>BusLogic958.rc</file>
|
||||
</module>
|
5
reactos/drivers/storage/buslogic/makefile.inc
Normal file
5
reactos/drivers/storage/buslogic/makefile.inc
Normal file
|
@ -0,0 +1,5 @@
|
|||
clean:
|
||||
del BT958dt.h BT958.bmf
|
||||
|
||||
BT958dt.h: BT958.bmf
|
||||
wmimofck -hBT958dt.h BT958.bmf
|
7
reactos/drivers/storage/buslogic/makefile.original
Normal file
7
reactos/drivers/storage/buslogic/makefile.original
Normal file
|
@ -0,0 +1,7 @@
|
|||
#
|
||||
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
|
||||
# file to this component. This file merely indirects to the real make file
|
||||
# that is shared by all the driver components of the Windows NT DDK
|
||||
#
|
||||
|
||||
!INCLUDE $(NTMAKEENV)\makefile.def
|
15
reactos/drivers/storage/buslogic/resource.h
Normal file
15
reactos/drivers/storage/buslogic/resource.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by BusLogic958.rc
|
||||
//
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
17
reactos/drivers/storage/buslogic/sources
Normal file
17
reactos/drivers/storage/buslogic/sources
Normal file
|
@ -0,0 +1,17 @@
|
|||
TARGETNAME=vmscsi
|
||||
TARGETPATH=obj
|
||||
TARGETTYPE=MINIPORT
|
||||
|
||||
TARGETLIBS=$(DDK_LIB_PATH)\scsiport.lib \
|
||||
$(DDK_LIB_PATH)\scsiwmi.lib \
|
||||
$(SDK_LIB_PATH)\ntoskrnl.lib
|
||||
|
||||
MSC_WARNING_LEVEL=/W3 /WX
|
||||
|
||||
SOURCES=BT958.mof \
|
||||
BusLogic958.c \
|
||||
BusLogic958.rc \
|
||||
wmi.c \
|
||||
Log.c
|
||||
|
||||
NTTARGETFILE0=BT958dt.h
|
416
reactos/drivers/storage/buslogic/wmi.c
Normal file
416
reactos/drivers/storage/buslogic/wmi.c
Normal file
|
@ -0,0 +1,416 @@
|
|||
#include "miniport.h"
|
||||
#include "BusLogic958.h" // includes scsi.h
|
||||
#include "wmistr.h" // WMI definitions
|
||||
|
||||
#include "BT958dt.h"
|
||||
|
||||
#define BT958Wmi_MofResourceName L"MofResource"
|
||||
|
||||
#define BT958_SETUP_GUID_INDEX 0
|
||||
|
||||
GUID BT958WmiExtendedSetupInfoGuid = BT958Wmi_ExtendedSetupInfo_Guid;
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
SCSIWMIGUIDREGINFO BT958GuidList[] =
|
||||
{
|
||||
{&BT958WmiExtendedSetupInfoGuid,
|
||||
1,
|
||||
0
|
||||
},
|
||||
};
|
||||
|
||||
#define BT958GuidCount (sizeof(BT958GuidList) / sizeof(SCSIWMIGUIDREGINFO))
|
||||
|
||||
|
||||
void BT958WmiInitialize(
|
||||
IN PHW_DEVICE_EXTENSION HwDeviceExtension
|
||||
)
|
||||
{
|
||||
PSCSI_WMILIB_CONTEXT WmiLibContext;
|
||||
|
||||
WmiLibContext = &HwDeviceExtension->WmiLibContext;
|
||||
|
||||
WmiLibContext->GuidList = BT958GuidList;
|
||||
WmiLibContext->GuidCount = BT958GuidCount;
|
||||
WmiLibContext->QueryWmiRegInfo = BT958QueryWmiRegInfo;
|
||||
WmiLibContext->QueryWmiDataBlock = BT958QueryWmiDataBlock;
|
||||
WmiLibContext->SetWmiDataItem = NULL;
|
||||
WmiLibContext->SetWmiDataBlock = NULL;
|
||||
WmiLibContext->WmiFunctionControl = NULL;
|
||||
WmiLibContext->ExecuteWmiMethod = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
BT958WmiSrb(
|
||||
IN PHW_DEVICE_EXTENSION HwDeviceExtension,
|
||||
IN OUT PSCSI_WMI_REQUEST_BLOCK Srb
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Process an SRB_FUNCTION_WMI request packet.
|
||||
|
||||
This routine is called from the SCSI port driver synchronized with the
|
||||
kernel via BT958StartIo. On completion of WMI processing, the SCSI
|
||||
port driver is notified that the adapter can take another request, if
|
||||
any are available.
|
||||
|
||||
Arguments:
|
||||
|
||||
HwDeviceExtension - HBA miniport driver's adapter data storage.
|
||||
|
||||
Srb - IO request packet.
|
||||
|
||||
Return Value:
|
||||
|
||||
Value to return to BT958StartIo caller. Always TRUE.
|
||||
|
||||
--*/
|
||||
{
|
||||
UCHAR status;
|
||||
SCSIWMI_REQUEST_CONTEXT requestContext;
|
||||
ULONG retSize;
|
||||
BOOLEAN pending;
|
||||
|
||||
// Validate our assumptions.
|
||||
ASSERT(Srb->Function == SRB_FUNCTION_WMI);
|
||||
ASSERT(Srb->Length == sizeof(SCSI_WMI_REQUEST_BLOCK));
|
||||
ASSERT(Srb->DataTransferLength >= sizeof(ULONG));
|
||||
ASSERT(Srb->DataBuffer);
|
||||
|
||||
// Check if the WMI SRB is targetted for the adapter or one of the disks
|
||||
if (!(Srb->WMIFlags & SRB_WMI_FLAGS_ADAPTER_REQUEST))
|
||||
{
|
||||
|
||||
// This is targetted to one of the disks, since there are no per disk
|
||||
// wmi information we return an error. Note that if there was per
|
||||
// disk information, then you'd likely have a differen WmiLibContext
|
||||
// and a different set of guids.
|
||||
Srb->DataTransferLength = 0;
|
||||
Srb->SrbStatus = SRB_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Process the incoming WMI request.
|
||||
pending = ScsiPortWmiDispatchFunction(&HwDeviceExtension->WmiLibContext,
|
||||
Srb->WMISubFunction,
|
||||
HwDeviceExtension,
|
||||
&requestContext,
|
||||
Srb->DataPath,
|
||||
Srb->DataTransferLength,
|
||||
Srb->DataBuffer);
|
||||
|
||||
// We assune that the wmi request will never pend so that we can
|
||||
// allocate the requestContext from stack. If the WMI request could
|
||||
// ever pend then we'd need to allocate the request context from
|
||||
// the SRB extension.
|
||||
//
|
||||
ASSERT(! pending);
|
||||
|
||||
retSize = ScsiPortWmiGetReturnSize(&requestContext);
|
||||
status = ScsiPortWmiGetReturnStatus(&requestContext);
|
||||
|
||||
// We can do this since we assume it is done synchronously
|
||||
Srb->DataTransferLength = retSize;
|
||||
|
||||
//
|
||||
// Adapter ready for next request.
|
||||
//
|
||||
|
||||
Srb->SrbStatus = status;
|
||||
}
|
||||
|
||||
ScsiPortNotification(RequestComplete, HwDeviceExtension, Srb);
|
||||
ScsiPortNotification(NextRequest, HwDeviceExtension, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine is a callback into the miniport to query for the contents of
|
||||
one or more instances of a data block. This callback may be called with
|
||||
an output buffer that is too small to return all of the data queried.
|
||||
In this case the callback is responsible to report the correct output
|
||||
buffer size needed.
|
||||
|
||||
If the request can be completed immediately without pending,
|
||||
ScsiPortWmiPostProcess should be called from within this callback and
|
||||
FALSE returned.
|
||||
|
||||
If the request cannot be completed within this callback then TRUE should
|
||||
be returned. Once the pending operations are finished the miniport should
|
||||
call ScsiPortWmiPostProcess and then complete the srb.
|
||||
|
||||
Arguments:
|
||||
|
||||
DeviceContext is a caller specified context value originally passed to
|
||||
ScsiPortWmiDispatchFunction.
|
||||
|
||||
RequestContext is a context associated with the srb being processed.
|
||||
|
||||
GuidIndex is the index into the list of guids provided when the
|
||||
miniport registered
|
||||
|
||||
InstanceIndex is the index that denotes first instance of the data block
|
||||
is being queried.
|
||||
|
||||
InstanceCount is the number of instances expected to be returned for
|
||||
the data block.
|
||||
|
||||
InstanceLengthArray is a pointer to an array of ULONG that returns the
|
||||
lengths of each instance of the data block. This may be NULL when
|
||||
there is not enough space in the output buffer to fufill the request.
|
||||
In this case the miniport should call ScsiPortWmiPostProcess with
|
||||
a status of SRB_STATUS_DATA_OVERRUN and the size of the output buffer
|
||||
needed to fufill the request.
|
||||
|
||||
BufferAvail on entry has the maximum size available to write the data
|
||||
blocks in the output buffer. If the output buffer is not large enough
|
||||
to return all of the data blocks then the miniport should call
|
||||
ScsiPortWmiPostProcess with a status of SRB_STATUS_DATA_OVERRUN
|
||||
and the size of the output buffer needed to fufill the request.
|
||||
|
||||
Buffer on return is filled with the returned data blocks. Note that each
|
||||
instance of the data block must be aligned on a 8 byte boundry. This
|
||||
may be NULL when there is not enough space in the output buffer to
|
||||
fufill the request. In this case the miniport should call
|
||||
ScsiPortWmiPostProcess with a status of SRB_STATUS_DATA_OVERRUN and
|
||||
the size of the output buffer needed to fufill the request.
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
TRUE if request is pending else FALSE
|
||||
|
||||
--*/
|
||||
{
|
||||
PHW_DEVICE_EXTENSION HwDeviceExtension = (PHW_DEVICE_EXTENSION)Context;
|
||||
ULONG size;
|
||||
UCHAR status;
|
||||
|
||||
//
|
||||
// Only ever registers 1 instance per guid
|
||||
ASSERT((InstanceIndex == 0) &&
|
||||
(InstanceCount == 1));
|
||||
|
||||
switch (GuidIndex)
|
||||
{
|
||||
case BT958_SETUP_GUID_INDEX:
|
||||
{
|
||||
size = sizeof(BT958ExtendedSetupInfo)-1;
|
||||
if (OutBufferSize < size)
|
||||
{
|
||||
//
|
||||
// The buffer passed to return the data is too small
|
||||
//
|
||||
status = SRB_STATUS_DATA_OVERRUN;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !BT958ReadExtendedSetupInfo(HwDeviceExtension,
|
||||
Buffer))
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
size = 0;
|
||||
status = SRB_STATUS_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
*InstanceLengthArray = size;
|
||||
status = SRB_STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
status = SRB_STATUS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
ScsiPortWmiPostProcess( RequestContext,
|
||||
status,
|
||||
size);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
UCHAR
|
||||
BT958QueryWmiRegInfo(
|
||||
IN PVOID Context,
|
||||
IN PSCSIWMI_REQUEST_CONTEXT RequestContext,
|
||||
OUT PWCHAR *MofResourceName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine is a callback into the driver to retrieve information about
|
||||
the guids being registered.
|
||||
|
||||
Implementations of this routine may be in paged memory
|
||||
|
||||
Arguments:
|
||||
|
||||
DeviceObject is the device whose registration information is needed
|
||||
|
||||
*RegFlags returns with a set of flags that describe all of the guids being
|
||||
registered for this device. If the device wants enable and disable
|
||||
collection callbacks before receiving queries for the registered
|
||||
guids then it should return the WMIREG_FLAG_EXPENSIVE flag. Also the
|
||||
returned flags may specify WMIREG_FLAG_INSTANCE_PDO in which case
|
||||
the instance name is determined from the PDO associated with the
|
||||
device object. Note that the PDO must have an associated devnode. If
|
||||
WMIREG_FLAG_INSTANCE_PDO is not set then Name must return a unique
|
||||
name for the device. These flags are ORed into the flags specified
|
||||
by the GUIDREGINFO for each guid.
|
||||
|
||||
InstanceName returns with the instance name for the guids if
|
||||
WMIREG_FLAG_INSTANCE_PDO is not set in the returned *RegFlags. The
|
||||
caller will call ExFreePool with the buffer returned.
|
||||
|
||||
*RegistryPath returns with the registry path of the driver. This is
|
||||
required
|
||||
|
||||
*MofResourceName returns with the name of the MOF resource attached to
|
||||
the binary file. If the driver does not have a mof resource attached
|
||||
then this can be returned as NULL.
|
||||
|
||||
*Pdo returns with the device object for the PDO associated with this
|
||||
device if the WMIREG_FLAG_INSTANCE_PDO flag is retured in
|
||||
*RegFlags.
|
||||
|
||||
Return Value:
|
||||
|
||||
status
|
||||
|
||||
--*/
|
||||
{
|
||||
*MofResourceName = BT958Wmi_MofResourceName;
|
||||
return SRB_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
UCHAR
|
||||
BT958ReadExtendedSetupInfo(
|
||||
IN PHW_DEVICE_EXTENSION HwDeviceExtension,
|
||||
OUT PUCHAR Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Read the adapter setup information into the supplied buffer. The buffer
|
||||
must be RM_CFG_MAX_SIZE (255) bytes large.
|
||||
|
||||
Arguments:
|
||||
|
||||
HwDeviceExtension - HBA miniport driver's adapter data storage.
|
||||
|
||||
Buffer - Buffer to hold adapter's setup information structure [manual 5-10].
|
||||
|
||||
Return Value:
|
||||
|
||||
TRUE on success, FALSE on failure.
|
||||
|
||||
--*/
|
||||
{
|
||||
UCHAR numberOfBytes = sizeof(BT958ExtendedSetupInfo)-1;
|
||||
|
||||
PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
|
||||
BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
|
||||
BusLogic_ExtendedSetupInformation_T ExtendedSetupInformation;
|
||||
BusLogic_RequestedReplyLength_T RequestedReplyLength = sizeof(ExtendedSetupInformation);
|
||||
BOOLEAN Result = TRUE;
|
||||
|
||||
BusLogic_WmiExtendedSetupInformation_T WmiExtendedSetupInfo;
|
||||
PUCHAR SourceBuf = (PUCHAR) &WmiExtendedSetupInfo;
|
||||
|
||||
|
||||
//
|
||||
// Issue the Inquire Extended Setup Information command. Only genuine
|
||||
// BusLogic Host Adapters and TRUE clones support this command. Adaptec 1542C
|
||||
// series Host Adapters that respond to the Geometry Register I/O port will
|
||||
// fail this command.
|
||||
RequestedReplyLength = sizeof(ExtendedSetupInformation);
|
||||
if (BusLogic_Command(HostAdapter,
|
||||
BusLogic_InquireExtendedSetupInformation,
|
||||
&RequestedReplyLength,
|
||||
sizeof(RequestedReplyLength),
|
||||
&ExtendedSetupInformation,
|
||||
sizeof(ExtendedSetupInformation))
|
||||
!= sizeof(ExtendedSetupInformation))
|
||||
{
|
||||
Result = FALSE;
|
||||
}
|
||||
|
||||
WmiExtendedSetupInfo.BusType = ExtendedSetupInformation.BusType;
|
||||
WmiExtendedSetupInfo.BIOS_Address = ExtendedSetupInformation.BIOS_Address;
|
||||
WmiExtendedSetupInfo.ScatterGatherLimit = ExtendedSetupInformation.ScatterGatherLimit;
|
||||
WmiExtendedSetupInfo.MailboxCount = ExtendedSetupInformation.MailboxCount;
|
||||
WmiExtendedSetupInfo.BaseMailboxAddress = ExtendedSetupInformation.BaseMailboxAddress;
|
||||
WmiExtendedSetupInfo.FastOnEISA = ExtendedSetupInformation.Misc.FastOnEISA;
|
||||
WmiExtendedSetupInfo.LevelSensitiveInterrupt = ExtendedSetupInformation.Misc.LevelSensitiveInterrupt;
|
||||
WmiExtendedSetupInfo.FirmwareRevision[3] = ExtendedSetupInformation.FirmwareRevision[3];
|
||||
WmiExtendedSetupInfo.FirmwareRevision[3] = ExtendedSetupInformation.FirmwareRevision[3];
|
||||
WmiExtendedSetupInfo.FirmwareRevision[3] = ExtendedSetupInformation.FirmwareRevision[3];
|
||||
WmiExtendedSetupInfo.HostWideSCSI = ExtendedSetupInformation.HostWideSCSI;
|
||||
WmiExtendedSetupInfo.HostDifferentialSCSI= ExtendedSetupInformation.HostDifferentialSCSI;
|
||||
WmiExtendedSetupInfo.HostSupportsSCAM = ExtendedSetupInformation.HostSupportsSCAM;
|
||||
WmiExtendedSetupInfo.HostUltraSCSI = ExtendedSetupInformation.HostUltraSCSI;
|
||||
WmiExtendedSetupInfo.HostSmartTermination= ExtendedSetupInformation.HostSmartTermination;
|
||||
|
||||
for (; numberOfBytes; numberOfBytes--)
|
||||
{
|
||||
*Buffer++ = *SourceBuf++;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
<directory name="atapi">
|
||||
<xi:include href="atapi/atapi.xml" />
|
||||
</directory>
|
||||
<directory name="buslogic">
|
||||
<xi:include href="buslogic/buslogic.xml" />
|
||||
</directory>
|
||||
<directory name="cdrom">
|
||||
<xi:include href="cdrom/cdrom.xml" />
|
||||
</directory>
|
||||
|
|
Loading…
Reference in a new issue