** END_ICS_COPYRIGHT ****************************************/\r
/*\r
* Copyright (c) 2008 Intel corporation. All rights reserved.\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
\r
extern const char *mthca_version;\r
\r
+#ifdef NOT_USED_XXX\r
NTSTATUS\r
hca_add_device(\r
- IN PDRIVER_OBJECT pDriverObj,\r
- IN PDEVICE_OBJECT pPdo,\r
- IN PDEVICE_OBJECT p_dev_obj );\r
+ IN PDRIVER_OBJECT pDriverObj,\r
+ IN PDEVICE_OBJECT pPdo,\r
+ IN PDEVICE_OBJECT p_dev_obj );\r
+#endif\r
\r
static NTSTATUS\r
hca_start(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp, \r
- OUT cl_irp_action_t* const p_action );\r
+ IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN hca_dev_ext_t* p_ext,\r
+ IN WDFCMRESLIST Resources,\r
+ IN WDFCMRESLIST ResourcesTranslated );\r
\r
static NTSTATUS\r
hca_query_stop(\r
\r
static void\r
hca_release_resources(\r
- IN DEVICE_OBJECT* const p_dev_obj );\r
+ IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN hca_dev_ext_t* p_ext );\r
\r
static NTSTATUS\r
hca_cancel_remove(\r
#pragma alloc_text (PAGE, HcaEvtDeviceWakeArmSx)\r
#pragma alloc_text (PAGE, HcaSetPowerPolicy)\r
\r
-#pragma alloc_text (PAGE, hca_add_device)\r
#pragma alloc_text (PAGE, hca_start)\r
#pragma alloc_text (PAGE, hca_query_stop)\r
#pragma alloc_text (PAGE, hca_stop)\r
hca_init_vfptr( void )\r
{\r
vfptrHcaPnp.identity = "HCA driver";\r
- vfptrHcaPnp.pfn_start = hca_start;\r
+ vfptrHcaPnp.pfn_start = cl_irp_ignore /*hca_start*/;\r
vfptrHcaPnp.pfn_query_stop = hca_query_stop;\r
vfptrHcaPnp.pfn_stop = hca_stop;\r
vfptrHcaPnp.pfn_cancel_stop = hca_cancel_stop;\r
vfptrHcaPnp.pfn_query_remove = hca_query_remove;\r
- vfptrHcaPnp.pfn_release_resources = hca_release_resources;\r
+ vfptrHcaPnp.pfn_release_resources = cl_irp_ignore /*hca_release_resources*/;\r
vfptrHcaPnp.pfn_remove = cl_do_remove;\r
vfptrHcaPnp.pfn_cancel_remove = hca_cancel_remove;\r
vfptrHcaPnp.pfn_surprise_remove = hca_surprise_remove;\r
* - Configuration Space: not prefetchable, read/write\r
* - UAR space: prefetchable, write only.\r
* - DDR: prefetchable, read/write.\r
+ *\r
+ * Inputs:\r
+ * p_ext - fdoData (device extension)\r
+ * pHcaResList - Raw (bus relative addresses) Resource list\r
+ * pHostResList - Translated (to system addresses) Resource list\r
+ *\r
*/\r
static NTSTATUS\r
-__SetupHcaResources(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN CM_RESOURCE_LIST* const pHcaResList,\r
- IN CM_RESOURCE_LIST* const pHostResList )\r
+__SetupHcaResources( IN hca_dev_ext_t* p_ext,\r
+ IN WDFCMRESLIST pHcaResList,\r
+ IN WDFCMRESLIST pHostResList )\r
{\r
- NTSTATUS status = STATUS_SUCCESS;\r
- hca_dev_ext_t *p_ext;\r
- USHORT i;\r
- hca_bar_type_t type = HCA_BAR_TYPE_HCR;\r
+ NTSTATUS status = STATUS_SUCCESS;\r
+ USHORT i;\r
+ hca_bar_type_t type = HCA_BAR_TYPE_HCR;\r
\r
- CM_PARTIAL_RESOURCE_DESCRIPTOR *pHcaRes, *pHostRes;\r
+ PCM_PARTIAL_RESOURCE_DESCRIPTOR pHcaRes, pHostRes;\r
\r
HCA_ENTER( HCA_DBG_PNP );\r
\r
if (!pHcaResList || !pHostResList)\r
goto done;\r
\r
- p_ext = (hca_dev_ext_t*)p_dev_obj->DeviceExtension;\r
-\r
// store the bus number for reset of Tavor\r
- p_ext->bus_number = pHostResList->List[0].BusNumber;\r
+ pHostRes = WdfCmResourceListGetDescriptor(pHostResList, 0); \r
+ p_ext->bus_number = pHostRes->u.BusNumber.Start; // XXX Correct bus # ?\r
\r
- for( i = 0; i < pHostResList->List[0].PartialResourceList.Count; i++ )\r
+ for( i = 0; i <WdfCmResourceListGetCount(pHostResList); i++ )\r
{\r
- pHcaRes =\r
- &pHcaResList->List[0].PartialResourceList.PartialDescriptors[i];\r
- pHostRes = \r
- &pHostResList->List[0].PartialResourceList.PartialDescriptors[i];\r
-\r
+ pHcaRes = WdfCmResourceListGetDescriptor(pHcaResList, i); \r
+ pHostRes = WdfCmResourceListGetDescriptor(pHostResList, i); \r
+ if(!pHcaRes || !pHostRes){\r
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT,\r
+ "WdfResourceCmGetDescriptor() err pHcaRes %p pHostRes %p\n",\r
+ pHcaRes, pHostRes);\r
+ return STATUS_DEVICE_CONFIGURATION_ERROR;\r
+ }\r
\r
/*\r
* Save the interrupt information so that we can power the device\r
}\r
\r
\r
-static int mthca_get_livefish_info(struct mthca_dev *mdev, __be64 *node_guid, u32 *hw_id)\r
+static int\r
+mthca_get_livefish_info(struct mthca_dev *mdev, __be64 *node_guid, u32 *hw_id)\r
{\r
*node_guid = cl_hton64((uint64_t)(ULONG_PTR)mdev);\r
mdev->ib_dev.node_guid = *node_guid;\r
return 0;\r
}\r
\r
+\r
+/*\r
+ p_dev_obj - DEVICE_OBJECT*\r
+ p_ext - FDO_DATA* device extension data\r
+ ResourcesRaw - Handle to a collection of framework resource objects.\r
+ This collection identifies the raw (bus-relative) hardware\r
+ resources that have been assigned to the device.\r
+\r
+ ResourcesTranslated - Handle to a collection of framework resource objects.\r
+ This collection identifies the translated (system-physical)\r
+ hardware resources that have been assigned to the device.\r
+ The resources appear from the CPU's point of view.\r
+ Use this list of resources to map I/O space and\r
+ device-accessible memory into virtual address space\r
+*/\r
+\r
static NTSTATUS\r
hca_start(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp, \r
- OUT cl_irp_action_t* const p_action )\r
+ IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN hca_dev_ext_t* p_ext,\r
+ WDFCMRESLIST ResourcesRaw,\r
+ WDFCMRESLIST ResourcesTranslated )\r
{\r
NTSTATUS status;\r
- hca_dev_ext_t *p_ext;\r
- IO_STACK_LOCATION *pIoStack;\r
POWER_STATE powerState;\r
DEVICE_DESCRIPTION devDesc;\r
+ DEVICE_OBJECT *pdo;\r
\r
HCA_ENTER( HCA_DBG_PNP );\r
\r
- p_ext = (hca_dev_ext_t*)p_dev_obj->DeviceExtension;\r
-\r
- /* Handled on the way up. */\r
- status = cl_do_sync_pnp( p_dev_obj, p_irp, p_action );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PNP, \r
- ("Lower drivers failed IRP_MN_START_DEVICE (%#x).\n", status));\r
- return status;\r
- }\r
-\r
- pIoStack = IoGetCurrentIrpStackLocation( p_irp );\r
-\r
/*\r
* Walk the resource lists and store the information. The write-only\r
* flag is not set for the UAR region, so it is indistinguishable from the\r
* - UAR space: prefetchable, write only.\r
* - DDR: prefetchable, read/write.\r
*/\r
- status = __SetupHcaResources( p_dev_obj,\r
- pIoStack->Parameters.StartDevice.AllocatedResources,\r
- pIoStack->Parameters.StartDevice.AllocatedResourcesTranslated );\r
+ status = __SetupHcaResources( p_ext, ResourcesRaw, ResourcesTranslated );\r
+\r
if( !NT_SUCCESS( status ) )\r
{\r
HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PNP, \r
- ("__ProcessResources returned %08X.\n", status));\r
+ ("__SetupHcaResources failed %08X.\n", status));\r
return status;\r
}\r
\r
// get the adapter object\r
// 0x80000000 is a threshold, that's why - 1\r
devDesc.MaximumLength = 0x80000000 - 1;\r
- p_ext->p_dma_adapter = IoGetDmaAdapter(\r
- p_ext->cl_ext.p_pdo, &devDesc, &p_ext->n_map_regs );\r
+ pdo = WdfDeviceWdmGetPhysicalDevice(p_ext->WdfDevice);\r
+ p_ext->p_dma_adapter = IoGetDmaAdapter( pdo,\r
+ &devDesc,\r
+ &p_ext->n_map_regs );\r
if( !p_ext->p_dma_adapter )\r
{\r
HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PNP, \r
{\r
int err;\r
if (mthca_is_livefish(p_ext->hca.mdev)) \r
- err = mthca_get_livefish_info( p_ext->hca.mdev, &p_ext->hca.guid, &p_ext->hca.hw_ver );\r
+ err = mthca_get_livefish_info( p_ext->hca.mdev,\r
+ &p_ext->hca.guid,\r
+ &p_ext->hca.hw_ver );\r
else\r
- err = mthca_get_dev_info( p_ext->hca.mdev, &p_ext->hca.guid, &p_ext->hca.hw_ver );\r
-\r
+ err = mthca_get_dev_info( p_ext->hca.mdev,\r
+ &p_ext->hca.guid,\r
+ &p_ext->hca.hw_ver );\r
if (err) {\r
\r
//TODO: no cleanup on error\r
*/\r
p_ext->state = HCA_STARTED;\r
\r
+// XXX STAN - Is this call needed? I think so, will it work?\r
/* Register for interface arrival of the IB_AL device. */\r
status = IoRegisterPlugPlayNotification(\r
- EventCategoryDeviceInterfaceChange,\r
- PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES,\r
- (void*)&GUID_IB_CI_INTERFACE, p_dev_obj->DriverObject,\r
- __pnp_notify_ifc, p_dev_obj, &p_ext->pnp_ifc_entry );\r
+ EventCategoryDeviceInterfaceChange,\r
+ PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES,\r
+ (void*)&GUID_IB_CI_INTERFACE, p_dev_obj->DriverObject,\r
+ __pnp_notify_ifc, p_dev_obj, &p_ext->pnp_ifc_entry );\r
if( !NT_SUCCESS( status ) )\r
{\r
p_ext->state = HCA_ADDED;\r
("IoRegisterPlugPlayNotification returned %08x.\n", status));\r
}\r
\r
+// XXX STAN - how does this interface with KMDF D0 pwr state callback?\r
+\r
/* We get started fully powered. */\r
p_ext->DevicePowerState = PowerDeviceD0;\r
powerState.DeviceState = PowerDeviceD0;\r
powerState = PoSetPowerState ( p_ext->cl_ext.p_self_do,\r
- DevicePowerState, powerState );\r
+ DevicePowerState,\r
+ powerState );\r
HCA_PRINT( TRACE_LEVEL_INFORMATION, HCA_DBG_PNP, \r
("PoSetPowerState: old state %d, new state to %d\n", \r
powerState.DeviceState, p_ext->DevicePowerState ));\r
struct mthca_dev *mdev = p_ext->hca.mdev;\r
HCA_PRINT_EV(TRACE_LEVEL_INFORMATION ,HCA_DBG_LOW ,\r
("Ven %x Dev %d Hw %x Fw %d.%d.%d Drv %s (%s)", \r
- (unsigned)p_ext->hcaConfig.VendorID, (unsigned)p_ext->hcaConfig.DeviceID,\r
+ (unsigned)p_ext->hcaConfig.VendorID,\r
+ (unsigned)p_ext->hcaConfig.DeviceID,\r
p_ext->hca.hw_ver, (int) (mdev->fw_ver >> 32),\r
(int) (mdev->fw_ver >> 16) & 0xffff, (int) (mdev->fw_ver & 0xffff),\r
- DRV_VERSION, DRV_RELDATE\r
- ));\r
+ DRV_VERSION, DRV_RELDATE ));\r
+\r
HCA_PRINT_EV(TRACE_LEVEL_INFORMATION ,HCA_DBG_LOW ,\r
("Flags %s%s%s%s%s%s%s\n", \r
(mdev->mthca_flags & MTHCA_FLAG_LIVEFISH) ? "Flash Recovery Mode:" : "",\r
(mdev->mthca_flags & MTHCA_FLAG_FMR) ? "Fmr:" : "",\r
(mdev->mthca_flags & MTHCA_FLAG_SRQ) ? "Srq:" : "",\r
(mdev->mthca_flags & MTHCA_FLAG_DDR_HIDDEN) ? "HideDdr:" : "",\r
- (mdev->mthca_flags & MTHCA_FLAG_PCIE) ? "PciEx:" : ""\r
- ));\r
+ (mdev->mthca_flags & MTHCA_FLAG_PCIE) ? "PciEx:" : "" ));\r
}\r
-\r
HCA_EXIT( HCA_DBG_PNP );\r
return status;\r
}\r
\r
/* release the resources, allocated in hca_start */\r
static void\r
-__hca_release_resources( IN DEVICE_OBJECT* const p_dev_obj )\r
+__hca_release_resources( IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN hca_dev_ext_t* p_ext )\r
{\r
- hca_dev_ext_t *p_ext = (hca_dev_ext_t*)p_dev_obj->DeviceExtension;\r
-\r
HCA_ENTER( HCA_DBG_PNP );\r
\r
switch( p_ext->state )\r
mthca_remove_one( p_ext );\r
\r
if( p_ext->p_dma_adapter ) {\r
- p_ext->p_dma_adapter->DmaOperations->PutDmaAdapter( p_ext->p_dma_adapter );\r
+ p_ext->p_dma_adapter->DmaOperations->PutDmaAdapter(p_ext->p_dma_adapter);\r
p_ext->p_dma_adapter = NULL;\r
}\r
\r
hca_disable_pci( &p_ext->hcaBusIfc );\r
\r
- //cl_event_destroy( &p_ext->mutex );\r
__UnmapHcaMemoryResources( p_dev_obj );\r
\r
p_ext->state = HCA_ADDED;\r
\r
\r
static void\r
-hca_release_resources(\r
- IN DEVICE_OBJECT* const p_dev_obj )\r
+hca_release_resources( IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN hca_dev_ext_t* p_ext )\r
{\r
- hca_dev_ext_t *p_ext;\r
POWER_STATE powerState;\r
\r
HCA_ENTER( HCA_DBG_PNP );\r
\r
- p_ext = (hca_dev_ext_t*)p_dev_obj->DeviceExtension;\r
-\r
/* release all the resources, allocated in hca_start */\r
- __hca_release_resources(p_dev_obj);\r
+ __hca_release_resources( p_dev_obj, p_ext );\r
\r
/* Notify the power manager that the device is powered down. */\r
p_ext->DevicePowerState = PowerDeviceD3;\r
powerState.DeviceState = PowerDeviceD3;\r
powerState = PoSetPowerState ( p_ext->cl_ext.p_self_do,\r
- DevicePowerState, powerState );\r
+ DevicePowerState,\r
+ powerState );\r
\r
HCA_PRINT( TRACE_LEVEL_INFORMATION, HCA_DBG_PNP, \r
("PoSetPowerState: old state %d, new state to %d\n", \r
}\r
\r
p_ext->DevicePowerState = pIoStack->Parameters.Power.State.DeviceState;\r
- powerState = PoSetPowerState( p_dev_obj, DevicePowerState,\r
- pIoStack->Parameters.Power.State );\r
+ powerState = PoSetPowerState( p_dev_obj,\r
+ DevicePowerState,\r
+ pIoStack->Parameters.Power.State );\r
\r
HCA_PRINT( TRACE_LEVEL_INFORMATION, HCA_DBG_PO, \r
("PoSetPowerState: old state %d, new state to %d\n", \r
p_ext->pPoWorkItem = NULL;\r
\r
p_ext->DevicePowerState = pIoStack->Parameters.Power.State.DeviceState;\r
- powerState = PoSetPowerState( p_dev_obj, DevicePowerState,\r
- pIoStack->Parameters.Power.State );\r
+ powerState = PoSetPowerState( p_dev_obj,\r
+ DevicePowerState,\r
+ pIoStack->Parameters.Power.State );\r
\r
HCA_PRINT( TRACE_LEVEL_INFORMATION, HCA_DBG_PO, \r
("PoSetPowerState: old state %d, new state to %d, IRQL %d\n", \r
\r
Device - Handle to a framework device object.\r
\r
- Resources - Handle to a collection of framework resource objects.\r
- This collection identifies the raw (bus-relative) hardware\r
- resources that have been assigned to the device.\r
+ ResourcesRaw - Handle to a collection of framework resource objects.\r
+ This collection identifies the raw (bus-relative) hardware\r
+ resources that have been assigned to the device.\r
\r
ResourcesTranslated - Handle to a collection of framework resource objects.\r
This collection identifies the translated (system-physical)\r
The resources appear from the CPU's point of view.\r
Use this list of resources to map I/O space and\r
device-accessible memory into virtual address space\r
-\r
Return Value:\r
\r
WDF status code\r
NTSTATUS\r
HcaEvtDevicePrepareHardware (\r
WDFDEVICE Device,\r
- WDFCMRESLIST Resources,\r
+ WDFCMRESLIST ResourcesRaw,\r
WDFCMRESLIST ResourcesTranslated )\r
{\r
NTSTATUS status = STATUS_SUCCESS;\r
PFDO_DATA fdoData = NULL;\r
DEVICE_OBJECT* p_dev_obj;\r
\r
- UNREFERENCED_PARAMETER(Resources);\r
- UNREFERENCED_PARAMETER(ResourcesTranslated);\r
-\r
PAGED_CODE();\r
\r
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "--> %s()\n", __FUNCTION__);\r
fdoData = FdoGetData(Device);\r
p_dev_obj = WdfDeviceWdmGetAttachedDevice(Device),\r
\r
+ status = hca_start(p_dev_obj, fdoData, ResourcesRaw, ResourcesTranslated);\r
+ if (!NT_SUCCESS (status))\r
+ {\r
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,\r
+ "hca_start() failed: %!STATUS!\n", status);\r
+ return status;\r
+ }\r
#if 0\r
status = NICMapHWResources(fdoData, ResourcesTranslated);\r
if (!NT_SUCCESS (status)){\r
return status;\r
}\r
#endif\r
-\r
-\r
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,\r
"<-- %s() ret %x\n", __FUNCTION__, status);\r
\r
fdoData = FdoGetData(Device);\r
p_dev_obj = WdfDeviceWdmGetAttachedDevice(Device),\r
\r
-#if 0\r
- //\r
// Unmap any I/O ports. Disconnecting from the interrupt will be done\r
// automatically by the framework.\r
- //\r
- NICUnmapHWResources(fdoData);\r
-#endif\r
+\r
+ hca_release_resources( p_dev_obj, fdoData );\r
\r
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "<-- %s()\n", __FUNCTION__);\r
\r
}\r
\r
\r
+void\r
+SetPowerLow( FDO_DATA *fdoData, WDF_POWER_DEVICE_STATE TargetState )\r
+{\r
+ UNREFERENCED_PARAMETER(fdoData);\r
+\r
+ TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER,\r
+ "--> %s() target state %s\n", __FUNCTION__,\r
+ DbgDevicePowerString(TargetState));\r
+\r
+ TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER, "<-- %s()\n", __FUNCTION__);\r
+}\r
+\r
+void\r
+SetPowerD0( FDO_DATA *fdoData )\r
+{\r
+ UNREFERENCED_PARAMETER(fdoData);\r
+\r
+ TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER, "--> %s()\n", __FUNCTION__);\r
+ TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER, "<-- %s()\n", __FUNCTION__);\r
+}\r
+\r
+void\r
+SetPowerShutdown( FDO_DATA *fdoData )\r
+{\r
+ UNREFERENCED_PARAMETER(fdoData);\r
+\r
+ TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER,\r
+ "--> %s() D3 Final\n", __FUNCTION__);\r
+ // Reset and put the device into a known initial state we're shutting\r
+ // down for the last time.\r
+ TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER, "<-- %s()\n", __FUNCTION__);\r
+}\r
+\r
+\r
/*++\r
\r
Routine Description:\r
PFDO_DATA fdoData;\r
\r
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER,\r
- "-->HcaEvtDeviceD0Entry - coming from %s\n",\r
+ "--> %s() - coming from %s\n", __FUNCTION__,\r
DbgDevicePowerString(PreviousState));\r
\r
fdoData = FdoGetData(Device);\r
\r
fdoData->DevicePowerState = PowerDeviceD0;\r
\r
- if(IsPoMgmtSupported(fdoData)){\r
-\r
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_POWER,\r
- "Entering fully on state\n");\r
-#ifdef XXX\r
- MPSetPowerD0 (fdoData);\r
-#endif\r
+ if(IsPoMgmtSupported(fdoData))\r
+ {\r
+ SetPowerD0(fdoData);\r
}\r
-\r
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER, "<--HcaEvtDeviceD0Entry\n");\r
+ TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER, "<-- %s()\n", __FUNCTION__);\r
\r
return STATUS_SUCCESS;\r
}\r
\r
\r
-NTSTATUS\r
-HcaEvtDeviceD0Exit(\r
- IN WDFDEVICE Device,\r
- IN WDF_POWER_DEVICE_STATE TargetState\r
- )\r
+\r
/*++\r
\r
Routine Description:\r
device stack being torn down.\r
\r
--*/\r
+\r
+NTSTATUS\r
+HcaEvtDeviceD0Exit(\r
+ IN WDFDEVICE Device,\r
+ IN WDF_POWER_DEVICE_STATE TargetState )\r
{\r
PFDO_DATA fdoData;\r
\r
- UNREFERENCED_PARAMETER(Device);\r
+ fdoData = FdoGetData(Device);\r
\r
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER,\r
- "-->HcaEvtDeviceD0Exit - moving to %s\n",\r
+ "--> %s() current %s - moving to %s\n",\r
+ DbgDevicePowerString(fdoData->DevicePowerState),\r
DbgDevicePowerString(TargetState));\r
\r
- fdoData = FdoGetData(Device);\r
-\r
fdoData->DevicePowerState = TargetState;\r
\r
- switch (TargetState) {\r
+ switch (TargetState)\r
+ {\r
case WdfPowerDeviceD1:\r
case WdfPowerDeviceD2:\r
case WdfPowerDeviceD3:\r
\r
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_POWER,\r
"Entering a deeper sleep state\n");\r
-#ifdef XXX\r
- MPSetPowerLow (fdoData, TargetState);\r
-#endif\r
+ SetPowerLow(fdoData, TargetState);\r
}\r
break;\r
\r
// in the paging path (or being a parent or grandparent of a paging\r
// path device) then this whole case can be deleted.\r
//\r
- ASSERT(FALSE); // This driver shouldn't get this.\r
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_POWER,\r
+ "%s() Hibernation? not supported.\n", __FUNCTION__);\r
+ //ASSERT(FALSE); // This driver shouldn't get this.\r
break;\r
\r
case WdfPowerDeviceD3Final:\r
// Reset and put the device into a known initial state we're shutting\r
// down for the last time.\r
//\r
-#if 0\r
- NICShutdown(fdoData);\r
-#endif\r
+ SetPowerShutdown(fdoData);\r
break;\r
\r
default:\r
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_POWER,\r
+ "%s() Unsupported Power state %s\n", __FUNCTION__,\r
+ DbgDevicePowerString(TargetState));\r
break;\r
}\r
\r
-\r
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER, "<--HcaEvtDeviceD0Exit\n");\r
+ TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER, "<-- %s()\n", __FUNCTION__);\r
\r
return STATUS_SUCCESS;\r
}\r
\r
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "--> %s\n", __FUNCTION__);\r
\r
-\r
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "<-- %s\n", __FUNCTION__);\r
}\r
\r
UNREFERENCED_PARAMETER(Device);\r
\r
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "--> %s", __FUNCTION__);\r
-\r
-\r
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "<-- %s", __FUNCTION__);\r
\r
return;\r
Routine Description:\r
\r
This event is called so that driver can do PASSIVE_LEVEL work after\r
- the interrupt is connected and enabled. Here we start the watchdog timer.\r
- Watch dog timer is used to do the initial link detection during\r
- start and then used to make sure the device is not stuck for any reason.\r
+ the interrupt is connected and enabled.\r
\r
This function is not marked pageable because this function is in the\r
device power up path. When a function is marked pagable and the code\r
\r
}\r
\r
+\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This event is called when the Framework moves the device to D0, and after\r
+ EvtDeviceD0Entry. The driver should enable its interrupt here.\r
+\r
+ This function will be called at the device's assigned interrupt\r
+ IRQL (DIRQL.)\r
+\r
+Arguments:\r
+\r
+ Interrupt - Handle to a Framework interrupt object.\r
+\r
+ AssociatedDevice - Handle to a Framework device object.\r
+\r
+Return Value:\r
+\r
+ BOOLEAN - TRUE indicates that the interrupt was successfully enabled.\r
+\r
+--*/\r
+\r
+NTSTATUS\r
+HcaEvtInterruptEnable(\r
+ IN WDFINTERRUPT Interrupt,\r
+ IN WDFDEVICE AssociatedDevice )\r
+{\r
+ PFDO_DATA fdoData;\r
+ UNREFERENCED_PARAMETER(Interrupt);\r
+\r
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_PNP, "--> %s()\n", __FUNCTION__);\r
+\r
+ fdoData = FdoGetData(AssociatedDevice);\r
+\r
+ //NICEnableInterrupt(Interrupt, fdoData);\r
+\r
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_PNP, "<-- %s()\n", __FUNCTION__);\r
+\r
+ return STATUS_SUCCESS;\r
+}\r
+\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This event is called before the Framework moves the device to D1, D2 or D3\r
+ and before EvtDeviceD0Exit. The driver should disable its interrupt here.\r
+\r
+ This function will be called at the device's assigned interrupt\r
+ IRQL (DIRQL.)\r
+\r
+Arguments:\r
+\r
+ Interrupt - Handle to a Framework interrupt object.\r
+\r
+ AssociatedDevice - Handle to a Framework device object.\r
+\r
+Return Value:\r
+\r
+ STATUS_SUCCESS - indicates success.\r
+\r
+--*/\r
+\r
+NTSTATUS\r
+HcaEvtInterruptDisable(\r
+ IN WDFINTERRUPT Interrupt,\r
+ IN WDFDEVICE AssociatedDevice )\r
+{\r
+ PFDO_DATA fdoData;\r
+ UNREFERENCED_PARAMETER(Interrupt);\r
+\r
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_PNP, "--> %s()\n", __FUNCTION__);\r
+\r
+ fdoData = FdoGetData(AssociatedDevice);\r
+\r
+// NICDisableInterrupt(fdoData);\r
+\r
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_PNP, "<-- %s()\n", __FUNCTION__);\r
+\r
+ return STATUS_SUCCESS;\r
+}\r
+\r