aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrking@us.ibm.com <brking@us.ibm.com>2005-11-01 18:00:18 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2005-11-06 13:59:53 -0500
commitcfc321397e9e309a8148c18c32ade26ac40be39d (patch)
tree2fddc675dc4d3d9bceb32dc84403004892fbf4e8
parent11cd8f120173a707e9ed7b78f7af8cde5a1ebb90 (diff)
[SCSI] ipr: Cleanup error structures
Simplify the ipr error structures a bit by removing some duplication. Signed-off-by: Brian King <brking@us.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/ipr.c37
-rw-r--r--drivers/scsi/ipr.h52
2 files changed, 36 insertions, 53 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index da61ce1998c3..d5da5e5c4c6d 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -889,24 +889,23 @@ static void ipr_process_ccn(struct ipr_cmnd *ipr_cmd)
889 889
890/** 890/**
891 * ipr_log_vpd - Log the passed VPD to the error log. 891 * ipr_log_vpd - Log the passed VPD to the error log.
892 * @vpids: vendor/product id struct 892 * @vpd: vendor/product id/sn struct
893 * @serial_num: serial number string
894 * 893 *
895 * Return value: 894 * Return value:
896 * none 895 * none
897 **/ 896 **/
898static void ipr_log_vpd(struct ipr_std_inq_vpids *vpids, u8 *serial_num) 897static void ipr_log_vpd(struct ipr_vpd *vpd)
899{ 898{
900 char buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN 899 char buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN
901 + IPR_SERIAL_NUM_LEN]; 900 + IPR_SERIAL_NUM_LEN];
902 901
903 memcpy(buffer, vpids->vendor_id, IPR_VENDOR_ID_LEN); 902 memcpy(buffer, vpd->vpids.vendor_id, IPR_VENDOR_ID_LEN);
904 memcpy(buffer + IPR_VENDOR_ID_LEN, vpids->product_id, 903 memcpy(buffer + IPR_VENDOR_ID_LEN, vpd->vpids.product_id,
905 IPR_PROD_ID_LEN); 904 IPR_PROD_ID_LEN);
906 buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN] = '\0'; 905 buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN] = '\0';
907 ipr_err("Vendor/Product ID: %s\n", buffer); 906 ipr_err("Vendor/Product ID: %s\n", buffer);
908 907
909 memcpy(buffer, serial_num, IPR_SERIAL_NUM_LEN); 908 memcpy(buffer, vpd->sn, IPR_SERIAL_NUM_LEN);
910 buffer[IPR_SERIAL_NUM_LEN] = '\0'; 909 buffer[IPR_SERIAL_NUM_LEN] = '\0';
911 ipr_err(" Serial Number: %s\n", buffer); 910 ipr_err(" Serial Number: %s\n", buffer);
912} 911}
@@ -927,17 +926,15 @@ static void ipr_log_cache_error(struct ipr_ioa_cfg *ioa_cfg,
927 926
928 ipr_err("-----Current Configuration-----\n"); 927 ipr_err("-----Current Configuration-----\n");
929 ipr_err("Cache Directory Card Information:\n"); 928 ipr_err("Cache Directory Card Information:\n");
930 ipr_log_vpd(&error->ioa_vpids, error->ioa_sn); 929 ipr_log_vpd(&error->ioa_vpd);
931 ipr_err("Adapter Card Information:\n"); 930 ipr_err("Adapter Card Information:\n");
932 ipr_log_vpd(&error->cfc_vpids, error->cfc_sn); 931 ipr_log_vpd(&error->cfc_vpd);
933 932
934 ipr_err("-----Expected Configuration-----\n"); 933 ipr_err("-----Expected Configuration-----\n");
935 ipr_err("Cache Directory Card Information:\n"); 934 ipr_err("Cache Directory Card Information:\n");
936 ipr_log_vpd(&error->ioa_last_attached_to_cfc_vpids, 935 ipr_log_vpd(&error->ioa_last_attached_to_cfc_vpd);
937 error->ioa_last_attached_to_cfc_sn);
938 ipr_err("Adapter Card Information:\n"); 936 ipr_err("Adapter Card Information:\n");
939 ipr_log_vpd(&error->cfc_last_attached_to_ioa_vpids, 937 ipr_log_vpd(&error->cfc_last_attached_to_ioa_vpd);
940 error->cfc_last_attached_to_ioa_sn);
941 938
942 ipr_err("Additional IOA Data: %08X %08X %08X\n", 939 ipr_err("Additional IOA Data: %08X %08X %08X\n",
943 be32_to_cpu(error->ioa_data[0]), 940 be32_to_cpu(error->ioa_data[0]),
@@ -966,7 +963,7 @@ static void ipr_log_config_error(struct ipr_ioa_cfg *ioa_cfg,
966 ipr_err("Device Errors Detected/Logged: %d/%d\n", 963 ipr_err("Device Errors Detected/Logged: %d/%d\n",
967 be32_to_cpu(error->errors_detected), errors_logged); 964 be32_to_cpu(error->errors_detected), errors_logged);
968 965
969 dev_entry = error->dev_entry; 966 dev_entry = error->dev;
970 967
971 for (i = 0; i < errors_logged; i++, dev_entry++) { 968 for (i = 0; i < errors_logged; i++, dev_entry++) {
972 ipr_err_separator; 969 ipr_err_separator;
@@ -978,18 +975,16 @@ static void ipr_log_config_error(struct ipr_ioa_cfg *ioa_cfg,
978 ioa_cfg->host->host_no, dev_entry->dev_res_addr.bus, 975 ioa_cfg->host->host_no, dev_entry->dev_res_addr.bus,
979 dev_entry->dev_res_addr.target, dev_entry->dev_res_addr.lun); 976 dev_entry->dev_res_addr.target, dev_entry->dev_res_addr.lun);
980 } 977 }
981 ipr_log_vpd(&dev_entry->dev_vpids, dev_entry->dev_sn); 978 ipr_log_vpd(&dev_entry->vpd);
982 979
983 ipr_err("-----New Device Information-----\n"); 980 ipr_err("-----New Device Information-----\n");
984 ipr_log_vpd(&dev_entry->new_dev_vpids, dev_entry->new_dev_sn); 981 ipr_log_vpd(&dev_entry->new_vpd);
985 982
986 ipr_err("Cache Directory Card Information:\n"); 983 ipr_err("Cache Directory Card Information:\n");
987 ipr_log_vpd(&dev_entry->ioa_last_with_dev_vpids, 984 ipr_log_vpd(&dev_entry->ioa_last_with_dev_vpd);
988 dev_entry->ioa_last_with_dev_sn);
989 985
990 ipr_err("Adapter Card Information:\n"); 986 ipr_err("Adapter Card Information:\n");
991 ipr_log_vpd(&dev_entry->cfc_last_with_dev_vpids, 987 ipr_log_vpd(&dev_entry->cfc_last_with_dev_vpd);
992 dev_entry->cfc_last_with_dev_sn);
993 988
994 ipr_err("Additional IOA Data: %08X %08X %08X %08X %08X\n", 989 ipr_err("Additional IOA Data: %08X %08X %08X %08X %08X\n",
995 be32_to_cpu(dev_entry->ioa_data[0]), 990 be32_to_cpu(dev_entry->ioa_data[0]),
@@ -1032,7 +1027,7 @@ static void ipr_log_array_error(struct ipr_ioa_cfg *ioa_cfg,
1032 array_entry = error->array_member; 1027 array_entry = error->array_member;
1033 1028
1034 for (i = 0; i < 18; i++) { 1029 for (i = 0; i < 18; i++) {
1035 if (!memcmp(array_entry->serial_num, zero_sn, IPR_SERIAL_NUM_LEN)) 1030 if (!memcmp(array_entry->vpd.sn, zero_sn, IPR_SERIAL_NUM_LEN))
1036 continue; 1031 continue;
1037 1032
1038 if (be32_to_cpu(error->exposed_mode_adn) == i) { 1033 if (be32_to_cpu(error->exposed_mode_adn) == i) {
@@ -1041,7 +1036,7 @@ static void ipr_log_array_error(struct ipr_ioa_cfg *ioa_cfg,
1041 ipr_err("Array Member %d:\n", i); 1036 ipr_err("Array Member %d:\n", i);
1042 } 1037 }
1043 1038
1044 ipr_log_vpd(&array_entry->vpids, array_entry->serial_num); 1039 ipr_log_vpd(&array_entry->vpd);
1045 1040
1046 if (array_entry->dev_res_addr.bus >= IPR_MAX_NUM_BUSES) { 1041 if (array_entry->dev_res_addr.bus >= IPR_MAX_NUM_BUSES) {
1047 ipr_err("Current Location: unknown\n"); 1042 ipr_err("Current Location: unknown\n");
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
index 8cf967108500..01950b9d2e6d 100644
--- a/drivers/scsi/ipr.h
+++ b/drivers/scsi/ipr.h
@@ -261,6 +261,11 @@ struct ipr_std_inq_vpids {
261 u8 product_id[IPR_PROD_ID_LEN]; 261 u8 product_id[IPR_PROD_ID_LEN];
262}__attribute__((packed)); 262}__attribute__((packed));
263 263
264struct ipr_vpd {
265 struct ipr_std_inq_vpids vpids;
266 u8 sn[IPR_SERIAL_NUM_LEN];
267}__attribute__((packed));
268
264struct ipr_std_inq_data { 269struct ipr_std_inq_data {
265 u8 peri_qual_dev_type; 270 u8 peri_qual_dev_type;
266#define IPR_STD_INQ_PERI_QUAL(peri) ((peri) >> 5) 271#define IPR_STD_INQ_PERI_QUAL(peri) ((peri) >> 5)
@@ -537,21 +542,16 @@ struct ipr_inquiry_page3 {
537}__attribute__((packed)); 542}__attribute__((packed));
538 543
539struct ipr_hostrcb_device_data_entry { 544struct ipr_hostrcb_device_data_entry {
540 struct ipr_std_inq_vpids dev_vpids; 545 struct ipr_vpd vpd;
541 u8 dev_sn[IPR_SERIAL_NUM_LEN];
542 struct ipr_res_addr dev_res_addr; 546 struct ipr_res_addr dev_res_addr;
543 struct ipr_std_inq_vpids new_dev_vpids; 547 struct ipr_vpd new_vpd;
544 u8 new_dev_sn[IPR_SERIAL_NUM_LEN]; 548 struct ipr_vpd ioa_last_with_dev_vpd;
545 struct ipr_std_inq_vpids ioa_last_with_dev_vpids; 549 struct ipr_vpd cfc_last_with_dev_vpd;
546 u8 ioa_last_with_dev_sn[IPR_SERIAL_NUM_LEN];
547 struct ipr_std_inq_vpids cfc_last_with_dev_vpids;
548 u8 cfc_last_with_dev_sn[IPR_SERIAL_NUM_LEN];
549 __be32 ioa_data[5]; 550 __be32 ioa_data[5];
550}__attribute__((packed, aligned (4))); 551}__attribute__((packed, aligned (4)));
551 552
552struct ipr_hostrcb_array_data_entry { 553struct ipr_hostrcb_array_data_entry {
553 struct ipr_std_inq_vpids vpids; 554 struct ipr_vpd vpd;
554 u8 serial_num[IPR_SERIAL_NUM_LEN];
555 struct ipr_res_addr expected_dev_res_addr; 555 struct ipr_res_addr expected_dev_res_addr;
556 struct ipr_res_addr dev_res_addr; 556 struct ipr_res_addr dev_res_addr;
557}__attribute__((packed, aligned (4))); 557}__attribute__((packed, aligned (4)));
@@ -568,47 +568,35 @@ struct ipr_hostrcb_type_01_error {
568}__attribute__((packed, aligned (4))); 568}__attribute__((packed, aligned (4)));
569 569
570struct ipr_hostrcb_type_02_error { 570struct ipr_hostrcb_type_02_error {
571 struct ipr_std_inq_vpids ioa_vpids; 571 struct ipr_vpd ioa_vpd;
572 u8 ioa_sn[IPR_SERIAL_NUM_LEN]; 572 struct ipr_vpd cfc_vpd;
573 struct ipr_std_inq_vpids cfc_vpids; 573 struct ipr_vpd ioa_last_attached_to_cfc_vpd;
574 u8 cfc_sn[IPR_SERIAL_NUM_LEN]; 574 struct ipr_vpd cfc_last_attached_to_ioa_vpd;
575 struct ipr_std_inq_vpids ioa_last_attached_to_cfc_vpids;
576 u8 ioa_last_attached_to_cfc_sn[IPR_SERIAL_NUM_LEN];
577 struct ipr_std_inq_vpids cfc_last_attached_to_ioa_vpids;
578 u8 cfc_last_attached_to_ioa_sn[IPR_SERIAL_NUM_LEN];
579 __be32 ioa_data[3]; 575 __be32 ioa_data[3];
580 u8 reserved[844];
581}__attribute__((packed, aligned (4))); 576}__attribute__((packed, aligned (4)));
582 577
583struct ipr_hostrcb_type_03_error { 578struct ipr_hostrcb_type_03_error {
584 struct ipr_std_inq_vpids ioa_vpids; 579 struct ipr_vpd ioa_vpd;
585 u8 ioa_sn[IPR_SERIAL_NUM_LEN]; 580 struct ipr_vpd cfc_vpd;
586 struct ipr_std_inq_vpids cfc_vpids;
587 u8 cfc_sn[IPR_SERIAL_NUM_LEN];
588 __be32 errors_detected; 581 __be32 errors_detected;
589 __be32 errors_logged; 582 __be32 errors_logged;
590 u8 ioa_data[12]; 583 u8 ioa_data[12];
591 struct ipr_hostrcb_device_data_entry dev_entry[3]; 584 struct ipr_hostrcb_device_data_entry dev[3];
592 u8 reserved[444];
593}__attribute__((packed, aligned (4))); 585}__attribute__((packed, aligned (4)));
594 586
595struct ipr_hostrcb_type_04_error { 587struct ipr_hostrcb_type_04_error {
596 struct ipr_std_inq_vpids ioa_vpids; 588 struct ipr_vpd ioa_vpd;
597 u8 ioa_sn[IPR_SERIAL_NUM_LEN]; 589 struct ipr_vpd cfc_vpd;
598 struct ipr_std_inq_vpids cfc_vpids;
599 u8 cfc_sn[IPR_SERIAL_NUM_LEN];
600 u8 ioa_data[12]; 590 u8 ioa_data[12];
601 struct ipr_hostrcb_array_data_entry array_member[10]; 591 struct ipr_hostrcb_array_data_entry array_member[10];
602 __be32 exposed_mode_adn; 592 __be32 exposed_mode_adn;
603 __be32 array_id; 593 __be32 array_id;
604 struct ipr_std_inq_vpids incomp_dev_vpids; 594 struct ipr_vpd incomp_dev_vpd;
605 u8 incomp_dev_sn[IPR_SERIAL_NUM_LEN];
606 __be32 ioa_data2; 595 __be32 ioa_data2;
607 struct ipr_hostrcb_array_data_entry array_member2[8]; 596 struct ipr_hostrcb_array_data_entry array_member2[8];
608 struct ipr_res_addr last_func_vset_res_addr; 597 struct ipr_res_addr last_func_vset_res_addr;
609 u8 vset_serial_num[IPR_SERIAL_NUM_LEN]; 598 u8 vset_serial_num[IPR_SERIAL_NUM_LEN];
610 u8 protection_level[8]; 599 u8 protection_level[8];
611 u8 reserved[124];
612}__attribute__((packed, aligned (4))); 600}__attribute__((packed, aligned (4)));
613 601
614struct ipr_hostrcb_error { 602struct ipr_hostrcb_error {