[ofw] RE: patch; [mlx4] modify PortType according to setup_port_type

Tzachi Dar tzachid at mellanox.co.il
Tue Nov 17 04:57:09 PST 2009


Applied at 2574.
 
Thanks
Tzachi


________________________________

	From: Tzachi Dar 
	Sent: Sunday, November 15, 2009 8:02 PM
	To: ofw at lists.openfabrics.org
	Cc: Windows Design
	Subject: patch; [mlx4] modify PortType according to
setup_port_type
	
	
	signed off by: Firas.
	Index: Q:/projinf3/trunk/hw/mlx4/kernel/bus/drv/drv.c
	
===================================================================
	--- Q:/projinf3/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision
4774)
	+++ Q:/projinf3/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision
4775)
	@@ -257,18 +257,48 @@
	  return status;
	 }
	 
	- 
	+BOOLEAN __read_setup_params(PUNICODE_STRING puvalue)
	+{    
	+    NTSTATUS    status;    
	+    WDFKEY hParamsKey = NULL;
	+ DECLARE_CONST_UNICODE_STRING(KeyName,
L"\\REGISTRY\\MACHINE\\SOFTWARE\\Mellanox");
	+ DECLARE_CONST_UNICODE_STRING(PortType, L"PortType");
	+    
	+ status = WdfRegistryOpenKey(NULL, &KeyName,
STANDARD_RIGHTS_ALL, WDF_NO_OBJECT_ATTRIBUTES, &hParamsKey);
	+ if( !NT_SUCCESS( status ) ) 
	+    {
	+  MLX4_PRINT( TRACE_LEVEL_ERROR  ,MLX4_DBG_DEV
,("WdfRegistryOpenKey Failed status = 0x%x\n", status));
	+        return FALSE;
	+ }
	+    
	+    status = WdfRegistryQueryUnicodeString(hParamsKey,
&PortType, NULL, puvalue);    
	+ if( !NT_SUCCESS( status ) ) 
	+    {
	+        WdfRegistryClose(hParamsKey);
	+        return FALSE;
	+ }
	+
	+    WdfRegistryClose(hParamsKey);    
	+    return TRUE;    
	+}
	+
	 NTSTATUS
	 __read_dev_params(IN WDFDEVICE  Device, struct mlx4_dev_params
*dev_params)
	 {
	  NTSTATUS status = STATUS_SUCCESS;
	  WDFKEY hKey = NULL;
	  WDFKEY hParamsKey = NULL;
	+    BOOLEAN bRet = FALSE;
	  DECLARE_CONST_UNICODE_STRING(Parameters, L"Parameters");
	  DECLARE_CONST_UNICODE_STRING(PortType, L"PortType");
	+
	 #define  MAX_UVALUE 100
	  WCHAR uvalue_data[MAX_UVALUE];
	- UNICODE_STRING uvalue;
	+ UNICODE_STRING uvalue;    
	+ uvalue.Buffer = uvalue_data;
	+ uvalue.MaximumLength = MAX_UVALUE;
	+ uvalue.Length = 0;
	+    
	  status = WdfDeviceOpenRegistryKey(Device,
PLUGPLAY_REGKEY_DRIVER, 
	   STANDARD_RIGHTS_ALL, WDF_NO_OBJECT_ATTRIBUTES, &hKey);
	  if( !NT_SUCCESS( status ) ) {
	@@ -282,10 +312,17 @@
	   goto err;
	  }
	 
	- uvalue.Buffer = uvalue_data;
	- uvalue.MaximumLength = MAX_UVALUE;
	- uvalue.Length = 0;
	-
	+    bRet = __read_setup_params(&uvalue);
	+    if (bRet == TRUE)
	+    {
	+        status = WdfRegistryAssignValue(hParamsKey, &PortType,
REG_SZ,uvalue.Length,uvalue.Buffer);        
	+        if( !NT_SUCCESS( status ) ) {
	+            MLX4_PRINT( TRACE_LEVEL_ERROR  ,MLX4_DBG_DEV
,("WdfRegistryAssignValue Failed status = 0x%x\n", status));
	+            goto err;
	+        }        
	+        uvalue.Length = 0;
	+    }
	+    
	  status = WdfRegistryQueryUnicodeString(hParamsKey, &PortType,
NULL, &uvalue);
	  if (NT_SUCCESS (status)) {
	   if (!wcscmp(uvalue_data, L"ib,ib")) {
	
	 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20091117/d905da4b/attachment.html>


More information about the ofw mailing list