⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipr.c

📁 linux 内核源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
			ipr_send_hcam(ioa_cfg,				      IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE,				      hostrcb);			return;		}		res = list_entry(ioa_cfg->free_res_q.next,				 struct ipr_resource_entry, queue);		list_del(&res->queue);		ipr_init_res_entry(res);		list_add_tail(&res->queue, &ioa_cfg->used_res_q);	}	memcpy(&res->cfgte, cfgte, sizeof(struct ipr_config_table_entry));	if (hostrcb->hcam.notify_type == IPR_HOST_RCB_NOTIF_TYPE_REM_ENTRY) {		if (res->sdev) {			res->del_from_ml = 1;			res->cfgte.res_handle = IPR_INVALID_RES_HANDLE;			if (ioa_cfg->allow_ml_add_del)				schedule_work(&ioa_cfg->work_q);		} else			list_move_tail(&res->queue, &ioa_cfg->free_res_q);	} else if (!res->sdev) {		res->add_to_ml = 1;		if (ioa_cfg->allow_ml_add_del)			schedule_work(&ioa_cfg->work_q);	}	ipr_send_hcam(ioa_cfg, IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE, hostrcb);}/** * ipr_process_ccn - Op done function for a CCN. * @ipr_cmd:	ipr command struct * * This function is the op done function for a configuration * change notification host controlled async from the adapter. * * Return value: * 	none **/static void ipr_process_ccn(struct ipr_cmnd *ipr_cmd){	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;	struct ipr_hostrcb *hostrcb = ipr_cmd->u.hostrcb;	u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);	list_del(&hostrcb->queue);	list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);	if (ioasc) {		if (ioasc != IPR_IOASC_IOA_WAS_RESET)			dev_err(&ioa_cfg->pdev->dev,				"Host RCB failed with IOASC: 0x%08X\n", ioasc);		ipr_send_hcam(ioa_cfg, IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE, hostrcb);	} else {		ipr_handle_config_change(ioa_cfg, hostrcb);	}}/** * strip_and_pad_whitespace - Strip and pad trailing whitespace. * @i:		index into buffer * @buf:		string to modify * * This function will strip all trailing whitespace, pad the end * of the string with a single space, and NULL terminate the string. * * Return value: * 	new length of string **/static int strip_and_pad_whitespace(int i, char *buf){	while (i && buf[i] == ' ')		i--;	buf[i+1] = ' ';	buf[i+2] = '\0';	return i + 2;}/** * ipr_log_vpd_compact - Log the passed extended VPD compactly. * @prefix:		string to print at start of printk * @hostrcb:	hostrcb pointer * @vpd:		vendor/product id/sn struct * * Return value: * 	none **/static void ipr_log_vpd_compact(char *prefix, struct ipr_hostrcb *hostrcb,				struct ipr_vpd *vpd){	char buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN + IPR_SERIAL_NUM_LEN + 3];	int i = 0;	memcpy(buffer, vpd->vpids.vendor_id, IPR_VENDOR_ID_LEN);	i = strip_and_pad_whitespace(IPR_VENDOR_ID_LEN - 1, buffer);	memcpy(&buffer[i], vpd->vpids.product_id, IPR_PROD_ID_LEN);	i = strip_and_pad_whitespace(i + IPR_PROD_ID_LEN - 1, buffer);	memcpy(&buffer[i], vpd->sn, IPR_SERIAL_NUM_LEN);	buffer[IPR_SERIAL_NUM_LEN + i] = '\0';	ipr_hcam_err(hostrcb, "%s VPID/SN: %s\n", prefix, buffer);}/** * ipr_log_vpd - Log the passed VPD to the error log. * @vpd:		vendor/product id/sn struct * * Return value: * 	none **/static void ipr_log_vpd(struct ipr_vpd *vpd){	char buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN		    + IPR_SERIAL_NUM_LEN];	memcpy(buffer, vpd->vpids.vendor_id, IPR_VENDOR_ID_LEN);	memcpy(buffer + IPR_VENDOR_ID_LEN, vpd->vpids.product_id,	       IPR_PROD_ID_LEN);	buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN] = '\0';	ipr_err("Vendor/Product ID: %s\n", buffer);	memcpy(buffer, vpd->sn, IPR_SERIAL_NUM_LEN);	buffer[IPR_SERIAL_NUM_LEN] = '\0';	ipr_err("    Serial Number: %s\n", buffer);}/** * ipr_log_ext_vpd_compact - Log the passed extended VPD compactly. * @prefix:		string to print at start of printk * @hostrcb:	hostrcb pointer * @vpd:		vendor/product id/sn/wwn struct * * Return value: * 	none **/static void ipr_log_ext_vpd_compact(char *prefix, struct ipr_hostrcb *hostrcb,				    struct ipr_ext_vpd *vpd){	ipr_log_vpd_compact(prefix, hostrcb, &vpd->vpd);	ipr_hcam_err(hostrcb, "%s WWN: %08X%08X\n", prefix,		     be32_to_cpu(vpd->wwid[0]), be32_to_cpu(vpd->wwid[1]));}/** * ipr_log_ext_vpd - Log the passed extended VPD to the error log. * @vpd:		vendor/product id/sn/wwn struct * * Return value: * 	none **/static void ipr_log_ext_vpd(struct ipr_ext_vpd *vpd){	ipr_log_vpd(&vpd->vpd);	ipr_err("    WWN: %08X%08X\n", be32_to_cpu(vpd->wwid[0]),		be32_to_cpu(vpd->wwid[1]));}/** * ipr_log_enhanced_cache_error - Log a cache error. * @ioa_cfg:	ioa config struct * @hostrcb:	hostrcb struct * * Return value: * 	none **/static void ipr_log_enhanced_cache_error(struct ipr_ioa_cfg *ioa_cfg,					 struct ipr_hostrcb *hostrcb){	struct ipr_hostrcb_type_12_error *error =		&hostrcb->hcam.u.error.u.type_12_error;	ipr_err("-----Current Configuration-----\n");	ipr_err("Cache Directory Card Information:\n");	ipr_log_ext_vpd(&error->ioa_vpd);	ipr_err("Adapter Card Information:\n");	ipr_log_ext_vpd(&error->cfc_vpd);	ipr_err("-----Expected Configuration-----\n");	ipr_err("Cache Directory Card Information:\n");	ipr_log_ext_vpd(&error->ioa_last_attached_to_cfc_vpd);	ipr_err("Adapter Card Information:\n");	ipr_log_ext_vpd(&error->cfc_last_attached_to_ioa_vpd);	ipr_err("Additional IOA Data: %08X %08X %08X\n",		     be32_to_cpu(error->ioa_data[0]),		     be32_to_cpu(error->ioa_data[1]),		     be32_to_cpu(error->ioa_data[2]));}/** * ipr_log_cache_error - Log a cache error. * @ioa_cfg:	ioa config struct * @hostrcb:	hostrcb struct * * Return value: * 	none **/static void ipr_log_cache_error(struct ipr_ioa_cfg *ioa_cfg,				struct ipr_hostrcb *hostrcb){	struct ipr_hostrcb_type_02_error *error =		&hostrcb->hcam.u.error.u.type_02_error;	ipr_err("-----Current Configuration-----\n");	ipr_err("Cache Directory Card Information:\n");	ipr_log_vpd(&error->ioa_vpd);	ipr_err("Adapter Card Information:\n");	ipr_log_vpd(&error->cfc_vpd);	ipr_err("-----Expected Configuration-----\n");	ipr_err("Cache Directory Card Information:\n");	ipr_log_vpd(&error->ioa_last_attached_to_cfc_vpd);	ipr_err("Adapter Card Information:\n");	ipr_log_vpd(&error->cfc_last_attached_to_ioa_vpd);	ipr_err("Additional IOA Data: %08X %08X %08X\n",		     be32_to_cpu(error->ioa_data[0]),		     be32_to_cpu(error->ioa_data[1]),		     be32_to_cpu(error->ioa_data[2]));}/** * ipr_log_enhanced_config_error - Log a configuration error. * @ioa_cfg:	ioa config struct * @hostrcb:	hostrcb struct * * Return value: * 	none **/static void ipr_log_enhanced_config_error(struct ipr_ioa_cfg *ioa_cfg,					  struct ipr_hostrcb *hostrcb){	int errors_logged, i;	struct ipr_hostrcb_device_data_entry_enhanced *dev_entry;	struct ipr_hostrcb_type_13_error *error;	error = &hostrcb->hcam.u.error.u.type_13_error;	errors_logged = be32_to_cpu(error->errors_logged);	ipr_err("Device Errors Detected/Logged: %d/%d\n",		be32_to_cpu(error->errors_detected), errors_logged);	dev_entry = error->dev;	for (i = 0; i < errors_logged; i++, dev_entry++) {		ipr_err_separator;		ipr_phys_res_err(ioa_cfg, dev_entry->dev_res_addr, "Device %d", i + 1);		ipr_log_ext_vpd(&dev_entry->vpd);		ipr_err("-----New Device Information-----\n");		ipr_log_ext_vpd(&dev_entry->new_vpd);		ipr_err("Cache Directory Card Information:\n");		ipr_log_ext_vpd(&dev_entry->ioa_last_with_dev_vpd);		ipr_err("Adapter Card Information:\n");		ipr_log_ext_vpd(&dev_entry->cfc_last_with_dev_vpd);	}}/** * ipr_log_config_error - Log a configuration error. * @ioa_cfg:	ioa config struct * @hostrcb:	hostrcb struct * * Return value: * 	none **/static void ipr_log_config_error(struct ipr_ioa_cfg *ioa_cfg,				 struct ipr_hostrcb *hostrcb){	int errors_logged, i;	struct ipr_hostrcb_device_data_entry *dev_entry;	struct ipr_hostrcb_type_03_error *error;	error = &hostrcb->hcam.u.error.u.type_03_error;	errors_logged = be32_to_cpu(error->errors_logged);	ipr_err("Device Errors Detected/Logged: %d/%d\n",		be32_to_cpu(error->errors_detected), errors_logged);	dev_entry = error->dev;	for (i = 0; i < errors_logged; i++, dev_entry++) {		ipr_err_separator;		ipr_phys_res_err(ioa_cfg, dev_entry->dev_res_addr, "Device %d", i + 1);		ipr_log_vpd(&dev_entry->vpd);		ipr_err("-----New Device Information-----\n");		ipr_log_vpd(&dev_entry->new_vpd);		ipr_err("Cache Directory Card Information:\n");		ipr_log_vpd(&dev_entry->ioa_last_with_dev_vpd);		ipr_err("Adapter Card Information:\n");		ipr_log_vpd(&dev_entry->cfc_last_with_dev_vpd);		ipr_err("Additional IOA Data: %08X %08X %08X %08X %08X\n",			be32_to_cpu(dev_entry->ioa_data[0]),			be32_to_cpu(dev_entry->ioa_data[1]),			be32_to_cpu(dev_entry->ioa_data[2]),			be32_to_cpu(dev_entry->ioa_data[3]),			be32_to_cpu(dev_entry->ioa_data[4]));	}}/** * ipr_log_enhanced_array_error - Log an array configuration error. * @ioa_cfg:	ioa config struct * @hostrcb:	hostrcb struct * * Return value: * 	none **/static void ipr_log_enhanced_array_error(struct ipr_ioa_cfg *ioa_cfg,					 struct ipr_hostrcb *hostrcb){	int i, num_entries;	struct ipr_hostrcb_type_14_error *error;	struct ipr_hostrcb_array_data_entry_enhanced *array_entry;	const u8 zero_sn[IPR_SERIAL_NUM_LEN] = { [0 ... IPR_SERIAL_NUM_LEN-1] = '0' };	error = &hostrcb->hcam.u.error.u.type_14_error;	ipr_err_separator;	ipr_err("RAID %s Array Configuration: %d:%d:%d:%d\n",		error->protection_level,		ioa_cfg->host->host_no,		error->last_func_vset_res_addr.bus,		error->last_func_vset_res_addr.target,		error->last_func_vset_res_addr.lun);	ipr_err_separator;	array_entry = error->array_member;	num_entries = min_t(u32, be32_to_cpu(error->num_entries),			    sizeof(error->array_member));	for (i = 0; i < num_entries; i++, array_entry++) {		if (!memcmp(array_entry->vpd.vpd.sn, zero_sn, IPR_SERIAL_NUM_LEN))			continue;		if (be32_to_cpu(error->exposed_mode_adn) == i)			ipr_err("Exposed Array Member %d:\n", i);		else			ipr_err("Array Member %d:\n", i);		ipr_log_ext_vpd(&array_entry->vpd);		ipr_phys_res_err(ioa_cfg, array_entry->dev_res_addr, "Current Location");		ipr_phys_res_err(ioa_cfg, array_entry->expected_dev_res_addr,				 "Expected Location");		ipr_err_separator;	}}/** * ipr_log_array_error - Log an array configuration error. * @ioa_cfg:	ioa config struct * @hostrcb:	hostrcb struct * * Return value: * 	none **/static void ipr_log_array_error(struct ipr_ioa_cfg *ioa_cfg,				struct ipr_hostrcb *hostrcb){	int i;	struct ipr_hostrcb_type_04_error *error;	struct ipr_hostrcb_array_data_entry *array_entry;	const u8 zero_sn[IPR_SERIAL_NUM_LEN] = { [0 ... IPR_SERIAL_NUM_LEN-1] = '0' };	error = &hostrcb->hcam.u.error.u.type_04_error;	ipr_err_separator;	ipr_err("RAID %s Array Configuration: %d:%d:%d:%d\n",		error->protection_level,		ioa_cfg->host->host_no,		error->last_func_vset_res_addr.bus,		error->last_func_vset_res_addr.target,		error->last_func_vset_res_addr.lun);	ipr_err_separator;	array_entry = error->array_member;	for (i = 0; i < 18; i++) {		if (!memcmp(array_entry->vpd.sn, zero_sn, IPR_SERIAL_NUM_LEN))			continue;		if (be32_to_cpu(error->exposed_mode_adn) == i)			ipr_err("Exposed Array Member %d:\n", i);		else			ipr_err("Array Member %d:\n", i);		ipr_log_vpd(&array_entry->vpd);		ipr_phys_res_err(ioa_cfg, array_entry->dev_res_addr, "Current Location");		ipr_phys_res_err(ioa_cfg, array_entry->expected_dev_res_addr,				 "Expected Location");		ipr_err_separator;		if (i == 9)			array_entry = error->array_member2;		else			array_entry++;	}}/** * ipr_log_hex_data - Log additional hex IOA error data. * @ioa_cfg:	ioa config struct * @data:		IOA error data * @len:		data length * * Return value: * 	none **/static void ipr_log_hex_data(struct ipr_ioa_cfg *ioa_cfg, u32 *data, int len){	int i;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -