;Copyright © 2015-2019 Microsemi Corporation. All rights reserved.
;Copyright © 2020 Microchip Technology Inc. and its subsidiaries.
;
[version]
Signature="$WINDOWS NT$"
Class=SCSIAdapter
ClassGUID={4D36E97B-E325-11CE-BFC1-08002BE10318}
Provider=%MICROCHIP%
DriverVer = 04/19/2018,1.50.1.0
; Real date 02/21/2019

[SourceDisksNames.amd64]
1=%DISK%,SmartSAMD.sys,,

[SourceDisksFiles.amd64]
SmartSAMD.sys=1,,

[DestinationDirs]
DefaultDestDir = 12 ; DIRID_DRIVERS

[ControlFlags]
ExcludeFromSelect = *

[Manufacturer]
%MICROCHIP%=MI_HDC,ntamd64.10.0


[MI_HDC.ntamd64.10.0] ;Server2016
%smart_SmartStorage.DeviceDesc% = SmartSAMD_Inst_V64, PCI\VEN_9005&DEV_028F

[SmartSAMD_Inst_V64.ntamd64]
CopyFiles = @SmartSAMD.sys

[SmartSAMD_Inst_V64.ntamd64.Services]
AddService = SmartSAMD, %SPSVCINST_ASSOCSERVICE%, SmartSAMD_Service_Inst, SmartSAMD_EventLog_Inst

[SmartSAMD_Service_Inst]
ServiceType    = %SERVICE_KERNEL_DRIVER%
StartType      = %SERVICE_BOOT_START%
ErrorControl   = %SERVICE_ERROR_NORMAL%
ServiceBinary  = %12%\SmartSAMD.sys
LoadOrderGroup = SCSI Miniport
AddReg         = pnpsafe_pci_addreg
AddReg         = IO_timeout_addreg

[SmartSAMD_EventLog_Inst]
AddReg = SmartSAMD_EventLog_AddReg

[SmartSAMD_EventLog_AddReg]
HKR,,EventMessageFile,%REG_EXPAND_SZ%,"%%SystemRoot%%\System32\IoLogMsg.dll;%%SystemRoot%%\System32\drivers\SmartSAMD.sys"
HKR,,TypesSupported,%REG_DWORD%,7

[pnpsafe_pci_addreg]
HKR, ,                          "Tag",                        %REG_DWORD%,  0x103
HKR, "Parameters\PnpInterface", "5",                          %REG_DWORD%,  0x00000001
HKR, "Parameters",              "BusType",                    %REG_NOCLOBBER_DWORD%,  0x0000000A
HKR, "Parameters\Drive",        "EnableQueryAccessAlignment", %REG_DWORD%,  0x00000001

[IO_timeout_addreg]
HKR, "Parameters", "IoTimeoutValue", %REG_DWORD%, 0x0000003C

[SmartSAMD_Inst_V64.ntamd64.HW]
AddReg=Msi64Support_addreg
Include=machine.inf
Needs=PciIoSpaceNotRequired.HW, PciASPMOptOut.HW
AddReg=SupportStorportIPM_addreg
AddReg=AdditionalSenseData_addreg
AddReg=EnableFull64Bit_addreg
AddReg=EnableExtSrbs_addreg
AddReg=MaxDeviceQueueDepth_addreg

[Msi64Support_addreg]
HKR, Interrupt Management, %CREATE_KEYONLY%
HKR, "Interrupt Management\MessageSignaledInterruptProperties", %CREATE_KEYONLY%
;Set to a nonzero value to enable MSI or MSI-x support.
HKR, "Interrupt Management\MessageSignaledInterruptProperties", "MSISupported", %REG_DWORD%, 0x00000001
;Max number of MSI or MSI-X vectors a driver can manage from one device.
;Used to limit the number of vectors to fewer than those requested by the controller.
HKR, "Interrupt Management\MessageSignaledInterruptProperties", "MessageNumberLimit", %REG_DWORD%, 0x0000001
HKR, "Interrupt Management\Affinity Policy", "DevicePolicy", %REG_DWORD%, 0x05
HKR, "Interrupt Management\Affinity Policy", "GroupPolicy", %REG_DWORD%, 0x01

[SupportStorportIPM_addreg]
; Enables Storport IPM for this adapter
HKR, "StorPort", "EnableIdlePowerManagement", %REG_DWORD%, 0x01

[AdditionalSenseData_addreg]
; Sense data size Between 18 and 255
HKR, "StorPort", "TotalSenseDataBytes", %REG_DWORD%, 0xFF

[EnableFull64Bit_addreg]
; Instruct driver to use 64 bit addressing through storport if supported on this machine.
HKLM, "System\CurrentControlSet\Services\SmartSAMD\Parameters\Device", "EnableFull64Bit", %REG_BINARY%,  0x1

[EnableExtSrbs_addreg]
; Set storport to provide Extended SRBs to the miniport.
HKLM, "System\CurrentControlSet\Services\SmartSAMD\Parameters\Device", "EnableExtSrbs", %REG_BINARY%,  0x1

[MaxDeviceQueueDepth_addreg]
; Set  max I/O per device queue depth
HKLM, "System\CurrentControlSet\Services\SmartSAMD\Parameters\Device", "MaxDeviceQueueDepth", %REG_DWORD%, 0x0000080

[Strings]
;Localizable
MICROCHIP = "Microchip Technology Inc."
DISK = "PQI Controller Support"
smart_SmartStorage.DeviceDesc = "SmartStorage Controller (Media Driver)"

;*******************************************
;Non-Localizable Handy macro substitutions 
SPSVCINST_ASSOCSERVICE = 0x00000002
SERVICE_KERNEL_DRIVER  = 1
SERVICE_BOOT_START     = 0
SERVICE_ERROR_NORMAL   = 1
REG_EXPAND_SZ          = 0x00020000
REG_DWORD              = 0x00010001
REG_SZ                 = 0x00000000
REG_NOCLOBBER_DWORD    = 0x00010003
REG_BINARY             = 0x00030001
CREATE_KEYONLY         = 0x00000010
