[IBBUS] Solves Bugzilla 1233 problem: machine crashes upon adding a new partition...
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 2 Jun 2009 17:20:55 +0000 (17:20 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 2 Jun 2009 17:20:55 +0000 (17:20 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2225 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/bus/kernel/bus_driver.c
core/bus/kernel/bus_port_mgr.c

index f50127c..8b19d35 100644 (file)
@@ -124,6 +124,38 @@ DriverEntry(
        IN                              UNICODE_STRING                          *p_registry_path );\r
 \r
 \r
+child_device_info_t g_default_device_info;\r
+\r
+static void __create_default_dev_info(child_device_info_t *pNewDevList)\r
+{\r
+       UNICODE_STRING                          keyValue;\r
+\r
+       /* DeviceId*/\r
+       RtlInitUnicodeString(&keyValue, L"IBA\\IPoIBP\0");              \r
+       pNewDevList->device_id_size = keyValue.Length + sizeof(WCHAR);\r
+       RtlStringCchCopyW( pNewDevList->device_id, \r
+               sizeof(pNewDevList->device_id)/sizeof(wchar_t), keyValue.Buffer );\r
+       /* HardwareId*/\r
+       RtlInitUnicodeString(&keyValue, L"IBA\\IPoIBP\0\0");    \r
+       pNewDevList->hardware_id_size = keyValue.Length + 2*sizeof(WCHAR);\r
+       RtlStringCchCopyW( pNewDevList->hardware_id, \r
+               sizeof(pNewDevList->hardware_id)/sizeof(wchar_t), keyValue.Buffer );\r
+       /* CompatibleId*/\r
+       RtlInitUnicodeString(&keyValue, L"IBA\\SID_1000066a00020000\0\0");      \r
+       pNewDevList->compatible_id_size = keyValue.Length + 2*sizeof(WCHAR); //2 \r
+       RtlStringCchCopyW( pNewDevList->compatible_id, \r
+               sizeof(pNewDevList->compatible_id)/sizeof(wchar_t), keyValue.Buffer );\r
+       /* Device Description */\r
+       RtlInitUnicodeString(&keyValue, L"OpenIB IPoIB Adapter");\r
+       pNewDevList->description_size = keyValue.Length + sizeof(WCHAR);\r
+       RtlStringCchCopyW( pNewDevList->description, \r
+               sizeof(pNewDevList->description)/sizeof(wchar_t), keyValue.Buffer );\r
+       /* Pkey */\r
+       RtlInitUnicodeString(&keyValue, L"FFFF");               /* Pkey */\r
+       RtlStringCchCopyW( pNewDevList->pkey, \r
+               sizeof(pNewDevList->pkey)/sizeof(wchar_t), keyValue.Buffer );\r
+}\r
+\r
 \r
 static void\r
 __read_machine_name( void )\r
@@ -250,8 +282,7 @@ static void _free_static_iodevices()
 \r
 }\r
 \r
-\r
-NTSTATUS _Create_Static_Devices(PUNICODE_STRING p_param_path)\r
+static NTSTATUS __create_static_devices(PUNICODE_STRING p_param_path)\r
 {\r
        RTL_QUERY_REGISTRY_TABLE        table[2];\r
        UNICODE_STRING                          keyPath;\r
@@ -273,7 +304,7 @@ NTSTATUS _Create_Static_Devices(PUNICODE_STRING p_param_path)
        {\r
                BUS_TRACE(BUS_DBG_ERROR ,("Not enough memory for key_path_buffer.\n") );\r
                status = STATUS_UNSUCCESSFUL;\r
-               goto _Create_Static_Devices_exit;\r
+               goto __create_static_devices_exit;\r
        }\r
 \r
        key_value_buffer = key_path_buffer + BUF_SIZE;\r
@@ -325,7 +356,7 @@ NTSTATUS _Create_Static_Devices(PUNICODE_STRING p_param_path)
                        {\r
                                BUS_TRACE(BUS_DBG_ERROR ,("Not enough memory for key_path_buffer.\n") );\r
                                status = STATUS_UNSUCCESSFUL;\r
-                               goto _Create_Static_Devices_exit;\r
+                               goto __create_static_devices_exit;\r
                        }\r
                        pNewDevList->next_device_info = NULL;\r
 \r
@@ -358,7 +389,7 @@ NTSTATUS _Create_Static_Devices(PUNICODE_STRING p_param_path)
                        if(!NT_SUCCESS(status))\r
                        {\r
                                BUS_TRACE(BUS_DBG_ERROR ,("Failed to read DeviceId.\n") );\r
-                               goto _Create_Static_Devices_exit;\r
+                               goto __create_static_devices_exit;\r
                        }\r
                        pNewDevList->io_device_info.device_id_size = keyValue.Length + sizeof(WCHAR);\r
 \r
@@ -381,7 +412,7 @@ NTSTATUS _Create_Static_Devices(PUNICODE_STRING p_param_path)
                        if(!NT_SUCCESS(status))\r
                        {\r
                                BUS_TRACE(BUS_DBG_ERROR ,("Failed to read HardwareId.\n") );\r
-                               goto _Create_Static_Devices_exit;\r
+                               goto __create_static_devices_exit;\r
                        }\r
                        pNewDevList->io_device_info.hardware_id_size = keyValue.Length + 2*sizeof(WCHAR);\r
 \r
@@ -404,7 +435,7 @@ NTSTATUS _Create_Static_Devices(PUNICODE_STRING p_param_path)
                        if(!NT_SUCCESS(status))\r
                        {\r
                                BUS_TRACE(BUS_DBG_ERROR ,("Failed to read CompatibleId.\n") );\r
-                               goto _Create_Static_Devices_exit;\r
+                               goto __create_static_devices_exit;\r
                        }\r
                        pNewDevList->io_device_info.compatible_id_size = keyValue.Length + 2*sizeof(WCHAR); //2 null\r
 \r
@@ -427,7 +458,7 @@ NTSTATUS _Create_Static_Devices(PUNICODE_STRING p_param_path)
                        if(!NT_SUCCESS(status))\r
                        {\r
                                BUS_TRACE(BUS_DBG_ERROR ,("Failed to read Description.\n") );\r
-                               goto _Create_Static_Devices_exit;\r
+                               goto __create_static_devices_exit;\r
                        }\r
 \r
                        pNewDevList->io_device_info.description_size = keyValue.Length + sizeof(WCHAR);\r
@@ -441,7 +472,7 @@ NTSTATUS _Create_Static_Devices(PUNICODE_STRING p_param_path)
                        {\r
                                BUS_TRACE(BUS_DBG_ERROR ,("Id or description size is too big.\n") );\r
                                status = STATUS_UNSUCCESSFUL;\r
-                               goto _Create_Static_Devices_exit;\r
+                               goto __create_static_devices_exit;\r
                        }\r
 \r
                        /* Get Pkey */\r
@@ -463,7 +494,7 @@ NTSTATUS _Create_Static_Devices(PUNICODE_STRING p_param_path)
                        if(!NT_SUCCESS(status))\r
                        {\r
                                BUS_TRACE(BUS_DBG_ERROR ,("Failed to read PartitionKey.\n") );\r
-                               goto _Create_Static_Devices_exit;\r
+                               goto __create_static_devices_exit;\r
                        }\r
 \r
                        while(*curChild) curChild++;\r
@@ -471,7 +502,7 @@ NTSTATUS _Create_Static_Devices(PUNICODE_STRING p_param_path)
                }\r
        }\r
 \r
