TRUE,\r
NULL,\r
NULL,\r
+ NULL,\r
NULL\r
};\r
\r
j = 0;\r
\r
for (i = 0; (i < str_len) && (cur_pkey->pkey_num < MAX_NUM_PKEY) ; i++)\r
- {\r
+ {\r
if(str[i] == ' ')\r
continue;\r
\r
BUS_EXIT( BUS_DBG_DRV );\r
}\r
\r
+\r
+static void _free_static_iodevices()\r
+{\r
+ child_device_info_list_t *pDevList, *pDevList1;\r
+\r
+ pDevList = bus_globals.p_device_list;\r
+\r
+ while(pDevList)\r
+ {\r
+ pDevList1 = pDevList->next_device_info;\r
+ cl_free(pDevList);\r
+ pDevList = pDevList1;\r
+ }\r
+\r
+}\r
+\r
+\r
+NTSTATUS _Create_Static_Devices(PUNICODE_STRING p_param_path)\r
+{\r
+ RTL_QUERY_REGISTRY_TABLE table[2];\r
+ UNICODE_STRING keyPath;\r
+ UNICODE_STRING keyValue;\r
+ UNICODE_STRING defaultKeyValue;\r
+ UNICODE_STRING child_name;\r
+ WCHAR *key_path_buffer;\r
+ WCHAR *key_value_buffer;\r
+ WCHAR *static_child_name;\r
+ NTSTATUS status;\r
+ #define BUF_SIZE 256 /* use hard-coded size to make it simple*/\r
+\r
+ cl_memclr( table, sizeof(table) );\r
+\r
+ \r
+ key_path_buffer = cl_zalloc(BUF_SIZE*sizeof(WCHAR)*3);\r
+\r
+ if(!key_path_buffer)\r
+ {\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
+ }\r
+\r
+ key_value_buffer = key_path_buffer + BUF_SIZE;\r
+ static_child_name = key_value_buffer + BUF_SIZE;\r
+\r
+ RtlInitUnicodeString( &keyPath, NULL );\r
+ keyPath.MaximumLength = BUF_SIZE*sizeof(WCHAR);\r
+ keyPath.Buffer = key_path_buffer;\r
+\r
+ RtlInitUnicodeString( &keyValue, NULL );\r
+ keyValue.MaximumLength = BUF_SIZE*sizeof(WCHAR);\r
+ keyValue.Buffer = key_value_buffer;\r
+\r
+ RtlInitUnicodeString( &child_name, NULL );\r
+ child_name.MaximumLength = BUF_SIZE*sizeof(WCHAR);\r
+ child_name.Buffer = static_child_name;\r
+\r
+\r
+ RtlCopyUnicodeString( &keyPath, p_param_path );\r
+\r
+ RtlInitUnicodeString(&defaultKeyValue, L"IPoIB\0\0");\r
+\r
+ /* Setup the table entries. */\r
+ table[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_NOEXPAND;\r
+ table[0].Name = L"StaticChild";\r
+ table[0].EntryContext = &child_name;\r
+ table[0].DefaultType = REG_MULTI_SZ;\r
+ table[0].DefaultData = defaultKeyValue.Buffer;\r
+ table[0].DefaultLength = defaultKeyValue.Length;\r
+\r
+ status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, \r
+ keyPath.Buffer, table, NULL, NULL );\r
+\r
+ if(NT_SUCCESS(status))\r
+ {\r
+ WCHAR *curChild;\r
+ child_device_info_list_t *pPrevList, *pNewDevList;\r
+\r
+ curChild = static_child_name;\r
+ pPrevList = bus_globals.p_device_list;\r
+ while(*curChild)\r
+ {\r
+ RtlCopyUnicodeString(&keyPath, p_param_path);\r
+ RtlAppendUnicodeToString(&keyPath, L"\\");\r
+ RtlAppendUnicodeToString(&keyPath, curChild);\r
+\r
+ pNewDevList = cl_zalloc(sizeof(child_device_info_list_t));\r
+ if(!pNewDevList)\r
+ {\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
+ }\r
+ pNewDevList->next_device_info = NULL;\r
+\r
+ if(pPrevList == NULL)\r
+ {\r
+ bus_globals.p_device_list = pNewDevList;\r
+ }else\r
+ {\r
+ pPrevList->next_device_info = pNewDevList;\r
+ }\r
+\r
+ pPrevList = pNewDevList;\r
+\r
+ /* get DeviceId*/\r
+ RtlInitUnicodeString(&defaultKeyValue, L"IBA\\IPoIB\0");\r
+ RtlInitUnicodeString( &keyValue, NULL );\r
+ keyValue.MaximumLength = sizeof(pNewDevList->io_device_info.device_id);\r
+ keyValue.Buffer = pNewDevList->io_device_info.device_id;\r
+\r
+ /* Setup the table entries. */\r
+ table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
+ table[0].Name = L"DeviceId";\r
+ table[0].EntryContext = &keyValue; \r
+ table[0].DefaultType = REG_SZ;\r
+ table[0].DefaultData = defaultKeyValue.Buffer;\r
+ table[0].DefaultLength = defaultKeyValue.Length;\r
+\r
+ status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, \r
+ keyPath.Buffer, table, NULL, NULL );\r
+ if(!NT_SUCCESS(status))\r
+ {\r
+ BUS_TRACE(BUS_DBG_ERROR ,("Failed to read DeviceId.\n") );\r
+ goto _Create_Static_Devices_exit;\r
+ }\r
+ pNewDevList->io_device_info.device_id_size = keyValue.Length + sizeof(WCHAR);\r
+\r
+ /* Get HardwareId*/\r
+ RtlInitUnicodeString(&defaultKeyValue, L"IBA\\IPoIB\0\0");\r
+ RtlInitUnicodeString( &keyValue, NULL );\r
+ keyValue.MaximumLength = sizeof(pNewDevList->io_device_info.hardware_id);\r
+ keyValue.Buffer = pNewDevList->io_device_info.hardware_id;\r
+\r
+ /* Setup the table entries. */\r
+ table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
+ table[0].Name = L"HardwareId";\r
+ table[0].EntryContext = &keyValue; \r
+ table[0].DefaultType = REG_MULTI_SZ;\r
+ table[0].DefaultData = defaultKeyValue.Buffer;\r
+ table[0].DefaultLength = defaultKeyValue.Length;\r
+\r
+ status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, \r
+ keyPath.Buffer, table, NULL, NULL );\r
+ if(!NT_SUCCESS(status))\r
+ {\r
+ BUS_TRACE(BUS_DBG_ERROR ,("Failed to read HardwareId.\n") );\r
+ goto _Create_Static_Devices_exit;\r
+ }\r
+ pNewDevList->io_device_info.hardware_id_size = keyValue.Length + 2*sizeof(WCHAR);\r
+\r
+ /* Get CompatibleId*/\r
+ RtlInitUnicodeString(&defaultKeyValue, L"IBA\\SID_1000066a00020000\0\0");\r
+ RtlInitUnicodeString( &keyValue, NULL );\r
+ keyValue.MaximumLength = sizeof(pNewDevList->io_device_info.compatible_id);\r
+ keyValue.Buffer = pNewDevList->io_device_info.compatible_id;\r
+\r
+ /* Setup the table entries. */\r
+ table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
+ table[0].Name = L"CompatibleId";\r
+ table[0].EntryContext = &keyValue; \r
+ table[0].DefaultType = REG_MULTI_SZ;\r
+ table[0].DefaultData = defaultKeyValue.Buffer;\r
+ table[0].DefaultLength = defaultKeyValue.Length;\r
+\r
+ status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, \r
+ keyPath.Buffer, table, NULL, NULL );\r
+ if(!NT_SUCCESS(status))\r
+ {\r
+ BUS_TRACE(BUS_DBG_ERROR ,("Failed to read CompatibleId.\n") );\r
+ goto _Create_Static_Devices_exit;\r
+ }\r
+ pNewDevList->io_device_info.compatible_id_size = keyValue.Length + 2*sizeof(WCHAR); //2 null\r
+\r
+ /* Get Description*/\r
+ RtlInitUnicodeString(&defaultKeyValue, L"OpenIB IPoIB Adapter");\r
+ RtlInitUnicodeString( &keyValue, NULL );\r
+ keyValue.MaximumLength = sizeof(pNewDevList->io_device_info.description);\r
+ keyValue.Buffer = pNewDevList->io_device_info.description;\r
+\r
+ /* Setup the table entries. */\r
+ table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
+ table[0].Name = L"Description";\r
+ table[0].EntryContext = &keyValue; \r
+ table[0].DefaultType = REG_SZ;\r
+ table[0].DefaultData = defaultKeyValue.Buffer;\r
+ table[0].DefaultLength = defaultKeyValue.Length;\r
+\r
+ status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, \r
+ keyPath.Buffer, table, NULL, NULL );\r
+ if(!NT_SUCCESS(status))\r
+ {\r
+ BUS_TRACE(BUS_DBG_ERROR ,("Failed to read Description.\n") );\r
+ goto _Create_Static_Devices_exit;\r
+ }\r
+\r
+ pNewDevList->io_device_info.description_size = keyValue.Length + sizeof(WCHAR);\r
+\r
+\r
+ if((pNewDevList->io_device_info.description_size > MAX_DEVICE_ID_LEN) ||\r
+ (pNewDevList->io_device_info.hardware_id_size > MAX_DEVICE_ID_LEN) ||\r
+ (pNewDevList->io_device_info.compatible_id_size > MAX_DEVICE_ID_LEN) ||\r
+ (pNewDevList->io_device_info.device_id_size > MAX_DEVICE_ID_LEN)\r
+ )\r
+ {\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
+ }\r
+\r
+ /* Get Pkey */\r
+ RtlInitUnicodeString(&defaultKeyValue, L"FFFF");\r
+ RtlInitUnicodeString( &keyValue, NULL );\r
+ keyValue.MaximumLength = sizeof(pNewDevList->io_device_info.pkey);\r
+ keyValue.Buffer = pNewDevList->io_device_info.pkey;\r
+\r
+ /* Setup the table entries. */\r
+ table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
+ table[0].Name = L"PartitionKey";\r
+ table[0].EntryContext = &keyValue; \r
+ table[0].DefaultType = REG_SZ;\r
+ table[0].DefaultData = defaultKeyValue.Buffer;\r
+ table[0].DefaultLength = defaultKeyValue.Length;\r
+\r
+ status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, \r
+ keyPath.Buffer, table, NULL, NULL );\r
+ if(!NT_SUCCESS(status))\r
+ {\r
+ BUS_TRACE(BUS_DBG_ERROR ,("Failed to read PartitionKey.\n") );\r
+ goto _Create_Static_Devices_exit;\r
+ }\r
+\r
+ while(*curChild) curChild++;\r
+ curChild++;\r
+ }\r
+ }\r
+\r
+_Create_Static_Devices_exit:\r
+ if(key_path_buffer)\r
+ {\r
+ cl_free(key_path_buffer);\r
+ }\r
+\r
+ if(!NT_SUCCESS(status))\r
+ {\r
+ _free_static_iodevices();\r
+ }\r
+\r
+ return status;\r
+}\r
+\r
static pkey_conf_t*\r
create_pkey_conf(pkey_conf_t **pp_cur_conf, char *guid_str, uint32_t guid_str_len)\r
{\r
if( !NT_SUCCESS(__build_pkeys_per_port(&pkeyString)))\r
BUS_TRACE(BUS_DBG_ERROR ,\r
("Failed to build pkey configuration\n"));\r
+\r
+ if(!NT_SUCCESS(_Create_Static_Devices(¶m_path))){\r
+ BUS_TRACE(BUS_DBG_ERROR ,\r
+ ("Failed to create devices\n"));\r
+ }\r
}\r
#if DBG\r
if( g_al_dbg_flags & AL_DBG_ERR )\r
pIoStack = IoGetCurrentIrpStackLocation(h_ioctl);\r
if ( (! h_ioctl->AssociatedIrp.SystemBuffer) || \r
pIoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof (pkey_array_t))\r
- {\r
+ {\r
BUS_TRACE_EXIT( BUS_DBG_ERROR, \r
("Invalid parameters.\n") );\r
return CL_INVALID_PARAMETER;\r
pIoStack = IoGetCurrentIrpStackLocation(h_ioctl);\r
if ( (! h_ioctl->AssociatedIrp.SystemBuffer) || \r
pIoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof (pkey_array_t))\r
- {\r
+ {\r
BUS_TRACE_EXIT( BUS_DBG_ERROR, \r
("Invalid parameters.\n") );\r
return CL_INVALID_PARAMETER;\r
cur_conf = cur_conf->next_conf;\r
cl_free(tmp);\r
}\r
+\r
+ _free_static_iodevices();\r
+\r
+\r
CL_DEINIT;\r
\r
#if defined(EVENT_TRACING)\r
} bus_fdo_ext_t;\r
\r
\r
+/* Windows pnp device information */\r
+#define MAX_DEVICE_ID_LEN 200\r
+#define MAX_DEVICE_STRING_LEN MAX_DEVICE_ID_LEN + 2 //add extra 4 bytes in case we need double NULL ending\r
+typedef struct _child_device_info {\r
+ wchar_t device_id[MAX_DEVICE_STRING_LEN]; \r
+ uint32_t device_id_size;\r
+ wchar_t compatible_id[MAX_DEVICE_STRING_LEN];\r
+ uint32_t compatible_id_size;\r
+ wchar_t hardware_id[MAX_DEVICE_STRING_LEN];\r
+ uint32_t hardware_id_size;\r
+ wchar_t description[MAX_DEVICE_STRING_LEN];\r
+ uint32_t description_size;\r
+ wchar_t pkey[20];\r
+} child_device_info_t;\r
+\r
+typedef struct _child_device_info_list{\r
+ child_device_info_t io_device_info;\r
+ struct _child_device_info_list *next_device_info;\r
+}child_device_info_list_t;\r
+\r
+\r
/*\r
* Device extension for bus driver PDOs.\r
*/\r
\r
/* work item for handling Power Management request */\r
PIO_WORKITEM p_po_work_item;\r
- boolean_t is_partition_pdo;\r
+ boolean_t hca_acquired;\r
+ child_device_info_t *p_pdo_device_info;\r
} bus_pdo_ext_t;\r
\r
/* pkey configuration */\r
struct _pkey_conf_t *next_conf;\r
}pkey_conf_t;\r
\r
+\r
/*\r
* Global Driver parameters.\r
*/\r
/* pkey array to be read */\r
pkey_conf_t *p_pkey_conf;\r
\r
+ /* saved devices info*/\r
+ child_device_info_list_t *p_device_list;\r
+\r
} bus_globals_t;\r
\r
\r
#include "iba/ipoib_ifc.h"\r
#include "al_dev.h"\r
\r
-#define IPOIB_PART_DEVICE_ID L"IBA\\IPoIBP"\r
-#define IPOIB_DEVICE_ID L"IBA\\IPoIB"\r
-#define IPOIB_COMPAT_ID L"IBA\\SID_1000066a00020000\0\0"\r
-/* Hardware ID is a MULTI_SZ, so is terminated with a double NULL. */\r
-#define IPOIB_HARDWARE_ID IPOIB_DEVICE_ID L"\0"\r
-#define IPOIB_PART_HARDWARE_ID IPOIB_PART_DEVICE_ID L"\0"\r
-#define IPOIB_DESCRIPTION L"OpenIB IPoIB Adapter"\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
IN DEVICE_OBJECT* const p_dev_obj,\r
IN IRP* const p_irp );\r
\r
+\r
static NTSTATUS\r
port_query_location(\r
IN DEVICE_OBJECT* const p_dev_obj,\r
* instances of Port PDOs.\r
*/\r
static const cl_vfptr_pnp_po_t vfptr_port_pnp = {\r
- "IPoIB",\r
+ "IODEVICE",\r
port_start,\r
cl_irp_succeed,\r
cl_irp_succeed,\r
};\r
\r
\r
+\r
/*\r
* Create the AL load service.\r
*/\r
p_ext, p_ext->b_present, p_ext->b_reported_missing ) );\r
continue;\r
}\r
- if( p_ext->h_ca && (!p_ext->is_partition_pdo))\r
+ if( p_ext->h_ca && p_ext->hca_acquired )\r
{\r
/* Invalidate bus relations for the HCA. */\r
IoInvalidateDeviceRelations(\r
IN ib_pnp_port_rec_t* p_pnp_rec )\r
{\r
NTSTATUS status;\r
- DEVICE_OBJECT *p_pdo[MAX_NUM_PKEY + 1];\r
- uint8_t num_pdo;\r
+ DEVICE_OBJECT *p_pdo; \r
bus_port_ext_t *p_port_ext;\r
- ib_net16_t pdo_cnt;\r
- pkey_conf_t *cur_conf; \r
- pkey_array_t *cur_pkeys = NULL;\r
bus_filter_t *p_bfi;\r
port_mgr_t *p_port_mgr;\r
port_pnp_ctx_t *p_ctx = p_pnp_rec->pnp_rec.context;\r
+ child_device_info_list_t *pCurList;\r
+ ib_ca_handle_t h_ca = NULL;\r
+ ULONG pKey;\r
+ UNICODE_STRING uniKey;\r
+\r
\r
BUS_ENTER( BUS_DBG_PNP );\r
\r
p_bfi->whoami, p_bfi->ca_guid, \r
p_pnp_rec->p_port_attr->port_num,p_ctx));\r
}\r
+\r
p_port_mgr = p_bfi->p_port_mgr;\r
\r
if( !bus_globals.b_report_port_nic )\r
return status;\r
}\r
\r
- cur_conf = bus_globals.p_pkey_conf;\r
- while(cur_conf)\r
- {\r
- if(p_pnp_rec->p_port_attr->port_guid == cur_conf->pkeys_per_port.port_guid)\r
- {\r
- cur_pkeys = &cur_conf->pkeys_per_port;\r
- break;\r
- }\r
- cur_conf = cur_conf->next_conf;\r
- }\r
- p_port_ext = NULL;\r
-\r
- if( !cur_pkeys)\r
- pdo_cnt = 1;\r
- else\r
- pdo_cnt = cur_conf->pkeys_per_port.pkey_num + 1;\r
+ pCurList = bus_globals.p_device_list;\r
\r
- for (num_pdo = 0; num_pdo < pdo_cnt; num_pdo++)\r
- {\r
+ while(pCurList)\r
+ {\r
/* Create the PDO for the new port device. */\r
status = IoCreateDevice( bus_globals.p_driver_obj,\r
sizeof(bus_port_ext_t),\r
NULL, FILE_DEVICE_CONTROLLER,\r
FILE_DEVICE_SECURE_OPEN |\r
- FILE_AUTOGENERATED_DEVICE_NAME,\r
- FALSE, &p_pdo[num_pdo] );\r
+ FILE_AUTOGENERATED_DEVICE_NAME,\r
+ FALSE, &p_pdo );\r
if( !NT_SUCCESS( status ) )\r
{\r
BUS_TRACE_EXIT( BUS_DBG_ERROR,\r
}\r
\r
/* clean the extension (must be before initializing) */\r
- p_port_ext = p_pdo[num_pdo]->DeviceExtension;\r
+ p_port_ext = p_pdo->DeviceExtension;\r
memset( p_port_ext, 0, sizeof(bus_port_ext_t) );\r
\r
/* Initialize the device extension. */\r
- cl_init_pnp_po_ext( p_pdo[num_pdo], NULL, p_pdo[num_pdo],\r
+ cl_init_pnp_po_ext( p_pdo, NULL, p_pdo,\r
bus_globals.dbg_lvl, &vfptr_port_pnp,\r
&vfptr_port_query_txt );\r
\r
/* Set the DO_BUS_ENUMERATED_DEVICE flag to mark it as a PDO. */\r
- p_pdo[num_pdo]->Flags |= DO_BUS_ENUMERATED_DEVICE;\r
+ p_pdo->Flags |= DO_BUS_ENUMERATED_DEVICE;\r
\r
p_port_ext->pdo.dev_po_state.DeviceState = PowerDeviceD0;\r
p_port_ext->pdo.p_parent_ext = p_bfi->p_bus_ext;\r
p_port_ext->pdo.b_reported_missing = FALSE;\r
p_port_ext->pdo.b_hibernating = FALSE;\r
p_port_ext->pdo.p_po_work_item = NULL;\r
+ p_port_ext->pdo.p_pdo_device_info = &pCurList->io_device_info;\r
BUS_TRACE( BUS_DBG_PNP,\r
("Created %s %s: PDO %p,ext %p, present %d, missing %d .\n",\r
p_bfi->whoami,\r
- p_port_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_pdo[num_pdo],\r
+ p_port_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_pdo,\r
p_port_ext, p_port_ext->pdo.b_present,\r
p_port_ext->pdo.b_reported_missing ) );\r
\r
/* Cache the CA GUID. */\r
p_port_ext->pdo.ca_guid = p_pnp_rec->p_ca_attr->ca_guid;\r
\r
- /* Take a reference on the parent HCA. */\r
- if(num_pdo > 0)\r
+ /*Only acquire one hca for each port*/\r
+ if(h_ca)\r
{\r
- p_port_ext->pdo.h_ca = ((bus_port_ext_t*)p_pdo[0]->DeviceExtension)->pdo.h_ca;\r
- p_port_ext->pdo.is_partition_pdo = TRUE;\r
+ p_port_ext->pdo.h_ca = h_ca;\r
+ p_port_ext->pdo.hca_acquired = FALSE;\r
+ }else\r
+ {\r
+ /* Acquire CA for the first child pdo*/\r
+ h_ca = p_port_ext->pdo.h_ca = acquire_ca( p_pnp_rec->p_ca_attr->ca_guid );\r
+ p_port_ext->pdo.hca_acquired = TRUE;\r
}\r
- else\r
- p_port_ext->pdo.h_ca = acquire_ca( p_pnp_rec->p_ca_attr->ca_guid );\r
\r
if( !p_port_ext->pdo.h_ca )\r
{\r
- BUS_TRACE( BUS_DBG_PNP, ("Deleted device: PDO %p\n", p_pdo[num_pdo]));\r
- IoDeleteDevice( p_pdo[num_pdo]);\r
+ BUS_TRACE( BUS_DBG_PNP, ("Deleted device: PDO %p\n", p_pdo));\r
+ IoDeleteDevice( p_pdo);\r
BUS_TRACE_EXIT( BUS_DBG_ERROR, ("acquire_ca failed to find CA.\n") );\r
return IB_INVALID_GUID;\r
}\r
+\r
p_port_ext->port_guid.guid = p_pnp_rec->p_port_attr->port_guid;\r
p_port_ext->n_port = p_pnp_rec->p_port_attr->port_num;\r
- p_port_ext->port_guid.pkey = IB_DEFAULT_PKEY;\r
+\r
+ RtlInitUnicodeString(&uniKey, pCurList->io_device_info.pkey);\r
+ RtlUnicodeStringToInteger(&uniKey,16,&pKey);\r
+ p_port_ext->port_guid.pkey = (ib_net16_t)pKey;\r
+\r
p_port_ext->n_ifc_ref = 0;\r
\r
- if(num_pdo > 0)\r
- p_port_ext->port_guid.pkey = cur_pkeys->pkey_array[num_pdo -1];\r
\r
/* Store the device extension in the port vector for future queries. */\r
cl_mutex_acquire( &p_port_mgr->pdo_mutex );\r
* Set the context of the PNP event. The context is passed in for future\r
* events on the same port.\r
*/\r
- if(num_pdo == 0) \r
+ if(p_port_ext->pdo.hca_acquired)\r
+ {\r
p_ctx->p_pdo_ext = p_port_ext;\r
- }\r
+ }\r
\r
- /* Tell the PnP Manager to rescan for the HCA's bus relations. */\r
- IoInvalidateDeviceRelations(\r
- p_port_ext->pdo.h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
+ pCurList = pCurList->next_device_info;\r
+\r
+ /* Tell the PnP Manager to rescan for the HCA's bus relations. */\r
+ IoInvalidateDeviceRelations(\r
+ p_port_ext->pdo.h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
+ }\r
\r
/* Invalidate removal relations for the bus driver. */\r
IoInvalidateDeviceRelations(\r
return IB_SUCCESS;\r
}\r
\r
+\r
+\r
/************************************************************************************\r
* name : port_mgr_pkey_rem\r
* removes pdo for each pkey value in pkey_array \r
pkey_port_ext->port_guid.guid = pmatched_guid_ext->port_guid.guid;\r
pkey_port_ext->n_port = pmatched_guid_ext->n_port;\r
pkey_port_ext->port_guid.pkey = req_pkeys->pkey_array[cnt];\r
- pkey_port_ext->pdo.is_partition_pdo = TRUE;\r
/* Store the device extension in the port vector for future queries. */\r
cl_mutex_acquire( &p_port_mgr->pdo_mutex );\r
cl_qlist_insert_tail( &p_port_mgr->port_list,\r
BUS_TRACE_EXIT( BUS_DBG_ERROR, ("Device not present.\n") );\r
return STATUS_NO_SUCH_DEVICE;\r
}\r
- if(p_ext->port_guid.pkey == IB_DEFAULT_PKEY)\r
- dev_id_size = sizeof(IPOIB_DEVICE_ID);\r
- else\r
- dev_id_size = sizeof(IPOIB_PART_DEVICE_ID );\r
- /* Device ID is "IBA\SID_<sid> where <sid> is the IPoIB Service ID. */\r
+\r
+ dev_id_size = p_ext->pdo.p_pdo_device_info->device_id_size;\r
+\r
+ /* Device ID is "IBA\SID_<sid> where <sid> is the IO device Service ID. */\r
p_string = ExAllocatePoolWithTag( PagedPool, dev_id_size, 'vedq' );\r
if( !p_string )\r
{\r
return STATUS_INSUFFICIENT_RESOURCES;\r
}\r
\r
- if(p_ext->port_guid.pkey == IB_DEFAULT_PKEY)\r
- cl_memcpy( p_string, IPOIB_DEVICE_ID, sizeof(IPOIB_DEVICE_ID) );\r
- else\r
- cl_memcpy( p_string, IPOIB_PART_DEVICE_ID, sizeof(IPOIB_PART_DEVICE_ID) );\r
+ RtlZeroMemory(p_string, dev_id_size);\r
+\r
+ cl_memcpy( p_string, p_ext->pdo.p_pdo_device_info->device_id, dev_id_size );\r
+\r
p_irp->IoStatus.Information = (ULONG_PTR)p_string;\r
\r
BUS_EXIT( BUS_DBG_PNP );\r
\r
p_ext = (bus_port_ext_t*)p_dev_obj->DeviceExtension;\r
\r
- if(p_ext->port_guid.pkey == IB_DEFAULT_PKEY)\r
- dev_id_size = sizeof(IPOIB_HARDWARE_ID);\r
- else\r
- dev_id_size = sizeof(IPOIB_PART_HARDWARE_ID );\r
+ dev_id_size = p_ext->pdo.p_pdo_device_info->hardware_id_size;\r
\r
p_string = ExAllocatePoolWithTag( PagedPool, dev_id_size, 'ihqp' );\r
if( !p_string )\r
dev_id_size) );\r
return STATUS_INSUFFICIENT_RESOURCES;\r
}\r
- if(p_ext->port_guid.pkey == IB_DEFAULT_PKEY)\r
- cl_memcpy( p_string, IPOIB_HARDWARE_ID, sizeof(IPOIB_HARDWARE_ID) );\r
- else\r
- cl_memcpy( p_string, IPOIB_PART_HARDWARE_ID, sizeof(IPOIB_PART_HARDWARE_ID) );\r
+\r
+ RtlZeroMemory(p_string, dev_id_size);\r
+\r
+ cl_memcpy( p_string, p_ext->pdo.p_pdo_device_info->hardware_id, dev_id_size );\r
+\r
p_irp->IoStatus.Information = (ULONG_PTR)p_string;\r
\r
BUS_EXIT( BUS_DBG_PNP );\r
OUT IRP* const p_irp )\r
{\r
WCHAR *p_string;\r
+ bus_port_ext_t *p_ext;\r
+ size_t dev_id_size;\r
\r
BUS_ENTER( BUS_DBG_PNP );\r
\r
- UNUSED_PARAM( p_dev_obj );\r
+ p_ext = (bus_port_ext_t*)p_dev_obj->DeviceExtension;\r
+\r
+ dev_id_size = p_ext->pdo.p_pdo_device_info->compatible_id_size;\r
\r
- p_string = ExAllocatePoolWithTag( PagedPool, sizeof(IPOIB_COMPAT_ID), 'icqp' );\r
+ p_string = ExAllocatePoolWithTag( PagedPool, dev_id_size, 'ihqp' );\r
if( !p_string )\r
{\r
BUS_TRACE_EXIT( BUS_DBG_ERROR,\r
- ("Failed to allocate compatible ID buffer (%d bytes).\n",\r
- sizeof(IPOIB_COMPAT_ID)) );\r
+ ("Failed to allocate hardware ID buffer (%d bytes).\n",\r
+ dev_id_size) );\r
return STATUS_INSUFFICIENT_RESOURCES;\r
}\r
- cl_memcpy( p_string, IPOIB_COMPAT_ID, sizeof(IPOIB_COMPAT_ID) );\r
+\r
+ RtlZeroMemory(p_string, dev_id_size);\r
+\r
+ cl_memcpy( p_string, p_ext->pdo.p_pdo_device_info->compatible_id, dev_id_size );\r
+\r
p_irp->IoStatus.Information = (ULONG_PTR)p_string;\r
\r
BUS_EXIT( BUS_DBG_PNP );\r
}\r
\r
\r
- /* The instance ID is the port GUID. */\r
- p_string = ExAllocatePoolWithTag( PagedPool, sizeof(IPOIB_DESCRIPTION), 'edqp' );\r
+ p_string = ExAllocatePoolWithTag( PagedPool, p_ext->pdo.p_pdo_device_info->description_size, 'edqp' );\r
+\r
if( !p_string )\r
{\r
BUS_TRACE_EXIT( BUS_DBG_ERROR,\r
("Failed to allocate device description buffer (%d bytes).\n",\r
- sizeof(IPOIB_DESCRIPTION)) );\r
+ p_ext->pdo.p_pdo_device_info->description_size) );\r
return STATUS_INSUFFICIENT_RESOURCES;\r
}\r
- cl_memcpy( p_string, IPOIB_DESCRIPTION, sizeof(IPOIB_DESCRIPTION) );\r
+\r
+ RtlZeroMemory(p_string,p_ext->pdo.p_pdo_device_info->description_size);\r
+\r
+ cl_memcpy( p_string, p_ext->pdo.p_pdo_device_info->description, p_ext->pdo.p_pdo_device_info->description_size );\r
+\r
p_irp->IoStatus.Information = (ULONG_PTR)p_string;\r
\r
BUS_EXIT( BUS_DBG_PNP );\r
BUS_EXIT( BUS_DBG_POWER );\r
return status;\r
}\r
+\r
+\r
+\r
HKR,"Parameters","DebugFlags",%REG_DWORD%,0x80000000\r
HKR,"Parameters","ReportPortNIC",%REG_DWORD%,1\r
\r
+HKR,"Parameters","StaticChild",%REG_MULTI_SZ%,IPoIB\r
+;use the following line to add your device\r
+;HKR,"Parameters","StaticChild",%REG_MULTI_SZ_APPEND%,"XsigoBus"\r
+\r
+HKR,"Parameters\IPoIB","DeviceId",%REG_SZ%,"IBA\IPoIB"\r
+HKR,"Parameters\IPoIB","CompatibleId",%REG_MULTI_SZ%,"IBA\SID_1000066a00020000"\r
+HKR,"Parameters\IPoIB","HardwareId",%REG_MULTI_SZ%,"IBA\IPoIB"\r
+HKR,"Parameters\IPoIB","Description",%REG_SZ%,"OpenIB IPoIB Adapter"\r
+HKR,"Parameters\IPoIB","PartitionKey",%REG_SZ%,"FFFF"\r
+\r
+HKR,"Parameters\XsigoBus","DeviceId",%REG_SZ%,"IBA\XsigoBus"\r
+HKR,"Parameters\XsigoBus","CompatibleId",%REG_MULTI_SZ%,"IBA\SID_0000000002139702"\r
+HKR,"Parameters\XsigoBus","HardwareId",%REG_MULTI_SZ%,"IBA\XsigoBus"\r
+HKR,"Parameters\XsigoBus","Description",%REG_SZ%,"Xsigo Virtual Bus"\r
+HKR,"Parameters\XsigoBus","PartitionKey",%REG_SZ%,"FFFF"\r
+\r
;*****************************************\r
; WinVerbs Service Install section\r
;*****************************************\r
SERVICE_ERROR_NORMAL = 1\r
REG_DWORD = 0x00010001\r
REG_DWORD_NO_CLOBBER = 0x00010003\r
+REG_MULTI_SZ = 0x00010000\r
REG_MULTI_SZ_APPEND = 0x00010008\r
DIRID_SYSTEM = 11\r
DIRID_DRIVERS = 12\r
HKR,"Parameters","DebugFlags",%REG_DWORD%,0x80000000\r
HKR,"Parameters","ReportPortNIC",%REG_DWORD%,1\r
\r
+HKR,"Parameters","StaticChild",%REG_MULTI_SZ%,IPoIB\r
+;use the following line to add your device\r
+;HKR,"Parameters","StaticChild",%REG_MULTI_SZ_APPEND%,"XsigoBus"\r
+\r
+HKR,"Parameters\IPoIB","DeviceId",%REG_SZ%,"IBA\IPoIB"\r
+HKR,"Parameters\IPoIB","CompatibleId",%REG_MULTI_SZ%,"IBA\SID_1000066a00020000"\r
+HKR,"Parameters\IPoIB","HardwareId",%REG_MULTI_SZ%,"IBA\IPoIB"\r
+HKR,"Parameters\IPoIB","Description",%REG_SZ%,"OpenIB IPoIB Adapter"\r
+HKR,"Parameters\IPoIB","PartitionKey",%REG_SZ%,"FFFF"\r
+\r
+HKR,"Parameters\XsigoBus","DeviceId",%REG_SZ%,"IBA\XsigoBus"\r
+HKR,"Parameters\XsigoBus","CompatibleId",%REG_MULTI_SZ%,"IBA\SID_0000000002139702"\r
+HKR,"Parameters\XsigoBus","HardwareId",%REG_MULTI_SZ%,"IBA\XsigoBus"\r
+HKR,"Parameters\XsigoBus","Description",%REG_SZ%,"Xsigo Virtual Bus"\r
+HKR,"Parameters\XsigoBus","PartitionKey",%REG_SZ%,"FFFF"\r
\r
; ============= WinVerbs Service Install section ==============\r
\r
SERVICE_ERROR_NORMAL = 1\r
REG_DWORD = 0x00010001\r
REG_DWORD_NO_CLOBBER = 0x00010003\r
+REG_MULTI_SZ = 0x00010000\r
REG_MULTI_SZ_APPEND = 0x00010008\r
DIRID_SYSTEM = 11\r
DIRID_DRIVERS = 12\r