Partager via


Flash Driver PDD Validation Test for Flash (Compact 2013)

3/26/2014

Flash Driver PDD Validation Test can be used to verify the MDD/PDD driver model. Flash drivers not conforming to the MDD/PDD driver model are not compatible with this test. The MDD layer is provided by Microsoft and is responsible for partition management, wear-leveling, transactioning of flash operations, managing the logical to physical sector mappings, etc. The PDD layer is provided by the flash vendor and talks directly to the flash hardware, while providing a standard interface to the MDD driver. In order for the vendor-provided PDD driver to work correctly with the Microsoft MDD driver, the PDD must correctly implement the MDD/PDD interface. This document describes a test suite (flashpddtest.dll) that can validate the functionality of a PDD driver.

The flashpddtest.dll test suite is meant only for functional verification of the PDD interface. It exercises all the required and some of the optional FLASH_PDD IOCTLs. The test suite validates the basic functionality of each IOCTL to see whether it executes correctly for valid parameters. Bad or invalid parameter testing is outside the scope. The IOCTLs that are not currently exercised directly by the MDD are omitted. The test suite is capable of exercising the PDD driver directly without activating the MDD driver. Therefore it is possible to validate the PDD functionality incrementally, before the driver is ready to be part of the full storage stack.

Test Prerequisites

Your device must meet the following requirements before you run this test.

The following table shows the hardware requirement for the Flash Driver PDD Validation Test.

Requirement

Description

Flash memory device

A flash memory device with a driver that implements sector management in software.

The following table shows the software requirements for the Flash Driver PDD Validation Test.

Requirements

Description

Tux.exe

Test harness, required for test execution

Kato.dll

Logging engine, required for logging test data

flashpddtest.dll

Library containing the test

Subtests

The table below lists the subtests included in this test.

SubTest ID

Description

1001

This test case verifies the IOCTL_FLASH_PDD_GET_REGION_COUNT IOCTL. The test succeeds if the following conditions are met:

1) The IOCTL succeeds

2) The number of reported regions is >= 1

1002

This test case verifies the IOCTL_FLASH_PDD_GET_REGION_INFO IOCTL. The test succeeds if the following conditions are met:

1) The IOCTL succeeds

2) For every region reported by IOCTL_FLASH_PDD_GET_REGION_COUNT there is a corresponding entry in the FLASH_REGION_INFO table.

1003

This test case verifies the IOCTL_FLASH_PDD_GET_BLOCK_STATUS IOCTL. The blocks' status is checked for one block at a time, based on the test parameters.

1004

This test case verifies the IOCTL_FLASH_PDD_GET_BLOCK_STATUS IOCTL. The blocks' status is checked for multiple blocks at a time, based on the test parameters.

1005

This test case verifies the IOCTL_FLASH_PDD_SET_BLOCK_STATUS IOCTL. The blocks' status is set for one block at a time, based on the test parameters.

1006

This test case verifies the IOCTL_FLASH_PDD_SET_BLOCK_STATUS IOCTL. The blocks' status is set for multiple blocks at a time, based on the test parameters.

1007

This test case verifies the IOCTL_FLASH_PDD_READ_PHYSICAL_SECTORS IOCTL. The reads are configured to be single-sector depending on the test parameters.

1008

This test case verifies the IOCTL_FLASH_PDD_READ_PHYSICAL_SECTORS IOCTL. The reads are configured to be multiple-sectors depending on the test parameters.

1009

This test case verifies the IOCTL_FLASH_PDD_READ_PHYSICAL_SECTORS IOCTL. The reads are configured to be multiple discontiguous sectors depending on the test parameters.

1010

This test case verifies the IOCTL_FLASH_PDD_WRITE_PHYSICAL_SECTORS IOCTL. The writes are configured to be single-sector depending on the test parameters.

1011

This test case verifies the IOCTL_FLASH_PDD_WRITE_PHYSICAL_SECTORS IOCTL. The writes are configured to be multiple-sector depending on the test parameters.

1012

This test case verifies the IOCTL_FLASH_PDD_WRITE_PHYSICAL_SECTORS IOCTL. The writes are configured to be multiple discontiguous sectors depending on the test parameters.

1013

This test case verifies the IOCTL_FLASH_PDD_ERASE_BLOCKS IOCTL. The erases are configured for single block runs based on the test parameters.