-_Create_Static_Devices_exit:\r
+__create_static_devices_exit:\r
        if(key_path_buffer)\r
        {\r
                cl_free(key_path_buffer);\r
@@ -729,7 +760,7 @@ __read_registry(
                                BUS_TRACE(BUS_DBG_ERROR ,\r
                                                 ("Failed to build pkey configuration\n"));\r
 \r
-                       if(!NT_SUCCESS(_Create_Static_Devices(&param_path))){\r
+                       if(!NT_SUCCESS(__create_static_devices(&param_path))){\r
                                BUS_TRACE(BUS_DBG_ERROR ,\r
                                                 ("Failed to create devices\n"));\r
                        }\r
@@ -1031,6 +1062,9 @@ DriverEntry(
                return status;\r
        }\r
 \r
+       /* create default device descrition for Partition Manager */\r
+       __create_default_dev_info( &g_default_device_info );\r
+       \r
        /* Setup the entry points. */\r
        p_driver_obj->MajorFunction[IRP_MJ_CREATE] = bus_drv_open;\r
        p_driver_obj->MajorFunction[IRP_MJ_CLEANUP] = bus_drv_cleanup;\r
index 1b839c7..a0d083e 100644 (file)
@@ -1014,6 +1014,7 @@ cl_status_t port_mgr_pkey_rem( IN pkey_array_t *pkeys )
        return ( success_cnt ? CL_SUCCESS : CL_ERROR );\r
 }\r
 \r
+extern child_device_info_t g_default_device_info;\r
 \r
 /************************************************************************************\r
 * name :       port_mgr_pkey_add\r
@@ -1103,6 +1104,7 @@ cl_status_t _port_mgr_pkey_add( IN        pkey_array_t    *req_pkeys,
                pkey_port_ext->pdo.b_reported_missing = FALSE;\r
                pkey_port_ext->pdo.b_hibernating = FALSE;\r
                pkey_port_ext->pdo.p_po_work_item = NULL;\r
+               pkey_port_ext->pdo.p_pdo_device_info = &g_default_device_info;\r
                BUS_TRACE( BUS_DBG_PNP, ("Created device for %s: PDO %p,ext %p, present %d, missing %d .\n",\r
                        pkey_port_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_pdo[cnt], pkey_port_ext, pkey_port_ext->pdo.b_present, \r
                        pkey_port_ext->pdo.b_reported_missing ) );\r