Skip to content

Commit 640a7c0

Browse files
committed
fixed disabling fallback timer
fixed alpha build enabled building inside w2k/nt4 subdirs instead of copying makefiles first
1 parent 4cd07df commit 640a7c0

File tree

5 files changed

+26
-24
lines changed

5 files changed

+26
-24
lines changed

nt4/SOURCES

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ INCLUDES=$(BASEDIR)\src\storage\inc
66

77
TARGETLIBS=$(BASEDIR)\lib\*\$(DDKBUILDENV)\scsiport.lib
88

9-
SOURCES=nvme2k.c \
10-
nvme2k_cpl.c \
11-
nvme2k_scsi.c \
12-
nvme2k_nvme.c \
13-
utils.c \
14-
nvme2k.rc
9+
SOURCES=..\nvme2k.c \
10+
..\nvme2k_cpl.c \
11+
..\nvme2k_scsi.c \
12+
..\nvme2k_nvme.c \
13+
..\utils.c \
14+
..\nvme2k.rc

nvme2k.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ ULONG HwFoundAdapter(
202202
}
203203
}
204204

205-
#if (_WIN32_WINNT >= 0x500)
205+
#if (_WIN32_WINNT >= 0x500 && !defined(ALPHA))
206206
accessRange->RangeStart = ScsiPortConvertUlongToPhysicalAddress(ScsiPortConvertPhysicalAddressToULongPtr(bar0));
207207
#else
208208
accessRange->RangeStart = ScsiPortConvertUlongToPhysicalAddress(bar0.LowPart);
@@ -737,8 +737,8 @@ VOID FallbackTimer(IN PVOID DeviceExtension)
737737
PHW_DEVICE_EXTENSION DevExt = (PHW_DEVICE_EXTENSION)DeviceExtension;
738738

739739
DevExt->FallbackTimerNeeded++;
740-
if (!DevExt->FallbackTimerNeeded)
741-
DevExt->FallbackTimerNeeded = 1;
740+
if (!DevExt->FallbackTimerNeeded) // wraparound
741+
DevExt->FallbackTimerNeeded = 2; // because 1 means fallbacktime didnt fire
742742

743743
NvmeProcessAdminCompletion(DevExt);
744744
NvmeProcessIoCompletion(DevExt);
@@ -752,11 +752,12 @@ BOOLEAN HwInterrupt(IN PVOID DeviceExtension)
752752
PHW_DEVICE_EXTENSION DevExt = (PHW_DEVICE_EXTENSION)DeviceExtension;
753753
BOOLEAN interruptHandled = FALSE;
754754

755+
DevExt->InterruptCount++;
755756
if (DevExt->FallbackTimerNeeded) {
756757
// cancel the fallback timer
757758
ScsiPortNotification(RequestTimerCall, DeviceExtension, FallbackTimer, 0);
758-
// interrupts worked a million times, we probably dont need a fallback
759-
if (DevExt->FallbackTimerNeeded >= 1000000) {
759+
// interrupts worked a million times, and callback didnt fire we probably dont need a fallback
760+
if (DevExt->InterruptCount >= 1000000 && DevExt->FallbackTimerNeeded == 1) {
760761
DevExt->FallbackTimerNeeded = 0;
761762
}
762763
}

nvme2k.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ typedef struct _HW_DEVICE_EXTENSION {
172172
BOOLEAN InitComplete; // Offset 0xB7 (183)
173173

174174
ULONG Reserved4a; // Offset 0xB8 (184)
175-
ULONG Reserved4b; // Offset 0xBC (188)
175+
ULONG InterruptCount; // Offset 0xBC (188)
176176

177177
// PRP list pages for scatter-gather (shared pool, allocated after init)
178178
// Note: During init, UtilityBuffer points to the same memory

nvme2k_nvme.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,7 @@ BOOLEAN NvmeInitializeController(IN PHW_DEVICE_EXTENSION DevExt)
11961196
// Start the initialization sequence
11971197
DevExt->InitComplete = FALSE;
11981198
DevExt->FallbackTimerNeeded = 1;
1199+
DevExt->InterruptCount = 0;
11991200
NvmeCreateIoCQ(DevExt);
12001201

12011202
// POLL for init completion (interrupts are masked during init)

w2k/sources

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ MSC_WARNING_LEVEL=/W3 /WX
1515
# Platform-specific source files
1616
!IF $(ALPHA)
1717
DRIVER_ALIGNMENT=0x2000
18-
SOURCES=nvme2k.c \
19-
nvme2k_cpl.c \
20-
nvme2k_nvme.c \
21-
nvme2k_scsi.c \
22-
utils.c \
23-
nvme2k.rc
18+
SOURCES=..\nvme2k.c \
19+
..\nvme2k_cpl.c \
20+
..\nvme2k_nvme.c \
21+
..\nvme2k_scsi.c \
22+
..\utils.c \
23+
..\nvme2k.rc
2424

2525
!ELSE
2626
DRIVER_ALIGNMENT=0x1000
27-
SOURCES=nvme2k.c \
28-
nvme2k_cpl.c \
29-
nvme2k_nvme.c \
30-
nvme2k_scsi.c \
31-
utils.c \
32-
nvme2k.rc
27+
SOURCES=..\nvme2k.c \
28+
..\nvme2k_cpl.c \
29+
..\nvme2k_nvme.c \
30+
..\nvme2k_scsi.c \
31+
..\utils.c \
32+
..\nvme2k.rc
3333
!ENDIF
3434

0 commit comments

Comments
 (0)