HW_INITIALIZE - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// storport.h

HW_INITIALIZE HwInitialize;

BOOLEAN HwInitialize(
  PVOID DeviceExtension
)
{...}
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nc-storport-hw_initialize)

HW_INITIALIZE callback function

Description

The HwStorInitialize routine initializes the miniport driver after a system reboot or power failure occurs. It is called by StorPort after HwStorFindAdapter successfully returns. HwStorInitialize initializes the HBA and finds all devices that are of interest to the miniport driver.

Parameters

DeviceExtension

A pointer to the miniport driver's per HBA storage area.

Return value

If the initialization succeeds, HwStorInitialize returns TRUE.

Remarks

The name HwStorInitialize is just a placeholder. The actual prototype of this routine is defined in Storport.h as follows:

typedef
BOOLEAN
HW_INITIALIZE (
  _In_ PVOID  DeviceExtension
  );

Because HwStorInitialize is called at DIRQL, as much of the initialization process as possible should be performed by HwStorPassiveInitializeRoutine. If so, you must enable the passive initialization routine via StorPortEnablePassiveInitialization.

If interrupts are generated by the hardware initialization, the HwStorInterrupt routine will be called. In this case, the HwStorInitialize routine should set up any data that HwStorInterrupt expects (including a HwStorDpcRoutine, if one is used) before it begins to initialize the hardware.

The following responsibilities are shared between HwStorInitialize and HwStorPassiveInitializeRoutine:

Examples

To define an HwStorInitialize callback function, you must first provide a function declaration that identifies the type of callback function you’re defining. Windows provides a set of callback function types for drivers. Declaring a function using the callback function types helps Code Analysis for Drivers, Static Driver Verifier (SDV), and other verification tools find errors, and it’s a requirement for writing drivers for the Windows operating system.

For example, to define a HwStorInitialize callback routine that is named MyHwInitialize, use the HW_INITIALIZE type as shown in this code example:

HW_INITIALIZE MyHwInitialize;

Then, implement your callback routine as follows:

_Use_decl_annotations_
BOOLEAN
  MyHwInitialize( _In_ PVOID DeviceExtension )
  {
      ...
  }

The HW_INITIALIZE function type is defined in the Storport.h header file. To more accurately identify errors when you run the code analysis tools, be sure to add the _Use_decl_annotations_ annotation to your function definition. The _Use_decl_annotations_ annotation ensures that the annotations that are applied to the HW_INITIALIZE function type in the header file are used. For more information about the requirements for function declarations, see Declaring Functions Using Function Role Types for Storport Drivers. For information about _Use_decl_annotations_, see Annotating Function Behavior.

See also

HwStorDpcRoutine

HwStorFindAdapter

HwStorInterrupt

HwStorPassiveInitializeRoutine

StorPortEnablePassiveInitialization