+++ /dev/null
-TARGETNAME=ibiou\r
-TARGETPATH=..\..\..\bin\kernel\obj$(BUILD_ALT_DIR)\r
-TARGETTYPE=DRIVER\r
-\r
-KMDF_VERSION_MAJOR=1\r
-\r
-INF_NAME=ibiou\r
-\r
-NTTARGETFILES=$(OBJ_PATH)\$(O)\$(INF_NAME).inf\r
-\r
-MISCFILES=$(NTTARGETFILES)\r
-\r
-!if $(FREEBUILD)\r
-ENABLE_EVENT_TRACING=1\r
-!else\r
-#ENABLE_EVENT_TRACING=1\r
-!endif\r
-\r
-\r
-SOURCES= ibiou.rc \\r
- iou_driver.c \\r
- iou_pnp.c \\r
- iou_ioc_mgr.c\r
-\r
-INCLUDES=$(INCLUDES);..\..\..\inc;..\..\..\inc\kernel;\r
-\r
-C_DEFINES=$(C_DEFINES) -DDRIVER -DDEPRECATE_DDK_FUNCTIONS -DNEED_CL_OBJ -DWPP_OLDCC\r
-\r
-\r
-TARGETLIBS= \\r
- $(TARGETPATH)\*\complib.lib \\r
- $(DDK_LIB_PATH)\ntstrsafe.lib\r
- \r
-!if !defined(DDK_TARGET_OS) || "$(DDK_TARGET_OS)"=="Win2K"\r
-#\r
-# The driver is built in the Win2K build environment\r
-# - use the library version of safe strings \r
-#\r
-TARGETLIBS= $(TARGETLIBS) $(DDK_LIB_PATH)\ntstrsafe.lib\r
-!endif\r
-\r
-!IFDEF ENABLE_EVENT_TRACING\r
-\r
-C_DEFINES = $(C_DEFINES) -DEVENT_TRACING\r
-\r
-RUN_WPP = $(SOURCES) -km -ext: .c .h .C .H \\r
- -scan:iou_driver.h \\r
- -func:IOU_PRINT(LEVEL,FLAGS,(MSG,...)) \\r
- -func:IOU_PRINT_EXIT(LEVEL,FLAGS,(MSG,...)) \r
-\r
-!ENDIF\r
-\r
-!IFDEF ENABLE_EVENT_TRACING\r
-\r
-C_DEFINES = $(C_DEFINES) -DEVENT_TRACING\r
-\r
-RUN_WPP = $(SOURCES) -km -ext: .c .h .C .H \r
-\r
-!ENDIF\r
-\r
-\r
-MSC_WARNING_LEVEL= /W4\r
-\r
+++ /dev/null
-\r
-4-4-08\r
-\r
-IoDevControl == ioctl() interfces (al_dev()??
\ No newline at end of file
+++ /dev/null
-; OpenIB InfiniBand Bus Driver.\r
-; Copyright 2005 SilverStorm Technologies all Rights Reserved.\r
-; Copyright 2006 Mellanox Technologies all Rights Reserved.\r
-;\r
-; install: devcon update ib_bus.inf PCI\VEN_15B3\r
-; remove: devcon remove PCI\VEN_15B3\r
-;\r
-\r
-[Version]\r
-Signature="$WINDOWS NT$"\r
-Class = InfiniBandHca\r
-ClassGUID = {58517E00-D3CF-40c9-A679-CEE5752F4491}\r
-\r
-Provider=%OPENIB%\r
-DriverVer=03/26/2008,1.0.0000.955\r
-CatalogFile=ib_bus.cat\r
-\r
-; ================= Device Install section =====================\r
-\r
-; 64-bit platforms also copy 32-bit user-mode binaries.\r
-[DestinationDirs]\r
-DefaultDestDir=%DIRID_DRIVERS%\r
-Ibbus.UMCopyFiles=%DIRID_SYSTEM%\r
-Ibbus.WOW64CopyFiles=%DIRID_SYSTEM_X86%\r
-\r
-[SourceDisksNames.x86]\r
-1=%DiskId%,,,""\r
-\r
-[SourceDisksNames.amd64]\r
-1=%DiskId%,,,""\r
-\r
-[SourceDisksNames.ia64]\r
-1=%DiskId%,,,""\r
-\r
-[SourceDisksFiles.x86]\r
-ibbus.sys=1\r
-ibiou.sys=1\r
-ibal.dll=1\r
-complib.dll=1\r
-ibald.dll=1\r
-complibd.dll=1\r
-\r
-[SourceDisksFiles.amd64]\r
-ibbus.sys=1\r
-ibiou.sys=1\r
-ibal.dll=1\r
-complib.dll=1\r
-ibald.dll=1\r
-complibd.dll=1\r
-cl32d.dll=1\r
-cl32.dll=1\r
-ibal32d.dll=1\r
-ibal32.dll=1\r
-\r
-[SourceDisksFiles.ia64]\r
-ibbus.sys=1\r
-ibiou.sys=1\r
-ibal.dll=1\r
-complib.dll=1\r
-ibald.dll=1\r
-complibd.dll=1\r
-cl32d.dll=1\r
-cl32.dll=1\r
-ibal32d.dll=1\r
-ibal32.dll=1\r
-\r
-[Manufacturer]\r
-%OPENIB% = Ibbus.DeviceSection,ntx86,ntamd64,ntia64\r
-%SST% = SST.DeviceSection,ntx86,ntamd64,ntia64\r
-\r
-[Ibbus.DeviceSection]\r
-; empty since we don't support W9x/Me\r
-\r
-[Ibbus.DeviceSection.ntx86]\r
-%Ibbus.DeviceDesc% = Ibbus.DDInstall,{94f41ced-78eb-407c-b5df-958040af0fd8}\r
-%Iou.DeviceDesc% = Iou.DDInstall,IBA\IB_IOU\r
-\r
-[Ibbus.DeviceSection.ntamd64]\r
-%Ibbus.DeviceDesc% = Ibbus.DDInstall,{94f41ced-78eb-407c-b5df-958040af0fd8}\r
-%Iou.DeviceDesc% = Iou.DDInstall,IBA\IB_IOU\r
-\r
-[Ibbus.DeviceSection.ntia64]\r
-%Ibbus.DeviceDesc% = Ibbus.DDInstall,{94f41ced-78eb-407c-b5df-958040af0fd8}\r
-%Iou.DeviceDesc% = Iou.DDInstall,IBA\IB_IOU\r
-\r
-[SST.DeviceSection]\r
-; empty since we don't support W9x/Me\r
-\r
-[SST.DeviceSection.ntx86]\r
-%VFx.DeviceDesc% = Iou.DDInstall,IBA\V00066aP0060,IBA\V00066aP0010\r
-%VEx.DeviceDesc% = Iou.DDInstall,IBA\V00066aP0058\r
-%FVIC.DeviceDesc% = Iou.DDInstall,IBA\V00066aP00dd\r
-%EVIC.DeviceDesc% = Iou.DDInstall,IBA\V00066aP00de\r
-%BC2FC.DeviceDesc% = Iou.DDInstall,IBA\V00066aP00e0\r
-%BC2GE.DeviceDesc% = Iou.DDInstall,IBA\V00066aP00e1\r
-\r
-[SST.DeviceSection.ntamd64]\r
-%VFx.DeviceDesc% = Iou.DDInstall,IBA\V00066aP0060,IBA\V00066aP0010\r
-%VEx.DeviceDesc% = Iou.DDInstall,IBA\V00066aP0058\r
-%FVIC.DeviceDesc% = Iou.DDInstall,IBA\V00066aP00dd\r
-%EVIC.DeviceDesc% = Iou.DDInstall,IBA\V00066aP00de\r
-%BC2FC.DeviceDesc% = Iou.DDInstall,IBA\V00066aP00e0\r
-%BC2GE.DeviceDesc% = Iou.DDInstall,IBA\V00066aP00e1\r
-\r
-[SST.DeviceSection.ntia64]\r
-%VFx.DeviceDesc% = Iou.DDInstall,IBA\V00066aP0060,IBA\V00066aP0010\r
-%VEx.DeviceDesc% = Iou.DDInstall,IBA\V00066aP0058\r
-%FVIC.DeviceDesc% = Iou.DDInstall,IBA\V00066aP00dd\r
-%EVIC.DeviceDesc% = Iou.DDInstall,IBA\V00066aP00de\r
-%BC2FC.DeviceDesc% = Iou.DDInstall,IBA\V00066aP00e0\r
-%BC2GE.DeviceDesc% = Iou.DDInstall,IBA\V00066aP00e1\r
-\r
-[Ibbus.DDInstall.ntx86]\r
-CopyFiles = Ibbus.CopyFiles\r
-CopyFiles = Ibbus.UMCopyFiles\r
-\r
-[Ibbus.DDInstall.ntamd64]\r
-CopyFiles = Ibbus.CopyFiles\r
-CopyFiles = Ibbus.UMCopyFiles\r
-CopyFiles = Ibbus.WOW64CopyFiles\r
-\r
-[Ibbus.DDInstall.ntia64]\r
-CopyFiles = Ibbus.CopyFiles\r
-CopyFiles = Ibbus.UMCopyFiles\r
-CopyFiles = Ibbus.WOW64CopyFiles\r
-\r
-[Ibbus.DDInstall.ntx86.Services]\r
-AddService = ibbus,%SPSVCINST_ASSOCSERVICE%,Ibbus.ServiceInstall\r
-\r
-[Ibbus.DDInstall.ntamd64.Services]\r
-AddService = ibbus,%SPSVCINST_ASSOCSERVICE%,Ibbus.ServiceInstall\r
-\r
-[Ibbus.DDInstall.ntia64.Services]\r
-AddService = ibbus,%SPSVCINST_ASSOCSERVICE%,Ibbus.ServiceInstall\r
-\r
-[Iou.DDInstall.nt]\r
-CopyFiles = Iou.CopyFiles\r
-\r
-[Iou.DDInstall.nt.Services]\r
-AddService = ibiou,%SPSVCINST_ASSOCSERVICE%,Iou.ServiceInstall\r
-\r
-[Ibbus.CopyFiles]\r
-ibbus.sys\r
-\r
-[Ibbus.UMCopyFiles]\r
-complib.dll,,,2\r
-ibal.dll,,,2\r
-complibd.dll,,,2\r
-ibald.dll,,,2\r
-\r
-[Ibbus.WOW64CopyFiles]\r
-complib.dll,cl32.dll,,2\r
-ibal.dll,ibal32.dll,,2\r
-complibd.dll,cl32d.dll,,2\r
-ibald.dll,ibal32d.dll,,2\r
-\r
-[Iou.CopyFiles]\r
-ibiou.sys\r
-\r
-;\r
-; ============= Service Install section ==============\r
-;\r
-\r
-[Ibbus.ServiceInstall]\r
-DisplayName = %Ibbus.ServiceDesc%\r
-ServiceType = %SERVICE_KERNEL_DRIVER%\r
-StartType = %SERVICE_DEMAND_START%\r
-ErrorControl = %SERVICE_ERROR_NORMAL%\r
-ServiceBinary = %12%\ibbus.sys\r
-LoadOrderGroup = extended base\r
-AddReg = Ibbus.ParamsReg\r
-Dependencies = mthca\r
-\r
-[Iou.ServiceInstall]\r
-DisplayName = %Iou.ServiceDesc%\r
-ServiceType = %SERVICE_KERNEL_DRIVER%\r
-StartType = %SERVICE_DEMAND_START%\r
-ErrorControl = %SERVICE_ERROR_NORMAL%\r
-ServiceBinary = %12%\ibiou.sys\r
-AddReg = Iou.ParamsReg\r
-\r
-[Ibbus.ParamsReg]\r
-HKR,"Parameters","DebugFlags",%REG_DWORD%,0x80000000\r
-HKR,"Parameters","ReportPortNIC",%REG_DWORD%,1\r
-HKR,"Parameters","IbalDebugLevel",%REG_DWORD%,2\r
-HKR,"Parameters","IbalDebugFlags",%REG_DWORD%,0x00ffffff\r
-HKR,"Parameters","SmiPollInterval",%REG_DWORD_NO_CLOBBER%,20000\r
-HKR,"Parameters","IocQueryTimeout",%REG_DWORD_NO_CLOBBER%,250\r
-HKR,"Parameters","IocQueryRetries",%REG_DWORD_NO_CLOBBER%,4\r
-HKR,"Parameters","IocPollInterval",%REG_DWORD_NO_CLOBBER%,30000\r
-\r
-[Iou.ParamsReg]\r
-HKR,"Parameters","DebugLevel",%REG_DWORD%,2\r
-HKR,"Parameters","DebugFlags",%REG_DWORD%,0x00ffffff\r
-\r
-;-------------- WDF Coinstaller installation\r
-\r
-[DestinationDirs]\r
-Ibbus.DDInstall.CoInstaller_CopyFiles = 11\r
-\r
-[Ibbus.DDInstall.NT.CoInstallers]\r
-AddReg=Ibbus.DDInstall.CoInstaller_AddReg\r
-CopyFiles=Ibbus.DDInstall.CoInstaller_CopyFiles\r
-\r
-[Ibbus.DDInstall.CoInstaller_CopyFiles]\r
-WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll\r
-\r
-[SourceDisksFiles.amd64]\r
-WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1\r
-\r
-[Ibbus.DDInstall.CoInstaller_AddReg]\r
-HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller"\r
-\r
-[Ibbus.DDInstall.NT.Wdf]\r
-KmdfService = ibbus, ibbus_wdfsect\r
-[ibbus_wdfsect]\r
-KmdfLibraryVersion = $KMDFVERSION$\r
-\r
-\r
-[Strings]\r
-OPENIB = "OpenIB Alliance"\r
-SST = "SilverStorm Technologies"\r
-Ibbus.DeviceDesc = "InfiniBand Fabric"\r
-VFx.DeviceDesc = "SilverStorm VFx"\r
-VEx.DeviceDesc = "SilverStorm VEx"\r
-FVIC.DeviceDesc = "SilverStorm FVIC"\r
-EVIC.DeviceDesc = "SilverStorm EVIC"\r
-BC2FC.DeviceDesc = "QLogic InfiniBand Fibre Channel Bridge Module"\r
-BC2GE.DeviceDesc = "QLogic InfiniBand Ethernet Bridge Module"\r
-\r
-Iou.DeviceDesc = "InfiniBand I/O Unit"\r
-Ibbus.ServiceDesc = "OpenIB InfiniBand Bus Driver"\r
-Ibal.ServiceDesc = "OpenIB InfiniBand Access Layer"\r
-Iou.ServiceDesc = "OpenIB InfiniBand I/O Unit Driver"\r
-DiskId = "OpenIB InfiniBand Access Layer installation disk"\r
-SPSVCINST_NULL = 0x0\r
-SPSVCINST_ASSOCSERVICE = 0x00000002\r
-SERVICE_KERNEL_DRIVER = 1\r
-SERVICE_DEMAND_START = 3\r
-SERVICE_ERROR_NORMAL = 1\r
-REG_DWORD = 0x00010001\r
-REG_DWORD_NO_CLOBBER = 0x00010003\r
-DIRID_SYSTEM = 11\r
-DIRID_DRIVERS = 12\r
-DIRID_SYSTEM_X86 = 16425\r
+++ /dev/null
-/*\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
- * Redistribution and use in source and binary forms, with or\r
- * without modification, are permitted provided that the following\r
- * conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer.\r
- *\r
- * - Redistributions in binary form must reproduce the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer in the documentation and/or other materials\r
- * provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id: ibiou.rc 474 2006-08-31 08:57:19Z sleybo $\r
- */\r
-\r
-\r
-#include <oib_ver.h>\r
-\r
-#define VER_FILETYPE VFT_DRV\r
-#define VER_FILESUBTYPE VFT2_DRV_SYSTEM\r
-\r
-#ifdef _DEBUG_\r
-#define VER_FILEDESCRIPTION_STR "InfiniBand I/O Unit Driver [KMDF] (Debug)"\r
-#else\r
-#define VER_FILEDESCRIPTION_STR "InfiniBand I/O Unit Driver [KMDF]"\r
-#endif\r
-\r
-#define VER_INTERNALNAME_STR "ibiou.sys"\r
-#define VER_ORIGINALFILENAME_STR "ibiou.sys"\r
-\r
-#include <common.ver>\r
+++ /dev/null
-/*\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
- * Redistribution and use in source and binary forms, with or\r
- * without modification, are permitted provided that the following\r
- * conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer.\r
- *\r
- * - Redistributions in binary form must reproduce the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer in the documentation and/or other materials\r
- * provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id: iou_driver.c 496 2006-09-19 23:06:05Z ftillier $\r
- */\r
-\r
-/*\r
- * Provides the driver entry points for the InfiniBand I/O Unit Bus Driver.\r
- */\r
-\r
-#include <complib/cl_types.h>\r
-#include "iou_driver.h"\r
-\r
-#if defined(EVENT_TRACING)\r
-#ifdef offsetof\r
-#undef offsetof\r
-#endif\r
-#include "iou_driver.tmh"\r
-#endif\r
-\r
-#include "iou_pnp.h"\r
-#include <complib/cl_init.h>\r
-\r
-\r
-iou_globals_t iou_globals = {\r
- NULL,\r
- NULL\r
-};\r
-\r
-uint32_t g_iou_dbg_level = TRACE_LEVEL_ERROR;\r
-uint32_t g_iou_dbg_flags = ~0U;\r
-\r
-static NTSTATUS\r
-__read_registry(\r
- IN UNICODE_STRING* const p_Param_Path );\r
-\r
-static NTSTATUS\r
-iou_drv_open(\r
- IN DEVICE_OBJECT *p_dev_obj,\r
- IN IRP *p_irp );\r
-\r
-static NTSTATUS\r
-iou_drv_close(\r
- IN DEVICE_OBJECT *p_dev_obj,\r
- IN IRP *p_irp );\r
-\r
-#if 0\r
-static NTSTATUS\r
-iou_drv_ioctl(\r
- IN DEVICE_OBJECT *p_dev_obj,\r
- IN IRP *p_irp );\r
-#endif\r
-\r
-/***f* InfiniBand Bus Driver/iou_sysctl\r
-* NAME\r
-* iou_sysctl\r
-*\r
-* DESCRIPTION\r
-* Entry point for handling WMI IRPs.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static NTSTATUS\r
-iou_sysctl(\r
- IN DEVICE_OBJECT *p_dev_obj,\r
- IN IRP *p_irp );\r
-/**********/\r
-\r
-static void\r
-iou_unload(\r
- IN WDFDRIVER Driver );\r
-\r
-NTSTATUS\r
-DriverEntry(\r
- IN DRIVER_OBJECT *p_driver_obj,\r
- IN UNICODE_STRING *p_registry_path );\r
-\r
-#ifdef ALLOC_PRAGMA\r
-#pragma alloc_text (INIT, DriverEntry)\r
-#pragma alloc_text (INIT, __read_registry)\r
-#pragma alloc_text (PAGE, iou_unload)\r
-#pragma alloc_text (PAGE, iou_drv_open)\r
-#pragma alloc_text (PAGE, iou_drv_close)\r
-//#pragma alloc_text (PAGE, iou_drv_ioctl)\r
-#pragma alloc_text (PAGE_PNP, iou_sysctl)\r
-#endif\r
-\r
-\r
-static NTSTATUS\r
-__read_registry(\r
- IN UNICODE_STRING* const p_registry_path )\r
-{\r
- NTSTATUS status;\r
- /* Remember the terminating entry in the table below. */\r
- RTL_QUERY_REGISTRY_TABLE table[3];\r
- UNICODE_STRING param_path;\r
-\r
- IOU_ENTER( IOU_DBG_DRV );\r
-\r
- RtlInitUnicodeString( ¶m_path, NULL );\r
- param_path.MaximumLength = p_registry_path->Length + \r
- sizeof(L"\\Parameters");\r
- param_path.Buffer = cl_zalloc( param_path.MaximumLength );\r
- if( !param_path.Buffer )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR,IOU_DBG_ERROR,\r
- ("Failed to allocate parameters path buffer.\n") );\r
- return STATUS_INSUFFICIENT_RESOURCES;\r
- }\r
-\r
- RtlAppendUnicodeStringToString( ¶m_path, p_registry_path );\r
- RtlAppendUnicodeToString( ¶m_path, L"\\Parameters" );\r
-\r
- /*\r
- * Clear the table. This clears all the query callback pointers,\r
- * and sets up the terminating table entry.\r
- */\r
- cl_memclr( table, sizeof(table) );\r
-\r
- /* Setup the table entries. */\r
- table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
- table[0].Name = L"DebugLevel";\r
- table[0].EntryContext = &g_iou_dbg_level;\r
- table[0].DefaultType = REG_DWORD;\r
- table[0].DefaultData = &g_iou_dbg_level;\r
- table[0].DefaultLength = sizeof(ULONG);\r
-\r
- table[1].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
- table[1].Name = L"DebugFlags";\r
- table[1].EntryContext = &g_iou_dbg_flags;\r
- table[1].DefaultType = REG_DWORD;\r
- table[1].DefaultData = &g_iou_dbg_flags;\r
- table[1].DefaultLength = sizeof(ULONG);\r
- /* Have at it! */\r
- status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE,\r
- param_path.Buffer, table, NULL, NULL );\r
-\r
-#ifndef EVENT_TRACING\r
- if( g_iou_dbg_flags & IOU_DBG_ERR )\r
- g_iou_dbg_flags |= CL_DBG_ERROR;\r
-#endif\r
-\r
- IOU_PRINT( TRACE_LEVEL_INFORMATION, IOU_DBG_DRV,\r
- ("debug level %d debug flags 0x%.8x\n",\r
- g_iou_dbg_level,\r
- g_iou_dbg_flags) );\r
-\r
- cl_free( param_path.Buffer );\r
- IOU_EXIT( IOU_DBG_DRV );\r
- return status;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-iou_sysctl(\r
- IN DEVICE_OBJECT *p_dev_obj,\r
- IN IRP *p_irp )\r
-{\r
- NTSTATUS status;\r
- cl_pnp_po_ext_t *p_ext;\r
-\r
- IOU_ENTER( IOU_DBG_DRV );\r
-\r
- CL_ASSERT( p_dev_obj );\r
- CL_ASSERT( p_irp );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
-\r
- if( p_ext->p_next_do )\r
- {\r
- IoSkipCurrentIrpStackLocation( p_irp );\r
- status = IoCallDriver( p_ext->p_next_do, p_irp );\r
- }\r
- else\r
- {\r
- status = p_irp->IoStatus.Status;\r
- IoCompleteRequest( p_irp, IO_NO_INCREMENT );\r
- }\r
-\r
- IOU_EXIT( IOU_DBG_DRV );\r
- return status;\r
-}\r
-\r
-\r
-static void\r
-iou_unload( IN WDFDRIVER Driver )\r
-{\r
- IOU_ENTER( IOU_DBG_DRV );\r
-\r
- PAGED_CODE();\r
-\r
-#if defined(EVENT_TRACING)\r
- WPP_CLEANUP( WdfDriverWdmGetDriverObject(Driver) );\r
-#else\r
- UNREFERENCED_PARAMETER( Driver );\r
-#endif\r
-\r
- CL_DEINIT;\r
-\r
- iou_globals.WdfDriver = NULL;\r
- iou_globals.p_driver_obj = NULL;\r
-\r
- IOU_EXIT( IOU_DBG_DRV );\r
-}\r
-\r
-\r
-NTSTATUS\r
-DriverEntry(\r
- IN DRIVER_OBJECT *p_driver_obj,\r
- IN UNICODE_STRING *p_registry_path )\r
-{\r
- NTSTATUS status;\r
- WDF_DRIVER_CONFIG config;\r
-\r
- IOU_ENTER( IOU_DBG_DRV );\r
-\r
- KdPrint(("InfiniBand Fabric I/O Unit Driver [KMDF]\n"));\r
- KdPrint(("Built %s %s\n", __DATE__, __TIME__));\r
-\r
-#if defined(EVENT_TRACING)\r
- WPP_INIT_TRACING( p_drv_obj, p_registry_path );\r
-#endif\r
-\r
- status = CL_INIT;\r
- if( !NT_SUCCESS(status) )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("cl_init returned %08X.\n", status) );\r
- return status;\r
- }\r
-\r
- /* Store the driver object pointer in the global parameters. */\r
- iou_globals.p_driver_obj = p_driver_obj;\r
-\r
- /* Get the registry values. */\r
- status = __read_registry( p_registry_path );\r
- if( !NT_SUCCESS(status) )\r
- {\r
- CL_DEINIT;\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("__read_registry returned %08x.\n", status) );\r
- return status;\r
- }\r
-\r
-#if 0\r
- /* Setup the entry points. */\r
- p_driver_obj->MajorFunction[IRP_MJ_PNP] = cl_pnp;\r
- p_driver_obj->MajorFunction[IRP_MJ_POWER] = cl_power;\r
- p_driver_obj->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = iou_sysctl;\r
- p_driver_obj->DriverUnload = iou_unload;\r
- p_driver_obj->DriverExtension->AddDevice = iou_add_device;\r
-#endif\r
-\r
- // Initiialize driver config to control the attributes that\r
- // are global to the driver. Note that framework by default\r
- // provides a driver unload routine. If you create any resources\r
- // in the DriverEntry and want to be cleaned in driver unload,\r
- // you can override that by specifing one in the Config structure.\r
-\r
- WDF_DRIVER_CONFIG_INIT( &config, iou_add_device );\r
-\r
- config.EvtDriverUnload = iou_unload;\r
-\r
- // Create a framework driver object to represent our driver.\r
- status = WdfDriverCreate(p_driver_obj,\r
- p_registry_path,\r
- WDF_NO_OBJECT_ATTRIBUTES,\r
- &config,\r
- &iou_globals.WdfDriver);\r
-\r
- if (!NT_SUCCESS(status)) {\r
- KdPrint( ("WdfDriverCreate failed with status 0x%x\n", status));\r
- }\r
-\r
- KdPrint(("%s() status 0x%x\n",__FUNCTION__,status));\r
- IOU_EXIT( IOU_DBG_DRV );\r
-\r
- return status;\r
-}\r
+++ /dev/null
-/*\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
- * Redistribution and use in source and binary forms, with or\r
- * without modification, are permitted provided that the following\r
- * conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer.\r
- *\r
- * - Redistributions in binary form must reproduce the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer in the documentation and/or other materials\r
- * provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id: iou_driver.h 550 2006-11-28 07:27:28Z sleybo $\r
- */\r
-\r
-\r
-\r
-#if !defined _IOU_DRIVER_H_\r
-#define _IOU_DRIVER_H_\r
-\r
-#include <ntddk.h>\r
-#include <wdf.h>\r
-#include <ntintsafe.h>\r
-\r
-#include "complib/cl_types.h"\r
-#include "complib/cl_atomic.h"\r
-#include "complib/cl_debug.h"\r
-#include "complib/cl_mutex.h"\r
-#include "complib/cl_qlist.h"\r
-#include "complib/cl_ptr_vector.h"\r
-#include "complib/cl_pnp_po.h"\r
-\r
-#include "iba/ib_al.h"\r
-#include "iou_ioc_mgr.h"\r
-\r
-/* Safe string functions. */\r
-#if WINVER == 0x500\r
-/*\r
- * Windows 2000 doesn't support the inline version of safe strings.\r
- * Force the use of the library version of safe strings.\r
- */\r
-#define NTSTRSAFE_LIB\r
-#endif\r
-#include <ntstrsafe.h>\r
-\r
-extern uint32_t g_iou_dbg_level;\r
-extern uint32_t g_iou_dbg_flags;\r
-\r
-#if defined(EVENT_TRACING)\r
-//\r
-// Software Tracing Definitions \r
-//\r
-\r
-#define WPP_CONTROL_GUIDS \\r
- WPP_DEFINE_CONTROL_GUID(IOUCtlGuid,(A0090FEF,01BB,4617,AF1E,FD02FD5B24ED), \\r
- WPP_DEFINE_BIT( IOU_DBG_ERROR) \\r
- WPP_DEFINE_BIT( IOU_DBG_DRV) \\r
- WPP_DEFINE_BIT( IOU_DBG_PNP) \\r
- WPP_DEFINE_BIT( IOU_DBG_POWER) \\r
- WPP_DEFINE_BIT( IOU_DBG_PORT) \\r
- WPP_DEFINE_BIT( IOU_DBG_IOU))\r
-\r
-\r
-\r
-#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)\r
-#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) WPP_LEVEL_LOGGER(flags)\r
-#define WPP_FLAG_ENABLED(flags)(WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= TRACE_LEVEL_VERBOSE)\r
-#define WPP_FLAG_LOGGER(flags) WPP_LEVEL_LOGGER(flags)\r
-\r
-\r
-// begin_wpp config\r
-// IOU_ENTER(FLAG);\r
-// IOU_EXIT(FLAG);\r
-// USEPREFIX(IOU_PRINT, "%!STDPREFIX! [IOU] :%!FUNC!() :");\r
-// USESUFFIX(IOU_ENTER, " [IOU] :%!FUNC!():[");\r
-// USESUFFIX(IOU_EXIT, " [IOU] :%!FUNC!():]");\r
-// end_wpp\r
-\r
-\r
-#else\r
-\r
-\r
-#include <evntrace.h>\r
-\r
-/*\r
- * Debug macros\r
- */\r
-\r
-#define IOU_DBG_ERR (1 << 0)\r
-#define IOU_DBG_DRV (1 << 1)\r
-#define IOU_DBG_PNP (1 << 2)\r
-#define IOU_DBG_POWER (1 << 3)\r
-#define IOU_DBG_PORT (1 << 4)\r
-#define IOU_DBG_IOU (1 << 5)\r
-\r
-#define IOU_DBG_ERROR (CL_DBG_ERROR | IOU_DBG_ERR)\r
-#define IOU_DBG_ALL CL_DBG_ALL\r
-\r
-#if DBG\r
-\r
-// assignment of _level_ is need to to overcome warning C4127\r
-#define IOU_PRINT(_level_,_flag_,_msg_) \\r
- { \\r
- if( g_iou_dbg_level >= (_level_) ) \\r
- CL_TRACE( _flag_, g_iou_dbg_flags, _msg_ ); \\r
- }\r
-\r
-#define IOU_PRINT_EXIT(_level_,_flag_,_msg_) \\r
- { \\r
- if( g_iou_dbg_level >= (_level_) ) \\r
- CL_TRACE( _flag_, g_iou_dbg_flags, _msg_ );\\r
- IOU_EXIT(_flag_);\\r
- }\r
-\r
-#define IOU_ENTER(_flag_) \\r
- { \\r
- if( g_iou_dbg_level >= TRACE_LEVEL_VERBOSE ) \\r
- CL_ENTER( _flag_, g_iou_dbg_flags ); \\r
- }\r
-\r
-#define IOU_EXIT(_flag_)\\r
- { \\r
- if( g_iou_dbg_level >= TRACE_LEVEL_VERBOSE ) \\r
- CL_EXIT( _flag_, g_iou_dbg_flags ); \\r
- }\r
-\r
-\r
-#else\r
-\r
-#define IOU_PRINT(lvl, flags, msg)\r
-\r
-#define IOU_PRINT_EXIT(_level_,_flag_,_msg_)\r
-\r
-#define IOU_ENTER(_flag_)\r
-\r
-#define IOU_EXIT(_flag_)\r
-\r
-\r
-#endif\r
-\r
-\r
-#endif //EVENT_TRACING\r
-\r
-/*\r
- * ALLOC_PRAGMA sections:\r
- * PAGE\r
- * Default pagable code. Won't be locked in memory.\r
- *\r
- * PAGE_PNP\r
- * Code that needs to be locked in memory when the device is\r
- * in the paging, crash dump, or hibernation path.\r
- */\r
-\r
-\r
-/*\r
- * Device extension for the device object that serves as entry point for \r
- * the interface and IOCTL requests.\r
- */\r
-typedef struct _iou_fdo_ext\r
-{\r
- cl_pnp_po_ext_t cl_ext;\r
-\r
- /*\r
- * Device power map returned by the bus driver for the device, used \r
- * when sending IRP_MN_SET_POWER for device state in response to \r
- * IRP_MN_SET_POWER for system state.\r
- */\r
- DEVICE_POWER_STATE po_state[PowerSystemMaximum];\r
-\r
- ioc_mgr_t ioc_mgr;\r
-\r
-} iou_fdo_ext_t, FDO_DATA, *PFDO_DATA;\r
-\r
-WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(FDO_DATA, FdoGetData)\r
-\r
-\r
-/*\r
- * Device extension for bus driver PDOs.\r
- */\r
-typedef struct _iou_pdo_ext\r
-{\r
- cl_pnp_po_ext_t cl_ext;\r
-\r
- cl_list_item_t list_item;\r
-\r
- /* All reported PDOs are children of an HCA. */\r
- ib_ca_handle_t h_ca;\r
-\r
- /*\r
- * CA GUID copy - in case we get IRPs after the CA\r
- * handle has been released.\r
- */\r
- net64_t ca_guid;\r
- POWER_STATE dev_po_state;\r
-\r
- /*\r
- * Pointer to the bus root device extension. Used to manage access to\r
- * child PDO pointer vector when a child is removed politely.\r
- */\r
- iou_fdo_ext_t *p_parent_ext;\r
-\r
- /*\r
- * The following two flags are exclusively set, but can both be FALSE.\r
- * Flag that indicates whether the device is present in the system or not.\r
- * This affects how a IRP_MN_REMOVE_DEVICE IRP is handled for a child PDO.\r
- * This flag is cleared when:\r
- * - an HCA (for IPoIB devices) is removed from the system for all port\r
- * devices loaded for that HCA\r
- * - an IOU is reported as removed by the CIA.\r
- */\r
- boolean_t b_present;\r
-\r
- /*\r
- * Flag that indicates whether the device has been reported to the PnP\r
- * manager as having been removed. That is, the device was reported\r
- * in a previous BusRelations query and not in a subsequent one.\r
- * This flag is set when\r
- * - the device is in the surprise remove state when the parent bus\r
- * device is removed\r
- * - the device is found to be not present during a BusRelations query\r
- * and thus not reported.\r
- */\r
- boolean_t b_reported_missing;\r
-\r
-} iou_pdo_ext_t, PDO_DATA, *PPDO_DATA;\r
-\r
-WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(PDO_DATA, PdoGetData)\r
-\r
-/*\r
- * Global Driver parameters.\r
- */\r
-typedef struct _iou_globals\r
-{\r
- /* Driver object. Used for creating child devices. */\r
- DRIVER_OBJECT *p_driver_obj;\r
- WDFDRIVER WdfDriver;\r
-\r
-} iou_globals_t;\r
-\r
-\r
-extern iou_globals_t iou_globals;\r
-\r
-\r
-#endif /* !defined _IOU_DRIVER_H_ */\r
+++ /dev/null
-/*\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
- * Redistribution and use in source and binary forms, with or\r
- * without modification, are permitted provided that the following\r
- * conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer.\r
- *\r
- * - Redistributions in binary form must reproduce the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer in the documentation and/or other materials\r
- * provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id: iou_ioc_mgr.c 931 2008-01-31 09:20:41Z leonidk $\r
- */\r
-\r
-\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_async_proc.h>\r
-#include <complib/cl_bus_ifc.h>\r
-#include "iou_driver.h"\r
-#if defined(EVENT_TRACING)\r
-#ifdef offsetof\r
-#undef offsetof\r
-#endif\r
-#include "iou_ioc_mgr.tmh"\r
-#endif\r
-#include "iou_pnp.h"\r
-#include "iou_ioc_mgr.h"\r
-#include <initguid.h>\r
-#include <wdmguid.h>\r
-#include "iba/ioc_ifc.h"\r
-\r
-\r
-/* {5A9649F4-0101-4a7c-8337-796C48082DA2} */\r
-DEFINE_GUID(GUID_BUS_TYPE_IBA,\r
-0x5a9649f4, 0x101, 0x4a7c, 0x83, 0x37, 0x79, 0x6c, 0x48, 0x8, 0x2d, 0xa2);\r
-\r
-\r
-/*\r
- * Size of device descriptions, as defined in\r
- * A1.2.3.1.1 - Creating Compatibility Strings for an I/O Controller\r
- */\r
-#define IOC_DEV_ID_SIZE \\r
- sizeof(L"IBA\\VxxxxxxPxxxxxxxxSxxxxxxsxxxxxxxxvxxxx")\r
-#define IOC_HW_ID_SIZE \\r
- sizeof(L"IBA\\VxxxxxxPxxxxxxxxSxxxxxxsxxxxxxxxvxxxx") + \\r
- sizeof(L"IBA\\VxxxxxxPxxxxxxxxSxxxxxxsxxxxxxxx") + \\r
- sizeof(L"IBA\\VxxxxxxPxxxxxxxxvxxxx") + \\r
- sizeof(L"IBA\\VxxxxxxPxxxxxxxx\0\0")\r
-#define IOC_COMPAT_ID_SIZE \\r
- sizeof(L"IBA\\Cxxxxcxxxxpxxxxrxxxx") + \\r
- sizeof(L"IBA\\Cxxxxcxxxxpxxxx\0\0")\r
-#define IOC_LOCATION_SIZE \\r
- sizeof(L"Chassis 0xxxxxxxxxxxxxxxxx, Slot xx, IOC xx")\r
-\r
-/*\r
- * Device extension for IOU PDOs.\r
- */\r
-typedef struct _ioc_ext\r
-{\r
- iou_pdo_ext_t pdo;\r
-\r
- ib_ioc_info_t info;\r
- ib_svc_entry_t svc_entries[1];\r
-\r
-} ioc_ext_t;\r
-\r
-\r
-/*\r
- * Function prototypes.\r
- */\r
-void\r
-destroying_ioc_mgr(\r
- IN cl_obj_t* p_obj );\r
-\r
-void\r
-free_ioc_mgr(\r
- IN cl_obj_t* p_obj );\r
-\r
-ib_api_status_t\r
-ioc_mgr_pnp_cb(\r
- IN ib_pnp_rec_t* p_pnp_rec );\r
-\r
-ib_api_status_t\r
-ioc_mgr_ioc_add(\r
- IN ib_pnp_ioc_rec_t* p_pnp_rec );\r
-\r
-void\r
-ioc_mgr_ioc_remove(\r
- IN ib_pnp_ioc_rec_t* p_pnp_rec );\r
-\r
-static NTSTATUS\r
-ioc_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
-\r
-static void\r
-ioc_release_resources(\r
- IN DEVICE_OBJECT* const p_dev_obj );\r
-\r
-static NTSTATUS\r
-ioc_remove(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action );\r
-\r
-static NTSTATUS\r
-ioc_surprise_remove(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action );\r
-\r
-static NTSTATUS\r
-ioc_query_capabilities(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action );\r
-\r
-static NTSTATUS\r
-ioc_query_target_relations(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action );\r
-\r
-static NTSTATUS\r
-ioc_query_device_id(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp );\r
-\r
-static NTSTATUS\r
-ioc_query_hardware_ids(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp );\r
-\r
-static NTSTATUS\r
-ioc_query_compatible_ids(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp );\r
-\r
-static NTSTATUS\r
-ioc_query_unique_id(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp );\r
-\r
-static NTSTATUS\r
-ioc_query_description(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp );\r
-\r
-static NTSTATUS\r
-ioc_query_location(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp );\r
-\r
-static NTSTATUS\r
-ioc_query_bus_info(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action );\r
-\r
-static NTSTATUS\r
-ioc_query_interface(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action );\r
-\r
-static NTSTATUS\r
-ioc_set_power(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action );\r
-\r
-\r
-/* All PnP code is called at passive, so it can all be paged out. */\r
-#ifdef ALLOC_PRAGMA\r
-#pragma alloc_text (PAGE, ioc_start)\r
-#pragma alloc_text (PAGE, ioc_release_resources)\r
-#pragma alloc_text (PAGE, ioc_remove)\r
-#pragma alloc_text (PAGE, ioc_surprise_remove)\r
-#pragma alloc_text (PAGE, ioc_query_capabilities)\r
-#pragma alloc_text (PAGE, ioc_query_target_relations)\r
-#pragma alloc_text (PAGE, ioc_query_device_id)\r
-#pragma alloc_text (PAGE, ioc_query_hardware_ids)\r
-#pragma alloc_text (PAGE, ioc_query_compatible_ids)\r
-#pragma alloc_text (PAGE, ioc_query_unique_id)\r
-#pragma alloc_text (PAGE, ioc_query_description)\r
-#pragma alloc_text (PAGE, ioc_query_location)\r
-#pragma alloc_text (PAGE, ioc_query_bus_info)\r
-#pragma alloc_text (PAGE, ioc_query_interface)\r
-#pragma alloc_text (PAGE_PNP, ioc_set_power)\r
-#pragma alloc_text (PAGE, ioc_mgr_ioc_add)\r
-#pragma alloc_text (PAGE, ioc_mgr_ioc_remove)\r
-#endif\r
-\r
-\r
-/*\r
- * Global virtual function pointer tables shared between all\r
- * instances of Port PDOs.\r
- */\r
-static const cl_vfptr_pnp_po_t vfptr_ioc_pnp = {\r
- "IB IOC",\r
- ioc_start,\r
- cl_irp_succeed,\r
- cl_irp_succeed,\r
- cl_irp_succeed,\r
- cl_irp_succeed,\r
- ioc_release_resources,\r
- ioc_remove,\r
- cl_irp_succeed,\r
- ioc_surprise_remove,\r
- ioc_query_capabilities,\r
- cl_irp_complete,\r
- cl_irp_complete,\r
- cl_irp_succeed,\r
- cl_irp_complete,\r
- cl_irp_complete,\r
- cl_irp_complete,\r
- ioc_query_target_relations,\r
- cl_irp_complete,\r
- cl_irp_complete,\r
- cl_irp_complete,\r
- ioc_query_bus_info,\r
- ioc_query_interface,\r
- cl_irp_complete,\r
- cl_irp_complete,\r
- cl_irp_complete,\r
- cl_irp_complete,\r
- cl_irp_succeed, // QueryPower\r
- ioc_set_power, // SetPower\r
- cl_irp_unsupported, // PowerSequence\r
- cl_irp_unsupported // WaitWake\r
-};\r
-\r
-\r
-static const cl_vfptr_query_txt_t vfptr_iou_query_txt = {\r
- ioc_query_device_id,\r
- ioc_query_hardware_ids,\r
- ioc_query_compatible_ids,\r
- ioc_query_unique_id,\r
- ioc_query_description,\r
- ioc_query_location\r
-};\r
-\r
-\r
-void\r
-ioc_mgr_construct(\r
- IN OUT ioc_mgr_t* const p_ioc_mgr )\r
-{\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- /* Construct the IOC manager service. */\r
- cl_obj_construct( &p_ioc_mgr->obj, 0 );\r
- cl_mutex_construct( &p_ioc_mgr->pdo_mutex );\r
- cl_qlist_init( &p_ioc_mgr->ioc_list );\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
-}\r
-\r
-\r
-ib_api_status_t\r
-ioc_mgr_init(\r
- IN OUT ioc_mgr_t* const p_ioc_mgr )\r
-{\r
- ib_pnp_req_t pnp_req;\r
- ib_api_status_t status;\r
- cl_status_t cl_status;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- cl_status = cl_mutex_init( &p_ioc_mgr->pdo_mutex );\r
- if( cl_status != CL_SUCCESS )\r
- {\r
- free_ioc_mgr( &p_ioc_mgr->obj );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("cl_mutex_init returned %#x.\n", cl_status) );\r
- return IB_ERROR;\r
- }\r
-\r
- /* Initialize the load service object. */\r
- cl_status = cl_obj_init( &p_ioc_mgr->obj, CL_DESTROY_SYNC,\r
- destroying_ioc_mgr, NULL, free_ioc_mgr );\r
- if( cl_status != CL_SUCCESS )\r
- {\r
- free_ioc_mgr( &p_ioc_mgr->obj );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("cl_obj_init returned %#x.\n", cl_status) );\r
- return IB_ERROR;\r
- }\r
-\r
- status = p_ioc_mgr->ifc.open_al( &p_ioc_mgr->h_al );\r
- if( status != IB_SUCCESS )\r
- {\r
- cl_obj_destroy( &p_ioc_mgr->obj );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("open_al returned %s.\n",\r
- p_ioc_mgr->ifc.get_err_str(status)) );\r
- return status;\r
- }\r
-\r
- /* Register for IOC PnP events. */\r
- cl_memclr( &pnp_req, sizeof( ib_pnp_req_t ) );\r
- pnp_req.pnp_class = IB_PNP_IOC;\r
- pnp_req.pnp_context = p_ioc_mgr;\r
- pnp_req.pfn_pnp_cb = ioc_mgr_pnp_cb;\r
-\r
- status = p_ioc_mgr->ifc.reg_pnp(\r
- p_ioc_mgr->h_al, &pnp_req, &p_ioc_mgr->h_pnp );\r
- if( status != IB_SUCCESS )\r
- {\r
- cl_obj_destroy( &p_ioc_mgr->obj );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("ib_reg_pnp returned %s.\n",\r
- p_ioc_mgr->ifc.get_err_str(status)) );\r
- return status;\r
- }\r
-\r
- /* Reference the load service on behalf of the ib_reg_pnp call. */\r
- cl_obj_ref( &p_ioc_mgr->obj );\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return IB_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * Pre-destroy the load service.\r
- */\r
-void\r
-destroying_ioc_mgr(\r
- IN cl_obj_t* p_obj )\r
-{\r
- ioc_mgr_t *p_ioc_mgr;\r
- ib_api_status_t status;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- CL_ASSERT( p_obj );\r
-\r
- p_ioc_mgr = PARENT_STRUCT( p_obj, ioc_mgr_t, obj );\r
-\r
- /* Deregister for port PnP events. */\r
- if( p_ioc_mgr->h_pnp )\r
- {\r
- status = p_ioc_mgr->ifc.dereg_pnp(\r
- p_ioc_mgr->h_pnp, (ib_pfn_destroy_cb_t)cl_obj_deref );\r
- CL_ASSERT( status == IB_SUCCESS );\r
- }\r
- IOU_EXIT( IOU_DBG_PNP );\r
-}\r
-\r
-\r
-/*\r
- * Free the load service.\r
- */\r
-void\r
-free_ioc_mgr(\r
- IN cl_obj_t* p_obj )\r
-{\r
- ioc_mgr_t *p_ioc_mgr;\r
- ioc_ext_t *p_iou_ext;\r
- cl_list_item_t *p_list_item;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- CL_ASSERT( p_obj );\r
- p_ioc_mgr = PARENT_STRUCT( p_obj, ioc_mgr_t, obj );\r
-\r
- /*\r
- * Mark all IOCs as no longer present. This will cause them\r
- * to be removed when they process the IRP_MN_REMOVE_DEVICE.\r
- */\r
- p_list_item = cl_qlist_remove_head( &p_ioc_mgr->ioc_list );\r
- while( p_list_item != cl_qlist_end( &p_ioc_mgr->ioc_list ) )\r
- {\r
- p_iou_ext = PARENT_STRUCT(\r
- PARENT_STRUCT( p_list_item, iou_pdo_ext_t, list_item ),\r
- ioc_ext_t, pdo );\r
- p_list_item = cl_qlist_remove_head( &p_ioc_mgr->ioc_list );\r
- if( p_iou_ext->pdo.cl_ext.pnp_state == SurpriseRemoved )\r
- {\r
- CL_ASSERT( !p_iou_ext->pdo.b_present );\r
- p_iou_ext->pdo.b_reported_missing = TRUE;\r
- continue;\r
- }\r
- IoDeleteDevice( p_iou_ext->pdo.cl_ext.p_self_do );\r
- }\r
-\r
- cl_mutex_destroy( &p_ioc_mgr->pdo_mutex );\r
- cl_obj_deinit( p_obj );\r
- IOU_EXIT( IOU_DBG_PNP );\r
-}\r
-\r
-\r
-/*\r
- * Load service PnP event callback.\r
- */\r
-ib_api_status_t\r
-ioc_mgr_pnp_cb(\r
- IN ib_pnp_rec_t* p_pnp_rec )\r
-{\r
- ib_api_status_t status;\r
- ioc_mgr_t *p_ioc_mgr;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- CL_ASSERT( p_pnp_rec );\r
- p_ioc_mgr = (ioc_mgr_t* __ptr64)p_pnp_rec->pnp_context;\r
-\r
- switch( p_pnp_rec->pnp_event )\r
- {\r
- case IB_PNP_IOC_ADD:\r
- status = ioc_mgr_ioc_add( (ib_pnp_ioc_rec_t*)p_pnp_rec );\r
- break;\r
-\r
- case IB_PNP_IOC_REMOVE:\r
- ioc_mgr_ioc_remove( (ib_pnp_ioc_rec_t*)p_pnp_rec );\r
-\r
- default:\r
- status = IB_SUCCESS;\r
- break;\r
- }\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return status;\r
-}\r
-\r
-\r
-/*\r
- * Called to get child relations for the bus root.\r
- */\r
-NTSTATUS\r
-ioc_mgr_get_iou_relations(\r
- IN ioc_mgr_t* const p_ioc_mgr,\r
- IN IRP* const p_irp )\r
-{\r
- NTSTATUS status;\r
- size_t n_devs;\r
- DEVICE_RELATIONS *p_rel;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- /* If there are already relations, copy them. */\r
- cl_mutex_acquire( &p_ioc_mgr->pdo_mutex );\r
- n_devs = cl_qlist_count( &p_ioc_mgr->ioc_list );\r
- if( !n_devs )\r
- {\r
- cl_mutex_release( &p_ioc_mgr->pdo_mutex );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IOU_DBG_PNP,\r
- ("No child PDOs.\n") );\r
- return STATUS_NO_SUCH_DEVICE;\r
- }\r
-\r
- /* Add space for our child IOUs. */\r
- status = cl_alloc_relations( p_irp, n_devs );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- cl_mutex_release( &p_ioc_mgr->pdo_mutex );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("cl_alloc_relations returned %08x.\n", status) );\r
- return status;\r
- }\r
-\r
- p_rel = (DEVICE_RELATIONS*)p_irp->IoStatus.Information;\r
- update_relations( &p_ioc_mgr->ioc_list, p_rel );\r
- cl_mutex_release( &p_ioc_mgr->pdo_mutex );\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-ib_api_status_t\r
-ioc_mgr_ioc_add(\r
- IN ib_pnp_ioc_rec_t* p_pnp_rec )\r
-{\r
- NTSTATUS status;\r
- DEVICE_OBJECT *p_pdo;\r
- iou_fdo_ext_t *p_ext;\r
- ioc_mgr_t *p_ioc_mgr;\r
- ioc_ext_t *p_ioc_ext;\r
- uint32_t ext_size;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ioc_mgr = PARENT_STRUCT( p_pnp_rec->pnp_rec.pnp_context, ioc_mgr_t, obj );\r
- p_ext = PARENT_STRUCT( p_ioc_mgr, iou_fdo_ext_t, ioc_mgr );\r
-\r
- if( p_pnp_rec->ca_guid != p_ioc_mgr->info.ca_guid ||\r
- p_pnp_rec->info.chassis_guid != p_ioc_mgr->info.chassis_guid ||\r
- p_pnp_rec->info.chassis_slot != p_ioc_mgr->info.slot||\r
- p_pnp_rec->info.iou_guid != p_ioc_mgr->info.guid )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IOU_DBG_PNP,\r
- ("IOC not in this IOU.\n") );\r
- return IB_NOT_DONE;\r
- }\r
-\r
- ext_size = sizeof(ioc_ext_t) +\r
- (sizeof(ib_svc_entry_t) * p_pnp_rec->info.profile.num_svc_entries);\r
-\r
- /* Create the PDO for the new port device. */\r
- status = IoCreateDevice( iou_globals.p_driver_obj, ext_size,\r
- NULL, FILE_DEVICE_CONTROLLER,\r
- FILE_DEVICE_SECURE_OPEN | FILE_AUTOGENERATED_DEVICE_NAME,\r
- FALSE, &p_pdo );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("IoCreateDevice returned %08x.\n", status) );\r
- return IB_ERROR;\r
- }\r
-\r
- /* Initialize the device extension. */\r
- cl_init_pnp_po_ext( p_pdo, NULL, p_pdo, g_iou_dbg_flags,\r
- &vfptr_ioc_pnp, &vfptr_iou_query_txt );\r
-\r
- /* Set the DO_BUS_ENUMERATED_DEVICE flag to mark it as a PDO. */\r
- p_pdo->Flags |= DO_BUS_ENUMERATED_DEVICE;\r
-\r
- p_ioc_ext = p_pdo->DeviceExtension;\r
- p_ioc_ext->pdo.dev_po_state.DeviceState = PowerDeviceD0;\r
- p_ioc_ext->pdo.p_parent_ext = p_ext;\r
- p_ioc_ext->pdo.b_present = TRUE;\r
- p_ioc_ext->pdo.b_reported_missing = FALSE;\r
- p_ioc_ext->pdo.ca_guid = p_pnp_rec->ca_guid;\r
- \r
- /* Copy the IOC profile and service entries. */\r
- p_ioc_ext->info = p_pnp_rec->info;\r
- cl_memcpy( p_ioc_ext->svc_entries, p_pnp_rec->svc_entry_array,\r
- p_pnp_rec->info.profile.num_svc_entries );\r
- /* Make sure the IOC string is null terminated. */\r
- p_ioc_ext->info.profile.id_string[CTRL_ID_STRING_LEN-1] = '\0';\r
-\r
- /* Store the device extension in the PDO list for future queries. */\r
- cl_mutex_acquire( &p_ioc_mgr->pdo_mutex );\r
- cl_qlist_insert_tail( &p_ioc_mgr->ioc_list,\r
- &p_ioc_ext->pdo.list_item );\r
- cl_mutex_release( &p_ioc_mgr->pdo_mutex );\r
-\r
- /*\r
- * Set the context of the PNP event. The context is passed in for future\r
- * events on the same port.\r
- */\r
- p_pnp_rec->pnp_rec.context = p_ioc_ext;\r
-\r
- /* Tell the PnP Manager to rescan for bus relations. */\r
- IoInvalidateDeviceRelations( p_ext->cl_ext.p_pdo, BusRelations );\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return IB_SUCCESS;\r
-}\r
-\r
-\r
-void\r
-ioc_mgr_ioc_remove(\r
- IN ib_pnp_ioc_rec_t* p_pnp_rec )\r
-{\r
- ioc_mgr_t *p_ioc_mgr;\r
- ioc_ext_t *p_ioc_ext;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- /* The PNP record's context is the IOC's device extension. */\r
- p_ioc_ext = p_pnp_rec->pnp_rec.context;\r
- CL_ASSERT( p_ioc_ext );\r
-\r
- p_ioc_mgr = &p_ioc_ext->pdo.p_parent_ext->ioc_mgr;\r
- /*\r
- * Flag the port IOC as no longer being present. We have to wait until\r
- * the PnP manager removes it to clean up.\r
- */\r
- cl_mutex_acquire( &p_ioc_mgr->pdo_mutex );\r
- p_ioc_ext->pdo.b_present = FALSE;\r
-\r
- /* Invalidate bus relations for the bus root. */\r
- IoInvalidateDeviceRelations(\r
- p_ioc_ext->pdo.p_parent_ext->cl_ext.p_pdo, BusRelations );\r
-\r
- cl_mutex_release( &p_ioc_mgr->pdo_mutex );\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
-}\r
-\r
-\r
-static NTSTATUS\r
-ioc_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
-{\r
- iou_pdo_ext_t *p_ext;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- UNUSED_PARAM( p_irp );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
-\r
- /* Notify the Power Manager that the device is started. */\r
- PoSetPowerState( p_dev_obj, DevicePowerState, p_ext->dev_po_state );\r
-\r
- *p_action = IrpComplete;\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static void\r
-ioc_release_resources(\r
- IN DEVICE_OBJECT* const p_dev_obj )\r
-{\r
- ioc_mgr_t *p_ioc_mgr;\r
- ioc_ext_t *p_ext;\r
- POWER_STATE po_state;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
- p_ioc_mgr = &p_ext->pdo.p_parent_ext->ioc_mgr;\r
-\r
- /* Remove this PDO from its list. */\r
- cl_mutex_acquire( &p_ioc_mgr->pdo_mutex );\r
- IOU_PRINT( TRACE_LEVEL_INFORMATION, IOU_DBG_PNP,\r
- ("Removing IOC from list.\n") );\r
- cl_qlist_remove_item( &p_ioc_mgr->ioc_list, &p_ext->pdo.list_item );\r
- cl_mutex_release( &p_ioc_mgr->pdo_mutex );\r
- po_state.DeviceState = PowerDeviceD3;\r
- PoSetPowerState( p_ext->pdo.cl_ext.p_pdo, DevicePowerState, po_state );\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
-}\r
-\r
-\r
-static NTSTATUS\r
-ioc_remove(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- ioc_ext_t *p_ext;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
-\r
- if( p_ext->pdo.b_present )\r
- {\r
- CL_ASSERT( p_ext->pdo.cl_ext.pnp_state != NotStarted );\r
- CL_ASSERT( !p_ext->pdo.b_reported_missing );\r
- /* Reset the state to NotStarted. CompLib set it to Deleted. */\r
- cl_set_pnp_state( &p_ext->pdo.cl_ext, NotStarted );\r
- /* Don't delete the device. It may simply be disabled. */\r
- *p_action = IrpComplete;\r
- IOU_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IOU_DBG_PNP,\r
- ("Device still present.\n") );\r
- return STATUS_SUCCESS;\r
- }\r
-\r
- if( !p_ext->pdo.b_reported_missing )\r
- {\r
- /* Reset the state to RemovePending. Complib set it to Deleted. */\r
- cl_rollback_pnp_state( &p_ext->pdo.cl_ext );\r
- *p_action = IrpComplete;\r
- IOU_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IOU_DBG_PNP,\r
- ("Device not reported missing yet.\n") );\r
- return STATUS_SUCCESS;\r
- }\r
-\r
- /* Wait for all I/O operations to complete. */\r
- IoReleaseRemoveLockAndWait( &p_ext->pdo.cl_ext.remove_lock, p_irp );\r
-\r
- /* Release resources if it was not done yet. */\r
- if( p_ext->pdo.cl_ext.last_pnp_state != SurpriseRemoved )\r
- p_ext->pdo.cl_ext.vfptr_pnp_po->pfn_release_resources( p_dev_obj );\r
-\r
- p_irp->IoStatus.Status = STATUS_SUCCESS;\r
- IoCompleteRequest( p_irp, IO_NO_INCREMENT );\r
-\r
- IoDeleteDevice( p_dev_obj );\r
-\r
- *p_action = IrpDoNothing;\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-ioc_surprise_remove(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- ioc_ext_t *p_ext;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- UNUSED_PARAM( p_irp );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
- p_ext->pdo.b_present = FALSE;\r
- p_ext->pdo.b_reported_missing = TRUE;\r
-\r
- *p_action = IrpComplete;\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-ioc_query_capabilities(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- DEVICE_CAPABILITIES *p_caps;\r
- IO_STACK_LOCATION *p_io_stack;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- UNUSED_PARAM( p_dev_obj );\r
-\r
- p_io_stack = IoGetCurrentIrpStackLocation( p_irp );\r
- p_caps = p_io_stack->Parameters.DeviceCapabilities.Capabilities;\r
-\r
- p_caps->DeviceD1 = FALSE;\r
- p_caps->DeviceD2 = FALSE;\r
- p_caps->LockSupported = FALSE;\r
- p_caps->EjectSupported = FALSE;\r
- p_caps->Removable = TRUE;\r
- p_caps->DockDevice = FALSE;\r
- p_caps->UniqueID = TRUE;\r
- p_caps->SilentInstall = TRUE;\r
- p_caps->RawDeviceOK = FALSE;\r
- p_caps->SurpriseRemovalOK = FALSE;\r
- p_caps->WakeFromD0 = FALSE;\r
- p_caps->WakeFromD1 = FALSE;\r
- p_caps->WakeFromD2 = FALSE;\r
- p_caps->WakeFromD3 = FALSE;\r
- p_caps->HardwareDisabled = FALSE;\r
- p_caps->DeviceState[PowerSystemWorking] = PowerDeviceD0;\r
- p_caps->DeviceState[PowerSystemSleeping1] = PowerDeviceD3;\r
- p_caps->DeviceState[PowerSystemSleeping2] = PowerDeviceD3;\r
- p_caps->DeviceState[PowerSystemSleeping3] = PowerDeviceD3;\r
- p_caps->DeviceState[PowerSystemHibernate] = PowerDeviceD3;\r
- p_caps->DeviceState[PowerSystemShutdown] = PowerDeviceD3;\r
- p_caps->SystemWake = PowerSystemUnspecified;\r
- p_caps->DeviceWake = PowerDeviceUnspecified;\r
- p_caps->D1Latency = 0;\r
- p_caps->D2Latency = 0;\r
- p_caps->D3Latency = 0;\r
-\r
- *p_action = IrpComplete;\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-ioc_query_target_relations(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- NTSTATUS status;\r
- DEVICE_RELATIONS *p_rel;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- *p_action = IrpComplete;\r
-\r
- status = cl_alloc_relations( p_irp, 1 );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("cl_alloc_relations returned 0x%08x.\n", status) );\r
- return status;\r
- }\r
-\r
- p_rel = (DEVICE_RELATIONS*)p_irp->IoStatus.Information;\r
- p_rel->Count = 1;\r
- p_rel->Objects[0] = p_dev_obj;\r
-\r
- ObReferenceObject( p_dev_obj );\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return status;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-ioc_query_device_id(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- OUT IRP* const p_irp )\r
-{\r
- NTSTATUS status;\r
- ioc_ext_t *p_ext;\r
- WCHAR *p_string;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = (ioc_ext_t*)p_dev_obj->DeviceExtension;\r
- if( !p_ext->pdo.b_present )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Device not present.\n") );\r
- return STATUS_NO_SUCH_DEVICE;\r
- }\r
-\r
- p_string = ExAllocatePoolWithTag( PagedPool, IOC_DEV_ID_SIZE, 'didq' );\r
- if( !p_string )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to allocate device ID buffer (%d bytes).\n",\r
- IOC_DEV_ID_SIZE) );\r
- return STATUS_INSUFFICIENT_RESOURCES;\r
- }\r
-\r
- status = RtlStringCbPrintfW( p_string, IOC_DEV_ID_SIZE,\r
- L"IBA\\V%06xP%08xS%06xs%08xv%04x",\r
- ib_ioc_profile_get_vend_id( &p_ext->info.profile ),\r
- cl_ntoh32( p_ext->info.profile.dev_id ),\r
- ib_ioc_profile_get_subsys_vend_id( &p_ext->info.profile ),\r
- cl_ntoh32( p_ext->info.profile.subsys_id ),\r
- cl_ntoh16( p_ext->info.profile.dev_ver ) );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- ExFreePool( p_string );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to format device ID string.\n") );\r
- return status;\r
- }\r
- p_irp->IoStatus.Information = (ULONG_PTR)p_string;\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-ioc_query_hardware_ids(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- OUT IRP* const p_irp )\r
-{\r
- NTSTATUS status;\r
- ioc_ext_t *p_ext;\r
- WCHAR *p_string, *p_start;\r
- size_t size;\r
- uint32_t V,P,S,s;\r
- uint16_t v;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = (ioc_ext_t*)p_dev_obj->DeviceExtension;\r
- if( !p_ext->pdo.b_present )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Device not present.\n") );\r
- return STATUS_NO_SUCH_DEVICE;\r
- }\r
-\r
- p_string = ExAllocatePoolWithTag( PagedPool, IOC_HW_ID_SIZE, 'ihqi' );\r
- if( !p_string )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to allocate hardware ID buffer (%d bytes).\n",\r
- IOC_HW_ID_SIZE) );\r
- return STATUS_INSUFFICIENT_RESOURCES;\r
- }\r
-\r
- V = ib_ioc_profile_get_vend_id( &p_ext->info.profile );\r
- P = cl_ntoh32( p_ext->info.profile.dev_id );\r
- S = ib_ioc_profile_get_subsys_vend_id( &p_ext->info.profile );\r
- s = cl_ntoh32( p_ext->info.profile.subsys_id );\r
- v = cl_ntoh16( p_ext->info.profile.dev_ver );\r
-\r
- /* Fill in the first hardware ID. */\r
- p_start = p_string;\r
- size = IOC_HW_ID_SIZE;\r
- status = RtlStringCbPrintfExW( p_start, size, &p_start, &size,\r
- STRSAFE_FILL_BEHIND_NULL, L"IBA\\V%06xP%08xS%06xs%08xv%04x",\r
- V, P, S, s, v );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- ExFreePool( p_string );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to format hardware ID string.\n") );\r
- return status;\r
- }\r
- /* Fill in the second hardware ID. */\r
- p_start++;\r
- size -= sizeof(WCHAR);\r
- status = RtlStringCbPrintfExW( p_start, size, &p_start, &size,\r
- STRSAFE_FILL_BEHIND_NULL, L"IBA\\V%06xP%08xS%06xs%08x", V, P, S, s );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- ExFreePool( p_string );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to format hardware ID string.\n") );\r
- return status;\r
- }\r
- /* Fill in the third hardware ID. */\r
- p_start++;\r
- size -= sizeof(WCHAR);\r
- status = RtlStringCbPrintfExW( p_start, size, &p_start, &size,\r
- STRSAFE_FILL_BEHIND_NULL, L"IBA\\V%06xP%08xv%04x", V, P, v );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- ExFreePool( p_string );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to format hardware ID string.\n") );\r
- return status;\r
- }\r
- /* Fill in the fourth hardware ID. */\r
- p_start++;\r
- size -= sizeof(WCHAR);\r
- status = RtlStringCbPrintfExW( p_start, size, &p_start, &size,\r
- STRSAFE_FILL_BEHIND_NULL, L"IBA\\V%06xP%08x", V, P );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- ExFreePool( p_string );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to format hardware ID string.\n") );\r
- return status;\r
- }\r
- p_irp->IoStatus.Information = (ULONG_PTR)p_string;\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-ioc_query_compatible_ids(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- OUT IRP* const p_irp )\r
-{\r
- NTSTATUS status;\r
- ioc_ext_t *p_ext;\r
- WCHAR *p_string, *p_start;\r
- size_t size;\r
- uint16_t C, c, p, r;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = (ioc_ext_t*)p_dev_obj->DeviceExtension;\r
- if( !p_ext->pdo.b_present )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Device not present.\n") );\r
- return STATUS_NO_SUCH_DEVICE;\r
- }\r
-\r
- p_string = ExAllocatePoolWithTag( PagedPool, IOC_COMPAT_ID_SIZE, 'icqi' );\r
- if( !p_string )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to allocate compatible ID buffer (%d bytes).\n",\r
- IOC_HW_ID_SIZE) );\r
- return STATUS_INSUFFICIENT_RESOURCES;\r
- }\r
-\r
- C = cl_ntoh16( p_ext->info.profile.io_class );\r
- c = cl_ntoh16( p_ext->info.profile.io_subclass );\r
- p = cl_ntoh16( p_ext->info.profile.protocol );\r
- r = cl_ntoh16( p_ext->info.profile.protocol_ver );\r
-\r
- p_start = p_string;\r
- size = IOC_COMPAT_ID_SIZE;\r
- /* Fill in the first compatible ID. */\r
- status = RtlStringCbPrintfExW( p_start, size, &p_start, &size,\r
- STRSAFE_FILL_BEHIND_NULL, L"IBA\\C%04xc%04xp%04xr%04x", C, c, p, r );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- ExFreePool( p_string );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to format device ID string.\n") );\r
- return status;\r
- }\r
- /* Fill in the second compatible ID. */\r
- p_start++;\r
- size -= sizeof(WCHAR);\r
- status = RtlStringCbPrintfExW( p_start, size, NULL, NULL,\r
- STRSAFE_FILL_BEHIND_NULL, L"IBA\\C%04xc%04xp%04x", C, c, p );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- ExFreePool( p_string );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to format device ID string.\n") );\r
- return status;\r
- }\r
- p_irp->IoStatus.Information = (ULONG_PTR)p_string;\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-ioc_query_unique_id(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- OUT IRP* const p_irp )\r
-{\r
- NTSTATUS status;\r
- WCHAR *p_string;\r
- ioc_ext_t *p_ext;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
- if( !p_ext->pdo.b_present )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Device not present.\n") );\r
- return STATUS_NO_SUCH_DEVICE;\r
- }\r
-\r
- /* The instance ID is the port GUID. */\r
- p_string = ExAllocatePoolWithTag( PagedPool, sizeof(WCHAR) * 33, 'iuqi' );\r
- if( !p_string )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to allocate instance ID buffer (%d bytes).\n",\r
- sizeof(WCHAR) * 17) );\r
- return STATUS_NO_MEMORY;\r
- }\r
-\r
- status = RtlStringCchPrintfW(p_string, 33, L"%016I64x%016I64x",\r
- p_ext->info.profile.ioc_guid,p_ext->pdo.ca_guid);\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- CL_ASSERT( NT_SUCCESS( status ) );\r
- ExFreePool( p_string );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("RtlStringCchPrintfW returned %08x.\n", status) );\r
- return status;\r
- }\r
-\r
- p_irp->IoStatus.Information = (ULONG_PTR)p_string;\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-ioc_query_description(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- OUT IRP* const p_irp )\r
-{\r
- NTSTATUS status;\r
- WCHAR *p_string;\r
- ioc_ext_t *p_ext;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
- if( !p_ext->pdo.b_present )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Device not present.\n") );\r
- return STATUS_NO_SUCH_DEVICE;\r
- }\r
-\r
- p_string = ExAllocatePoolWithTag( PagedPool,\r
- sizeof(WCHAR) * sizeof(p_ext->info.profile.id_string),\r
- 'edqi');\r
- if( !p_string )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to allocate device description buffer (%d bytes).\n",\r
- sizeof(WCHAR) * sizeof(p_ext->info.profile.id_string)) );\r
- return STATUS_INSUFFICIENT_RESOURCES;\r
- }\r
-\r
- if( ib_ioc_profile_get_vend_id( &p_ext->info.profile ) == 0x00066a &&\r
- p_ext->info.profile.dev_id == CL_HTON32(0x00000030) )\r
- {\r
- status = RtlStringCchPrintfW(\r
- p_string, sizeof(p_ext->info.profile.id_string),\r
- L"SilverStorm Technologies VEx I/O Controller" );\r
- }\r
- else if( ib_ioc_profile_get_vend_id( &p_ext->info.profile ) == 0x00066a &&\r
- p_ext->info.profile.dev_id == CL_HTON32(0x00000038) )\r
- {\r
- status = RtlStringCchPrintfW(\r
- p_string, sizeof(p_ext->info.profile.id_string),\r
- L"SilverStorm Technologies VFx I/O Controller" );\r
- }\r
- else\r
- {\r
- status = RtlStringCchPrintfW(\r
- p_string, sizeof(p_ext->info.profile.id_string),\r
- L"%S", p_ext->info.profile.id_string );\r
- }\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- CL_ASSERT( NT_SUCCESS( status ) );\r
- ExFreePool( p_string );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("RtlStringCchPrintfW returned %08x.\n", status) );\r
- return status;\r
- }\r
- p_irp->IoStatus.Information = (ULONG_PTR)p_string;\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-ioc_query_location(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- OUT IRP* const p_irp )\r
-{\r
- NTSTATUS status;\r
- ioc_ext_t *p_ext;\r
- WCHAR *p_string;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = (ioc_ext_t*)p_dev_obj->DeviceExtension;\r
- if( !p_ext->pdo.b_present )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Device not present.\n") );\r
- return STATUS_NO_SUCH_DEVICE;\r
- }\r
-\r
- p_string = ExAllocatePoolWithTag( PagedPool, \r
- max( IOC_LOCATION_SIZE, sizeof( WCHAR ) *\r
- ( sizeof( p_ext->info.profile.id_string ) + 1 )),\r
- 'olqi');\r
- if( !p_string )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to allocate location buffer (%d bytes).\n",\r
- IOC_LOCATION_SIZE) );\r
- return STATUS_INSUFFICIENT_RESOURCES;\r
- }\r
-\r
- if( ib_ioc_profile_get_vend_id( &p_ext->info.profile ) == 0x00066a )\r
- {\r
- status = RtlStringCchPrintfW(\r
- p_string, sizeof(p_ext->info.profile.id_string),\r
- L"%S", p_ext->info.profile.id_string );\r
- }\r
- else\r
- {\r
- status = RtlStringCbPrintfW( p_string, IOC_LOCATION_SIZE,\r
- L"Chassis 0x%016I64x, Slot %d, IOC %d",\r
- cl_ntoh64( p_ext->info.chassis_guid ),\r
- p_ext->info.chassis_slot, p_ext->info.iou_slot );\r
- }\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- ExFreePool( p_string );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to format device ID string.\n") );\r
- return status;\r
- }\r
- p_irp->IoStatus.Information = (ULONG_PTR)p_string;\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-ioc_query_bus_info(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- ioc_ext_t *p_ext;\r
- PNP_BUS_INFORMATION *p_iou_info;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = (ioc_ext_t*)p_dev_obj->DeviceExtension;\r
- if( !p_ext->pdo.b_present )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Device not present.\n") );\r
- return STATUS_NO_SUCH_DEVICE;\r
- }\r
-\r
- *p_action = IrpComplete;\r
-\r
- p_iou_info = ExAllocatePoolWithTag( PagedPool, sizeof(PNP_BUS_INFORMATION), 'ibqi' );\r
- if( !p_iou_info )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to allocate PNP_BUS_INFORMATION (%d bytes).\n",\r
- sizeof(PNP_BUS_INFORMATION)) );\r
- return STATUS_INSUFFICIENT_RESOURCES;\r
- }\r
-\r
-\r
- p_iou_info->BusTypeGuid = GUID_BUS_TYPE_IBA;\r
- //TODO: Memory from Intel - storage miniport would not stay loaded unless\r
- //TODO: bus type was PCI. Look here if SRP is having problems staying\r
- //TODO: loaded.\r
- p_iou_info->LegacyBusType = PNPBus;\r
- p_iou_info->BusNumber = p_ext->info.iou_slot;\r
-\r
- p_irp->IoStatus.Information = (ULONG_PTR)p_iou_info;\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static __ref_ioc_ifc(\r
- IN ioc_ext_t* p_ext )\r
-{\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- cl_atomic_inc( &p_ext->pdo.p_parent_ext->cl_ext.n_ifc_ref );\r
- ObReferenceObject( p_ext->pdo.p_parent_ext->cl_ext.p_self_do );\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
-}\r
-\r
-\r
-static void\r
-__deref_ioc_ifc(\r
- IN ioc_ext_t* p_ext )\r
-{\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- cl_atomic_dec( &p_ext->pdo.p_parent_ext->cl_ext.n_ifc_ref );\r
- ObDereferenceObject( p_ext->pdo.p_parent_ext->cl_ext.p_self_do );\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
-}\r
-\r
-\r
-\r
-\r
-static NTSTATUS\r
-ioc_query_interface(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- NTSTATUS status;\r
- IO_STACK_LOCATION *p_io_stack;\r
- ib_al_ifc_t *p_ifc;\r
- ib_al_ifc_data_t *p_ifc_data;\r
- ioc_ifc_data_t *p_ioc_data;\r
- ioc_ext_t *p_ext;\r
- const GUID *p_guid;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- CL_ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
- p_io_stack = IoGetCurrentIrpStackLocation( p_irp );\r
- p_guid = p_io_stack->Parameters.QueryInterface.InterfaceType;\r
- /* Bottom of the stack - IRP must be completed. */\r
- *p_action = IrpComplete;\r
-\r
- /* Compare requested GUID with our supported interface GUIDs. */\r
- if( IsEqualGUID( p_guid, &GUID_BUS_INTERFACE_STANDARD ) )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IOU_DBG_PNP,\r
- ("BUS_INTERFACE_STANDARD\n") );\r
- return cl_fwd_query_ifc(\r
- p_ext->pdo.p_parent_ext->cl_ext.p_self_do, p_io_stack );\r
- }\r
-\r
- if( !IsEqualGUID( p_guid, &GUID_IB_AL_INTERFACE ) )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IOU_DBG_PNP,\r
- ("Unsupported interface: \n\t"\r
- "0x%08x, 0x%04x, 0x%04x, 0x%02x, 0x%02x, 0x%02x,"\r
- "0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x.\n",\r
- p_guid->Data1, p_guid->Data2, p_guid->Data3,\r
- p_guid->Data4[0], p_guid->Data4[1], p_guid->Data4[2],\r
- p_guid->Data4[3], p_guid->Data4[4], p_guid->Data4[5],\r
- p_guid->Data4[6], p_guid->Data4[7]) );\r
- return p_irp->IoStatus.Status;\r
- }\r
-\r
- /* Get the interface. */\r
- status = cl_fwd_query_ifc(\r
- p_ext->pdo.p_parent_ext->cl_ext.p_self_do, p_io_stack );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to forward interface query: %08X\n", status) );\r
- return status;\r
- }\r
-\r
- if( !p_io_stack->Parameters.QueryInterface.InterfaceSpecificData )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("No interface specific data!\n") );\r
- return status;\r
- }\r
-\r
- p_ifc = (ib_al_ifc_t*)p_io_stack->Parameters.QueryInterface.Interface;\r
-\r
- p_ifc_data = (ib_al_ifc_data_t*)\r
- p_io_stack->Parameters.QueryInterface.InterfaceSpecificData;\r
- p_guid = p_ifc_data->type;\r
- if( !IsEqualGUID( p_guid, &GUID_IOC_INTERFACE_DATA ) ||\r
- p_ifc_data->version != IOC_INTERFACE_DATA_VERSION )\r
- {\r
- p_ifc->wdm.InterfaceDereference( p_ifc->wdm.Context );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Unsupported interface data: \n\t"\r
- "0x%08x, 0x%04x, 0x%04x, 0x%02x, 0x%02x, 0x%02x,"\r
- "0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x.\n",\r
- p_guid->Data1, p_guid->Data2, p_guid->Data3,\r
- p_guid->Data4[0], p_guid->Data4[1], p_guid->Data4[2],\r
- p_guid->Data4[3], p_guid->Data4[4], p_guid->Data4[5],\r
- p_guid->Data4[6], p_guid->Data4[7]) );\r
- return STATUS_INVALID_PARAMETER;\r
- }\r
-\r
- ASSERT( p_ifc_data->p_data );\r
-\r
- if( p_ifc_data->size != sizeof(ioc_ifc_data_t) )\r
- {\r
- p_ifc->wdm.InterfaceDereference( p_ifc->wdm.Context );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IOU_DBG_PNP,\r
- ("Buffer too small (%d given, %d required).\n",\r
- p_ifc_data->size,\r
- sizeof(ioc_ifc_data_t)) );\r
- return STATUS_BUFFER_TOO_SMALL;\r
- }\r
-\r
- /* Set the interface data. */\r
- p_ioc_data = (ioc_ifc_data_t*)p_ifc_data->p_data;\r
-\r
- p_ioc_data->ca_guid = p_ext->pdo.p_parent_ext->ioc_mgr.info.ca_guid;\r
- p_ioc_data->guid = p_ext->info.profile.ioc_guid;\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * The PDOs created by the IB Bus driver are software devices. As such,\r
- * all power states are supported. It is left to the HCA power policy\r
- * owner to handle which states can be supported by the HCA.\r
- */\r
-static NTSTATUS\r
-ioc_set_power(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- IO_STACK_LOCATION *p_io_stack;\r
- iou_pdo_ext_t *p_ext;\r
-\r
- IOU_ENTER( IOU_DBG_POWER );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
- p_io_stack = IoGetCurrentIrpStackLocation( p_irp );\r
-\r
- if( p_io_stack->Parameters.Power.Type == DevicePowerState )\r
- {\r
- /* Notify the power manager. */\r
- p_ext->dev_po_state = p_io_stack->Parameters.Power.State;\r
- PoSetPowerState( p_dev_obj, DevicePowerState, p_ext->dev_po_state );\r
- }\r
-\r
- *p_action = IrpComplete;\r
- IOU_EXIT( IOU_DBG_POWER );\r
- return STATUS_SUCCESS;\r
-}\r
+++ /dev/null
-/*\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
- * Redistribution and use in source and binary forms, with or\r
- * without modification, are permitted provided that the following\r
- * conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer.\r
- *\r
- * - Redistributions in binary form must reproduce the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer in the documentation and/or other materials\r
- * provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id: iou_ioc_mgr.h 10 2005-05-24 00:33:03Z ftillier $\r
- */\r
-\r
-\r
-\r
-#if !defined( __IOU_IOU_MGR_H__ )\r
-#define __IOU_IOU_MGR_H__\r
-\r
-#include <iba/ib_al.h>\r
-#include <complib/cl_mutex.h>\r
-#include <complib/cl_obj.h>\r
-#include <iba/iou_ifc.h>\r
-\r
-/* Global load service */\r
-typedef struct _ioc_mgr\r
-{\r
- cl_obj_t obj;\r
-\r
- ib_al_ifc_t ifc;\r
-\r
- ib_al_handle_t h_al;\r
- ib_pnp_handle_t h_pnp; /* Handle for iou PnP events */\r
-\r
- /* Attributes for this IOU. */\r
- iou_ifc_data_t info;\r
-\r
- /* Mutex protects both pointer vectors. */\r
- cl_mutex_t pdo_mutex;\r
-\r
- /* Pointer vector of child IOC PDOs. */\r
- cl_qlist_t ioc_list;\r
-\r
-} ioc_mgr_t;\r
-\r
-\r
-void\r
-ioc_mgr_construct(\r
- IN OUT ioc_mgr_t* const p_ioc_mgr );\r
-\r
-ib_api_status_t\r
-ioc_mgr_init(\r
- IN OUT ioc_mgr_t* const p_ioc_mgr );\r
-\r
-NTSTATUS\r
-ioc_mgr_get_iou_relations(\r
- IN ioc_mgr_t* const p_ioc_mgr,\r
- IN IRP* const p_irp );\r
-\r
-#endif\r
+++ /dev/null
-/*\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
- * Redistribution and use in source and binary forms, with or\r
- * without modification, are permitted provided that the following\r
- * conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer.\r
- *\r
- * - Redistributions in binary form must reproduce the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer in the documentation and/or other materials\r
- * provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id: iou_pnp.c 469 2006-08-30 18:35:01Z ftillier $\r
- */\r
-\r
-/*\r
- * Implemenation of all PnP functionality for FDO (power policy owners).\r
- */\r
-\r
-#include "iou_driver.h"\r
-#if defined(EVENT_TRACING)\r
-#ifdef offsetof\r
-#undef offsetof\r
-#endif\r
-#include "iou_pnp.tmh"\r
-#endif\r
-#include "iou_pnp.h"\r
-#include "iou_ioc_mgr.h"\r
-#include <complib/cl_memory.h>\r
-#include <complib/cl_bus_ifc.h>\r
-#include <initguid.h>\r
-#include <iba/iou_ifc.h>\r
-\r
-#if 0\r
-static VOID\r
-iou_EvtIoDeviceControl(\r
- IN WDFQUEUE Queue,\r
- IN WDFREQUEST Request,\r
- IN size_t OutputBufferLength,\r
- IN size_t InputBufferLength,\r
- IN ULONG IoControlCode );\r
-#endif\r
-\r
-static NTSTATUS\r
-fdo_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
-\r
-static void\r
-fdo_release_resources(\r
- IN DEVICE_OBJECT* const p_dev_obj );\r
-\r
-static NTSTATUS\r
-fdo_query_remove(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp, \r
- OUT cl_irp_action_t* const p_action );\r
-\r
-static NTSTATUS\r
-fdo_query_capabilities(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp, \r
- OUT cl_irp_action_t* const p_action );\r
-\r
-static NTSTATUS\r
-fdo_query_iou_relations(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp, \r
- OUT cl_irp_action_t* const p_action );\r
-\r
-static NTSTATUS\r
-fdo_query_interface(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp, \r
- OUT cl_irp_action_t* const p_action );\r
-\r
-static NTSTATUS\r
-__fdo_query_power(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action );\r
-\r
-static NTSTATUS\r
-__fdo_set_power(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action );\r
-\r
-\r
-/* All PnP code is called at passive, so it can all be paged out. */\r
-#ifdef ALLOC_PRAGMA\r
-#pragma alloc_text (PAGE, iou_add_device)\r
-#pragma alloc_text (PAGE, fdo_start)\r
-#pragma alloc_text (PAGE, fdo_query_remove)\r
-#pragma alloc_text (PAGE, fdo_release_resources)\r
-#pragma alloc_text (PAGE, fdo_query_capabilities)\r
-#pragma alloc_text (PAGE, fdo_query_iou_relations)\r
-#pragma alloc_text (PAGE_PNP, __fdo_query_power)\r
-#pragma alloc_text (PAGE_PNP, __fdo_set_power)\r
-#endif\r
-\r
-\r
-/* Global virtual function pointer tables shared between all instances of FDO. */\r
-static const cl_vfptr_pnp_po_t vfptr_fdo_pnp = {\r
- "IB IOU",\r
- fdo_start,\r
- cl_irp_skip,\r
- cl_irp_skip,\r
- cl_do_sync_pnp,\r
- fdo_query_remove,\r
- fdo_release_resources,\r
- cl_do_remove,\r
- cl_do_sync_pnp,\r
- cl_irp_skip,\r
- fdo_query_capabilities,\r
- cl_irp_skip,\r
- cl_irp_skip,\r
- cl_do_sync_pnp,\r
- fdo_query_iou_relations,\r
- cl_irp_ignore,\r
- cl_irp_ignore,\r
- cl_irp_ignore,\r
- cl_irp_ignore,\r
- cl_irp_ignore,\r
- cl_irp_ignore,\r
- cl_irp_ignore,\r
- cl_irp_ignore, /* QueryInterface */\r
- cl_irp_ignore,\r
- cl_irp_ignore,\r
- cl_irp_ignore,\r
- cl_irp_ignore,\r
- __fdo_query_power, /* QueryPower */\r
- __fdo_set_power, /* SetPower */\r
- cl_irp_ignore, /* PowerSequence */\r
- cl_irp_ignore /* WaitWake */\r
-};\r
-\r
-/*\r
- * NOTE: The QueryInterface entry point is not used because we only\r
- * enable/disable our interface so that user-mode AL can find a device to\r
- * perform IOCTLs to.\r
- */\r
-\r
-\r
-NTSTATUS\r
-iou_add_device( IN WDFDRIVER Driver,\r
- IN PWDFDEVICE_INIT DeviceInit )\r
-{\r
- NTSTATUS status;\r
- iou_fdo_ext_t *p_ext;\r
-\r
- WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks;\r
- WDFDEVICE device;\r
- WDF_OBJECT_ATTRIBUTES Attributes;\r
- WDF_IO_QUEUE_CONFIG queueConfig;\r
- WDFQUEUE queue;\r
- \r
- PAGED_CODE ();\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
- KdPrint(("--> %s(): 0x%p\n", __FUNCTION__, Driver));\r
-\r
-#ifdef NOT_YET\r
- //\r
- // Get some property of the device you are about to attach and check\r
- // to see if that's the one you are interested. For demonstration\r
- // we will get the UINumber of the device. The bus driver reports the\r
- // serial number as the UINumber.\r
-\r
- status = WdfFdoInitQueryProperty(DeviceInit,\r
- DevicePropertyUINumber,\r
- sizeof(serialNo),\r
- &serialNo,\r
- &returnSize);\r
- if(!NT_SUCCESS(status)){\r
- KdPrint(("Failed to get the property of PDO: 0x%p\n", DeviceInit));\r
-\r
- }\r
-#endif\r
- //\r
- // Tell the framework that you are filter driver. Framework\r
- // takes care of inherting all the device flags & characterstics\r
- // from the lower device you are attaching to.\r
-\r
- WdfFdoInitSetFilter(DeviceInit);\r
-\r
-#if 0\r
- /* Create the FDO device object to attach to the stack. */\r
- status = IoCreateDevice( p_driver_obj, sizeof(iou_fdo_ext_t),\r
- NULL, FILE_DEVICE_BUS_EXTENDER,\r
- FILE_DEVICE_SECURE_OPEN, FALSE, &p_dev_obj );\r
- if( !NT_SUCCESS(status) )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to create bus root FDO device.\n") );\r
- return status;\r
- }\r
-#endif\r
-\r
- // Initialize the PnpPowerCallbacks structure.\r
- WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks);\r
-\r
-// pnpPowerCallbacks.EvtDeviceRelationsQuery = Bus_EvtDeviceRelationsQuery;\r
-\r
- // Register the PnP and power callbacks.\r
- WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks);\r
-\r
-\r
- // Initialize attributes structure to specify size and accessor function\r
- // for storing device context.\r
-\r
- WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&Attributes, FDO_DATA);\r
-\r
- // Register a cleanup callback on the device to free up some resources at\r
- // the time the device is deleted.\r
- //Attributes.EvtCleanupCallback = Bus_EvtDriverObjCleanup;\r
-\r
- // By opting for SynchronizationScopeDevice, we tell the framework to\r
- // synchronize callbacks events of all the objects directly associated\r
- // with the device. In this driver, we will associate queues.\r
- // By doing that we don't have to worrry about synchronizing\r
- // access to device-context by various io Events.\r
- // Framework will serialize them by using an internal device-lock.\r
-\r
- Attributes.SynchronizationScope = WdfSynchronizationScopeDevice;\r
-\r
- // Create a framework device object. In response to this call, framework\r
- // creates a WDM deviceobject and attaches to the PDO.\r
-\r
- status = WdfDeviceCreate(&DeviceInit, &Attributes, &device);\r
-\r
- if (!NT_SUCCESS(status)) {\r
- KdPrint(("Error creating WdfDeviceCreate 0x%x, line#%d\n",\r
- status,__LINE__));\r
- return status;\r
- }\r
- p_ext = FdoGetData(device);\r
-\r
- ioc_mgr_construct( &p_ext->ioc_mgr );\r
-\r
-#if 0\r
- p_next_do = IoAttachDeviceToDeviceStack( p_dev_obj, p_pdo );\r
- if( !p_next_do )\r
- {\r
- IoDeleteDevice( p_dev_obj );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("IoAttachToDeviceStack failed.\n") );\r
- return STATUS_NO_SUCH_DEVICE;\r
- }\r
-#endif\r
-\r
- // Configure a default queue so that requests that are not\r
- // configure-fowarded using WdfDeviceConfigureRequestDispatching to goto\r
- // other queues get dispatched here.\r
-\r
- WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE( &queueConfig,\r
- WdfIoQueueDispatchParallel );\r
-\r
- // handle IRP_MJ_DEVICE_CONTROL with this callback\r
-// queueConfig.EvtIoDeviceControl = iou_EvtIoDeviceControl;\r
-\r
- status = WdfIoQueueCreate( device,\r
- &queueConfig,\r
- WDF_NO_OBJECT_ATTRIBUTES,\r
- &queue );\r
-\r
- if (!NT_SUCCESS(status)) {\r
- KdPrint(("WdfIoQueueCreate failed status 0x%x\n", status));\r
- return status;\r
- }\r
-\r
-// cl_init_pnp_po_ext( p_dev_obj, p_next_do, p_pdo, g_iou_dbg_flags,\r
-// &vfptr_fdo_pnp, NULL );\r
-\r
- KdPrint(("<-- %s(): status 0x%x\n", __FUNCTION__, status));\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
-\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-__get_iou_ifc( IN iou_fdo_ext_t* const p_ext )\r
-{\r
- NTSTATUS status;\r
- IO_STACK_LOCATION io_stack;\r
- ib_al_ifc_data_t data;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- data.type = &GUID_IOU_INTERFACE_DATA;\r
- data.version = IOU_INTERFACE_DATA_VERSION;\r
- data.size = sizeof(iou_ifc_data_t);\r
- data.p_data = &p_ext->ioc_mgr.info;\r
-\r
- io_stack.MinorFunction = IRP_MN_QUERY_INTERFACE;\r
- io_stack.Parameters.QueryInterface.Version = AL_INTERFACE_VERSION;\r
- io_stack.Parameters.QueryInterface.Size = sizeof(ib_al_ifc_t);\r
- io_stack.Parameters.QueryInterface.Interface =\r
- (INTERFACE*)&p_ext->ioc_mgr.ifc;\r
- io_stack.Parameters.QueryInterface.InterfaceSpecificData =\r
- &data;\r
- io_stack.Parameters.QueryInterface.InterfaceType = &GUID_IB_AL_INTERFACE;\r
-\r
- status = cl_fwd_query_ifc( p_ext->cl_ext.p_next_do, &io_stack );\r
-\r
- /*\r
- * Dereference the interface now so that the bus driver doesn't fail a\r
- * query remove IRP. We will always get unloaded before the bus driver\r
- * since we're a child device.\r
- */\r
- if( NT_SUCCESS( status ) )\r
- {\r
- p_ext->ioc_mgr.ifc.wdm.InterfaceDereference(\r
- p_ext->ioc_mgr.ifc.wdm.Context );\r
- }\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return status;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-fdo_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
-{\r
- NTSTATUS status;\r
- iou_fdo_ext_t *p_ext;\r
- ib_api_status_t ib_status;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = 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
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Lower drivers failed IRP_MN_START_DEVICE.\n") );\r
- return status;\r
- }\r
-\r
- status = __get_iou_ifc( p_ext );\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("Failed to get IOU interface.\n") );\r
- return status;\r
- }\r
-\r
- /* Initialize the IOU manager. */\r
- ib_status = ioc_mgr_init( &p_ext->ioc_mgr );\r
- if( ib_status != IB_SUCCESS )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("ioc_mgr_init returned %s.\n",\r
- p_ext->ioc_mgr.ifc.get_err_str(ib_status)) );\r
- return STATUS_UNSUCCESSFUL;\r
- }\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return status;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-fdo_query_remove(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp, \r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- iou_fdo_ext_t *p_ext;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
-\r
- *p_action = IrpSkip;\r
- /* The FDO driver must set the status even when passing down. */\r
- p_irp->IoStatus.Status = STATUS_SUCCESS;\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * This function gets called after releasing the remove lock and waiting\r
- * for all other threads to release the lock. No more modifications will\r
- * occur to the PDO pointer vectors.\r
- */\r
-static void\r
-fdo_release_resources(\r
- IN DEVICE_OBJECT* const p_dev_obj )\r
-{\r
- iou_fdo_ext_t *p_ext;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
-\r
- //TODO: Fail outstanding I/O operations.\r
- cl_obj_destroy( &p_ext->ioc_mgr.obj );\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
-}\r
-\r
-\r
-static NTSTATUS\r
-fdo_query_capabilities(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp, \r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- NTSTATUS status;\r
- iou_fdo_ext_t *p_ext;\r
- IO_STACK_LOCATION *p_io_stack;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
-\r
- /* Process on the way up. */\r
- status = cl_do_sync_pnp( p_dev_obj, p_irp, p_action );\r
-\r
- if( !NT_SUCCESS( status ) )\r
- {\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("cl_do_sync_pnp returned %08x.\n", status) );\r
- return status;\r
- }\r
-\r
- p_io_stack = IoGetCurrentIrpStackLocation( p_irp );\r
-\r
- /*\r
- * Store the device power maping into our extension since we're\r
- * the power policy owner. The mapping is used when handling\r
- * IRP_MN_SET_POWER IRPs.\r
- */\r
- cl_memcpy( p_ext->po_state, \r
- p_io_stack->Parameters.DeviceCapabilities.Capabilities->DeviceState,\r
- sizeof( p_ext->po_state ) );\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return status;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-fdo_query_iou_relations(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp, \r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- iou_fdo_ext_t *p_ext;\r
- NTSTATUS status;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
-\r
- status = ioc_mgr_get_iou_relations( &p_ext->ioc_mgr, p_irp );\r
- switch( status )\r
- {\r
- case STATUS_NO_SUCH_DEVICE:\r
- *p_action = IrpSkip;\r
- status = STATUS_SUCCESS;\r
- break;\r
-\r
- case STATUS_SUCCESS:\r
- *p_action = IrpPassDown;\r
- break;\r
-\r
- default:\r
- *p_action = IrpComplete;\r
- break;\r
- }\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return status;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-__fdo_query_power(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- NTSTATUS status = STATUS_SUCCESS;\r
- IO_STACK_LOCATION *p_io_stack;\r
-\r
- IOU_ENTER( IOU_DBG_POWER );\r
-\r
- UNUSED_PARAM( p_dev_obj );\r
-\r
- p_io_stack = IoGetCurrentIrpStackLocation( p_irp );\r
-\r
- switch( p_io_stack->Parameters.Power.Type )\r
- {\r
- case SystemPowerState:\r
- /* Fail any requests to hibernate or sleep the system. */\r
- switch( p_io_stack->Parameters.Power.State.SystemState )\r
- {\r
- case PowerSystemWorking:\r
- case PowerSystemShutdown:\r
- /* We only support fully working and shutdown system states. */\r
- break;\r
-\r
- default:\r
- status = STATUS_NOT_SUPPORTED;\r
- }\r
- break;\r
-\r
- case DevicePowerState:\r
- /* Fail any query for low power states. */\r
- switch( p_io_stack->Parameters.Power.State.DeviceState )\r
- {\r
- case PowerDeviceD0:\r
- case PowerDeviceD3:\r
- /* We only support fully powered or off power states. */\r
- break;\r
-\r
- default:\r
- status = STATUS_NOT_SUPPORTED;\r
- }\r
- break;\r
- }\r
-\r
- if( status == STATUS_NOT_SUPPORTED )\r
- *p_action = IrpComplete;\r
- else\r
- *p_action = IrpSkip;\r
-\r
- IOU_EXIT( IOU_DBG_POWER );\r
- return status;\r
-}\r
-\r
-\r
-static void\r
-__request_power_completion(\r
- IN DEVICE_OBJECT *p_dev_obj,\r
- IN UCHAR minor_function,\r
- IN POWER_STATE power_state,\r
- IN void *context,\r
- IN IO_STATUS_BLOCK *p_io_status )\r
-{\r
- IRP *p_irp;\r
- cl_pnp_po_ext_t *p_ext;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- UNUSED_PARAM( minor_function );\r
- UNUSED_PARAM( power_state );\r
-\r
- p_irp = (IRP*)context;\r
- p_ext = p_dev_obj->DeviceExtension;\r
-\r
- /* Propagate the device IRP status to the system IRP status. */\r
- p_irp->IoStatus.Status = p_io_status->Status;\r
-\r
- /* Continue Power IRP processing. */\r
- PoStartNextPowerIrp( p_irp );\r
- IoCompleteRequest( p_irp, IO_NO_INCREMENT );\r
- IoReleaseRemoveLock( &p_ext->remove_lock, p_irp );\r
- IOU_EXIT( IOU_DBG_PNP );\r
-}\r
-\r
-\r
-/*NOTE: Completion routines must NEVER be pageable. */\r
-static NTSTATUS\r
-__set_power_completion(\r
- IN DEVICE_OBJECT *p_dev_obj,\r
- IN IRP *p_irp,\r
- IN void *context )\r
-{\r
- NTSTATUS status;\r
- POWER_STATE state;\r
- iou_fdo_ext_t *p_ext;\r
- IO_STACK_LOCATION *p_io_stack;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- UNUSED_PARAM( context );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
- p_io_stack = IoGetCurrentIrpStackLocation( p_irp );\r
-\r
- if( !NT_SUCCESS( p_irp->IoStatus.Status ) )\r
- {\r
- PoStartNextPowerIrp( p_irp );\r
- IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );\r
- IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("IRP_MN_SET_POWER for system failed by lower driver with %08x.\n",\r
- p_irp->IoStatus.Status) );\r
- return STATUS_SUCCESS;\r
- }\r
-\r
- state.DeviceState = \r
- p_ext->po_state[p_io_stack->Parameters.Power.State.SystemState];\r
-\r
- /*\r
- * Send a device power IRP to our devnode. Using our device object will\r
- * only work on win2k and other NT based systems.\r
- */\r
- status = PoRequestPowerIrp( p_dev_obj, IRP_MN_SET_POWER, state,\r
- __request_power_completion, p_irp, NULL );\r
-\r
- if( !NT_SUCCESS( p_irp->IoStatus.Status ) )\r
- {\r
- PoStartNextPowerIrp( p_irp );\r
- /* Propagate the failure. */\r
- p_irp->IoStatus.Status = status;\r
- IoCompleteRequest( p_irp, IO_NO_INCREMENT );\r
- IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );\r
- IOU_PRINT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
- ("PoRequestPowerIrp returned %08x.\n", status) );\r
- }\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
- return STATUS_MORE_PROCESSING_REQUIRED;\r
-}\r
-\r
-\r
-static NTSTATUS\r
-__fdo_set_power(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp,\r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- NTSTATUS status;\r
- IO_STACK_LOCATION *p_io_stack;\r
- iou_fdo_ext_t *p_ext;\r
-\r
- IOU_ENTER( IOU_DBG_POWER );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
- p_io_stack = IoGetCurrentIrpStackLocation( p_irp );\r
-\r
- switch( p_io_stack->Parameters.Power.Type )\r
- {\r
- case SystemPowerState:\r
- /*\r
- * Process on the way up the stack. We cannot block since the \r
- * power dispatch function can be called at elevated IRQL if the\r
- * device is in a paging/hibernation/crash dump path.\r
- */\r
- IoMarkIrpPending( p_irp );\r
- IoCopyCurrentIrpStackLocationToNext( p_irp );\r
-#pragma warning( push, 3 )\r
- IoSetCompletionRoutine( p_irp, __set_power_completion, NULL, \r
- TRUE, TRUE, TRUE );\r
-#pragma warning( pop )\r
- PoCallDriver( p_ext->cl_ext.p_next_do, p_irp );\r
-\r
- *p_action = IrpDoNothing;\r
- status = STATUS_PENDING;\r
- break;\r
-\r
- case DevicePowerState:\r
- default:\r
- /* Pass down and let the PDO driver handle it. */\r
- *p_action = IrpIgnore;\r
- status = STATUS_SUCCESS;\r
- break;\r
- }\r
-\r
- IOU_EXIT( IOU_DBG_POWER );\r
- return status;\r
-}\r
-\r
-\r
-void\r
-update_relations(\r
- IN cl_qlist_t* const p_pdo_list,\r
- IN OUT DEVICE_RELATIONS* const p_rel )\r
-{\r
- cl_list_item_t *p_list_item;\r
- iou_pdo_ext_t *p_pdo_ext;\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- p_list_item = cl_qlist_head( p_pdo_list );\r
- while( p_list_item != cl_qlist_end( p_pdo_list ) )\r
- {\r
- p_pdo_ext = PARENT_STRUCT( p_list_item, iou_pdo_ext_t, list_item );\r
-\r
- /* Move the list item to the next object. */\r
- p_list_item = cl_qlist_next( p_list_item );\r
-\r
- if( !p_pdo_ext->b_present )\r
- {\r
- /*\r
- * We don't report a PDO that is no longer present. This is how\r
- * the PDO will get cleaned up.\r
- */\r
- p_pdo_ext->b_reported_missing = TRUE;\r
- continue;\r
- }\r
- p_rel->Objects[p_rel->Count] = p_pdo_ext->cl_ext.p_pdo;\r
- ObReferenceObject( p_rel->Objects[p_rel->Count++] );\r
- }\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
-}\r
-\r
-\r
-#if 0\r
-\r
-static VOID\r
-iou_EvtIoDeviceControl(\r
- IN WDFQUEUE Queue,\r
- IN WDFREQUEST Request,\r
- IN size_t OutputBufferLength,\r
- IN size_t InputBufferLength,\r
- IN ULONG IoControlCode )\r
-{\r
- NTSTATUS status = STATUS_INVALID_PARAMETER;\r
- WDFDEVICE hDevice;\r
-// size_t length = 0;\r
-\r
- BOOLEAN xferStatus;\r
- PIRP irp;\r
- PIO_STACK_LOCATION NextStack;\r
- WDFIOTARGET hTarget;\r
-\r
- UNREFERENCED_PARAMETER(OutputBufferLength);\r
- UNREFERENCED_PARAMETER(InputBufferLength);\r
-\r
- IOU_ENTER( IOU_DBG_PNP );\r
-\r
- PAGED_CODE ();\r
-\r
- hDevice = WdfIoQueueGetDevice(Queue);\r
-\r
- KdPrint(("%s() 0x%p IOCTL 0x%x\n", __FUNCTION__, hDevice,IoControlCode));\r
-\r
- irp = WdfRequestWdmGetIrp(Request);\r
-\r
- //CurStack = IoGetCurrentIrpStackLocation(irp);\r
-\r
- status = cl_to_ntstatus( al_dev_ioctl( irp ) ); \r
- switch( status )\r
- {\r
- case STATUS_SUCCESS:\r
- // already completed.\r
- break;\r
-\r
- case STATUS_INVALID_DEVICE_REQUEST:\r
- // pass down the stack?\r
- hTarget = WdfDeviceGetIoTarget(hDevice);\r
- if ( hTarget )\r
- {\r
- NextStack = IoGetNextIrpStackLocation(irp);\r
- WdfRequestWdmFormatUsingStackLocation( Request, NextStack );\r
- xferStatus = WdfRequestSend( Request, hTarget, NULL );\r
- if ( xferStatus == FALSE )\r
- WdfRequestComplete(Request, status);\r
- }\r
- else\r
- WdfRequestComplete(Request, status);\r
- break;\r
-\r
- case STATUS_PENDING:\r
- // callback already set?\r
- break;\r
-\r
- default:\r
- WdfRequestComplete(Request, status);\r
- break;\r
- }\r
-\r
-#if 0\r
- PBUSENUM_PLUGIN_HARDWARE plugIn = NULL;\r
- PBUSENUM_UNPLUG_HARDWARE unPlug = NULL;\r
- PBUSENUM_EJECT_HARDWARE eject = NULL;\r
-\r
- switch (IoControlCode)\r
- {\r
- case IOCTL_BUSENUM_PLUGIN_HARDWARE:\r
-\r
- status = WdfRequestRetrieveInputBuffer (Request,\r
- sizeof (BUSENUM_PLUGIN_HARDWARE) +\r
- (sizeof(UNICODE_NULL) * 2),\r
- // 2 for double NULL termination (MULTI_SZ)\r
- &plugIn, &length);\r
- if( !NT_SUCCESS(status) ) {\r
- KdPrint(("WdfRequestRetrieveInputBuffer failed 0x%x\n", status));\r
- break;\r
- }\r
-\r
- ASSERT(length == InputBufferLength);\r
-\r
- if (sizeof (BUSENUM_PLUGIN_HARDWARE) == plugIn->Size)\r
- {\r
-\r
- length = (InputBufferLength - sizeof (BUSENUM_PLUGIN_HARDWARE))\r
- / sizeof(WCHAR);\r
- //\r
- // Make sure the IDs is two NULL terminated.\r
- //\r
- if ((UNICODE_NULL != plugIn->HardwareIDs[length - 1]) ||\r
- (UNICODE_NULL != plugIn->HardwareIDs[length - 2])) {\r
-\r
- status = STATUS_INVALID_PARAMETER;\r
- break;\r
- }\r
-\r
- status = Bus_PlugInDevice( hDevice,\r
- plugIn->HardwareIDs,\r
- length,\r
- plugIn->SerialNo );\r
- }\r
-\r
- break;\r
-\r
- case IOCTL_BUSENUM_UNPLUG_HARDWARE:\r
-\r
- status = WdfRequestRetrieveInputBuffer( Request,\r
- sizeof(BUSENUM_UNPLUG_HARDWARE),\r
- &unPlug,\r
- &length );\r
- if( !NT_SUCCESS(status) ) {\r
- KdPrint(("WdfRequestRetrieveInputBuffer failed 0x%x\n", status));\r
- break;\r
- }\r
-\r
- if (unPlug->Size == InputBufferLength)\r
- {\r
-\r
- status= Bus_UnPlugDevice(hDevice, unPlug->SerialNo );\r
-\r
- }\r
-\r
- break;\r
-\r
- case IOCTL_BUSENUM_EJECT_HARDWARE:\r
-\r
- status = WdfRequestRetrieveInputBuffer (Request,\r
- sizeof (BUSENUM_EJECT_HARDWARE),\r
- &eject, &length);\r
- if( !NT_SUCCESS(status) ) {\r
- KdPrint(("WdfRequestRetrieveInputBuffer failed 0x%x\n", status));\r
- break;\r
- }\r
-\r
- if (eject->Size == InputBufferLength)\r
- {\r
- status= Bus_EjectDevice(hDevice, eject->SerialNo);\r
-\r
- }\r
-\r
- break;\r
-\r
- default:\r
- break; // default status is STATUS_INVALID_PARAMETER\r
- }\r
- WdfRequestCompleteWithInformation(Request, status, length);\r
-#endif\r
-\r
- IOU_EXIT( IOU_DBG_PNP );\r
-}\r
-#endif\r
+++ /dev/null
-/*\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
- * Redistribution and use in source and binary forms, with or\r
- * without modification, are permitted provided that the following\r
- * conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer.\r
- *\r
- * - Redistributions in binary form must reproduce the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer in the documentation and/or other materials\r
- * provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id: iou_pnp.h 10 2005-05-24 00:33:03Z ftillier $\r
- */\r
-\r
-\r
-\r
-#if !defined _IOU_DRV_PNP_H_\r
-#define _IOU_DRV_PNP_H_\r
-\r
-\r
-#include "iou_driver.h"\r
-\r
-\r
-/****f* InfiniBand Bus Driver: Plug and Play/iou_add_device\r
-* NAME\r
-* iou_add_device\r
-*\r
-* DESCRIPTION\r
-* Main AddDevice entrypoint for the IB Bus driver.\r
-* Adds the bus root functional device object to the device node. The\r
-* bus root FDO performs all PnP operations for fabric attached devices.\r
-*\r
-* SYNOPSIS\r
-*/\r
-EVT_WDF_DRIVER_DEVICE_ADD iou_add_device;\r
-\r
-/*\r
-* PARAMETERS\r
-* p_driver_obj\r
-* Driver object for the IOU driver.\r
-*\r
-* p_pdo\r
-* Pointer to the device object representing the PDO for the device on\r
-* which we are loading.\r
-*\r
-* RETURN VIOUUES\r
-* STATUS_SUCCESS if the device was successfully added.\r
-*\r
-* Other NTSTATUS error values if errors are encountered.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-\r
-void\r
-update_relations(\r
- IN cl_qlist_t* const p_pdo_list,\r
- IN OUT DEVICE_RELATIONS* const p_rel );\r
-\r
-\r
-#endif // !defined _IOU_DRV_PNP_H_\r
+++ /dev/null
-#\r
-# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source\r
-# file to this component. This file merely indirects to the real make file\r
-# that is shared by all the driver components of the OpenIB Windows project.\r
-#\r
-\r
-!INCLUDE ..\..\..\inc\openib.def\r
+++ /dev/null
-LNG=$(LANGUAGE)\r
-_INX=.\r
-STAMP=stampinf -f $@ -a $(_BUILDARCH) -k $(KMDF_VERSION_MAJOR).$(KMDF_VERSION_MINOR)\r
-\r
-$(OBJ_PATH)\$(O)\$(INF_NAME).inf: $(_INX)\$(INF_NAME).inx \r
- copy $(_INX)\$(@B).inx $@\r
- $(STAMP)\r
-\r
- \r
-\r
-\r
-\r
-\r
-\r
-\r
-\r