1014

This test case verifies the IOCTL_FLASH_PDD_ERASE_BLOCKS IOCTL. The erases are configured for multiple block runs based on the test parameters.

1015

This test case verifies the IOCTL_FLASH_PDD_ERASE_BLOCKS IOCTL. The erases are configured for multiple discontiguous block runs based on the test parameters.

2001

This test case verifies the IOCTL_FLASH_PDD_COPY_PHYSICAL_SECTORS IOCTL. The test succeeds if the following conditions are met:

1) Every DeviceIoControl succeeds.

2) If a region does not advertize the IOCTL, the call must return FALSE with GetLastError() == ERROR_NOT_SUPPORTED.

3) If a region supports the IOCTL, every copy request should succeed.

Setting Up the Test

This is a fully automated test; there are no test specific setup steps.

To run the default command line, the flash file system in the platform must use the "MSFlash" profile name. If another profile name is used on your device under test, please update the command line to use the new profile name.

Running the Test

The flashpddtest.dll test suite is a Tux test module. The full command line is structured as follows:

tux -o -d flashpddtest.dll -c "[-p profile] [-r path] [-d disk] [-store] [-regkey key -dll dllname] -zorch" -x[test case(s)]

Command Line Parameter

Description

-x [testcase]

A list, range, or combination of the test case numbers provided in the next section. Example: … -x1001,1002,1010-1015

-p profile

This parameter lets the user specify the storage profile that should be targeted by the test suite. The suite will search the stores available on the device to find one with a matching profile. Example: ... -c " -p MSFlash -zorch", ... -c " -p RamFlash -zorch"

-r path

This parameter lets the user specify the path to the flash device (assuming it is mounted and formatted as a file system). Also note that running this test will destroy any file system structures that are on the flash device. Example: … -c "-r \Flash Disk -zorch"

-d disk

This parameter lets the user specify the name of the store that should be targeted by the test suite. Example: … -c " -d DSK1: -zorch"

-store

This parameter forces the test suite to get a handle to the storage device via the OpenStore() API. This parameter is recommended if the test is unable to get a handle via the default CreateFile() call.

-regkey key -dll dllname

A combination of these flags tells the test suite to load the PDD driver directly. This allows one to test the PDD layer without activating it in the context of the MDD driver and the rest of the storage/file system stack. The regkey must point to the place in the registry where the PDD-specific configuration settings are stored, for example (Drivers\BlockDevice\MyFlash). The dll value must contain the name of the PDD driver, for example (myflashpdd.dll). Under normal usage, the "dll" value in the flash device’s registry configuration points to the Microsoft flashmdd.dll driver, which in turn loads the driver specified by the "FlashPddDll" value. When the -regkey flag is specified, the flashtestpdd.dll test suite will overwrite the "dll" value with the name of the PDD dll, and calls the ActivateDevice() API on the registry key. This call activates the PDD driver directly. Example: …-c"-dll myflashpdd.dll -regkey Drivers\BlockDevice\MyFlash -zorch"

-zorch

This flag is required for any test case to run. It allows the user to acknowledge that the test suite can and will modify sector-level data, block statuses, and in general will corrupt and/or erase any data that was previously on the flash device.

-readonly

This flag prevents the test suite from modifying or destroying data on the flash device.

Note: Either -zorch or -readonly must be supplied on the command line or all tests will be skipped

Example test scenario

Command line used

Run all test cases in the test suite on a flash device with the MyFlash profile:

tux -o -d flashpddtest.dll -c"-p MSFlash -zorch"

Run test cases 1001, and 1003-1005 on the PDD driver myflashpdd.dll, whose registry key is Drives\BlockDevice\MyFlash:

tux -o -d flashpddtest.dll -x1001,1003-1005 -c "-dll myflashpdd.dll -regkey Drivers\BlockDevice\MyFlash -zorch"

Verifying the Test

When the test completes running, verify that "PASS" appears in the test log for all subtests.

Troubleshooting the Test

* This test can only be run on flash memory devices that use the PDD/MDD driver model. The test will either be skipped or fail if the test is run against a flash driver that uses the older FAL driver or other incompatible driver model.

* Ensure that your PDD driver supports the various IOCTLs that are being tested.

See Also

Other Resources

Storage Media - Flash Tests