Skip to content

Tiny regression since version 1.0.0.3 in MaximumPhysicalPages calculation #21

@LordOfMice

Description

@LordOfMice

Under Windows 2000 SP4, SCSIPORT.SYS 5.0.2195.6713

--------- Adapter Descriptor ---------------------
Version = 32
Size = 32
MaximumTransferLength = 262144
MaximumPhysicalPages = 33
AlignmentMask = 3
AdapterUsesPio = Yes
AdapterScansDown = No
CommandQueueing = Yes
AcceleratedTransfer = Yes
BusType = 1 (SCSI v2.0)
BusMajorVersion = 2
BusMinorVersion = 0
SrbType (Win8+) = 0 (SCSI)
AddressType (Win8+) = 0 (BTL8)

Most correct version with result like Windows 10 should give
--------- Adapter Descriptor ---------------------
Version = 32
Size = 32
MaximumTransferLength = 262144
MaximumPhysicalPages = 513
AlignmentMask = 3
AdapterUsesPio = Yes
AdapterScansDown = No
CommandQueueing = Yes
AcceleratedTransfer = Yes
BusType = 1 (SCSI v2.0)
BusMajorVersion = 2
BusMinorVersion = 0
SrbType (Win8+) = 0 (SCSI)
AddressType (Win8+) = 0 (BTL8)

The source of problem is this code:
ConfigInfo->MaximumTransferLength = 32u << NVME_PAGE_SHIFT; // safe default
It restricts MaximumPhysicalPages in addition to
ConfigInfo->NumberOfPhysicalBreaks = 511; // PRP1 + PRP list (512 entries)

The correct code should be:
ConfigInfo->MaximumTransferLength = 512u << NVME_PAGE_SHIFT;
and
ConfigInfo->NumberOfPhysicalBreaks = 513;

In addition - the code in the end of init phase:
if (((ConfigInfo->MaximumTransferLength >> NVME_PAGE_SHIFT) - 1) < ConfigInfo->NumberOfPhysicalBreaks)
ConfigInfo->NumberOfPhysicalBreaks = (ConfigInfo->MaximumTransferLength >> NVME_PAGE_SHIFT) - 1;
is useless

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions