]> err.no Git - linux-2.6/blobdiff - drivers/scsi/ipr.h
[SCSI] ipr: Fix adapter microcode update DMA mapping leak
[linux-2.6] / drivers / scsi / ipr.h
index cbff3ea3cd893eed312d6f094477315ca01713ef..1a29eb865b0b439e2920ae56d194c9bbbc73f264 100644 (file)
@@ -261,6 +261,11 @@ struct ipr_std_inq_vpids {
        u8 product_id[IPR_PROD_ID_LEN];
 }__attribute__((packed));
 
+struct ipr_vpd {
+       struct ipr_std_inq_vpids vpids;
+       u8 sn[IPR_SERIAL_NUM_LEN];
+}__attribute__((packed));
+
 struct ipr_std_inq_data {
        u8 peri_qual_dev_type;
 #define IPR_STD_INQ_PERI_QUAL(peri) ((peri) >> 5)
@@ -536,22 +541,26 @@ struct ipr_inquiry_page3 {
        u8 patch_number[4];
 }__attribute__((packed));
 
+#define IPR_INQUIRY_PAGE0_ENTRIES 20
+struct ipr_inquiry_page0 {
+       u8 peri_qual_dev_type;
+       u8 page_code;
+       u8 reserved1;
+       u8 len;
+       u8 page[IPR_INQUIRY_PAGE0_ENTRIES];
+}__attribute__((packed));
+
 struct ipr_hostrcb_device_data_entry {
-       struct ipr_std_inq_vpids dev_vpids;
-       u8 dev_sn[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd vpd;
        struct ipr_res_addr dev_res_addr;
-       struct ipr_std_inq_vpids new_dev_vpids;
-       u8 new_dev_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids ioa_last_with_dev_vpids;
-       u8 ioa_last_with_dev_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids cfc_last_with_dev_vpids;
-       u8 cfc_last_with_dev_sn[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd new_vpd;
+       struct ipr_vpd ioa_last_with_dev_vpd;
+       struct ipr_vpd cfc_last_with_dev_vpd;
        __be32 ioa_data[5];
 }__attribute__((packed, aligned (4)));
 
 struct ipr_hostrcb_array_data_entry {
-       struct ipr_std_inq_vpids vpids;
-       u8 serial_num[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd vpd;
        struct ipr_res_addr expected_dev_res_addr;
        struct ipr_res_addr dev_res_addr;
 }__attribute__((packed, aligned (4)));
@@ -568,47 +577,35 @@ struct ipr_hostrcb_type_01_error {
 }__attribute__((packed, aligned (4)));
 
 struct ipr_hostrcb_type_02_error {
-       struct ipr_std_inq_vpids ioa_vpids;
-       u8 ioa_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids cfc_vpids;
-       u8 cfc_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids ioa_last_attached_to_cfc_vpids;
-       u8 ioa_last_attached_to_cfc_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids cfc_last_attached_to_ioa_vpids;
-       u8 cfc_last_attached_to_ioa_sn[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd ioa_vpd;
+       struct ipr_vpd cfc_vpd;
+       struct ipr_vpd ioa_last_attached_to_cfc_vpd;
+       struct ipr_vpd cfc_last_attached_to_ioa_vpd;
        __be32 ioa_data[3];
-       u8 reserved[844];
 }__attribute__((packed, aligned (4)));
 
 struct ipr_hostrcb_type_03_error {
-       struct ipr_std_inq_vpids ioa_vpids;
-       u8 ioa_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids cfc_vpids;
-       u8 cfc_sn[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd ioa_vpd;
+       struct ipr_vpd cfc_vpd;
        __be32 errors_detected;
        __be32 errors_logged;
        u8 ioa_data[12];
-       struct ipr_hostrcb_device_data_entry dev_entry[3];
-       u8 reserved[444];
+       struct ipr_hostrcb_device_data_entry dev[3];
 }__attribute__((packed, aligned (4)));
 
 struct ipr_hostrcb_type_04_error {
-       struct ipr_std_inq_vpids ioa_vpids;
-       u8 ioa_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids cfc_vpids;
-       u8 cfc_sn[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd ioa_vpd;
+       struct ipr_vpd cfc_vpd;
        u8 ioa_data[12];
        struct ipr_hostrcb_array_data_entry array_member[10];
        __be32 exposed_mode_adn;
        __be32 array_id;
-       struct ipr_std_inq_vpids incomp_dev_vpids;
-       u8 incomp_dev_sn[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd incomp_dev_vpd;
        __be32 ioa_data2;
        struct ipr_hostrcb_array_data_entry array_member2[8];
        struct ipr_res_addr last_func_vset_res_addr;
        u8 vset_serial_num[IPR_SERIAL_NUM_LEN];
        u8 protection_level[8];
-       u8 reserved[124];
 }__attribute__((packed, aligned (4)));
 
 struct ipr_hostrcb_error {
@@ -743,6 +740,7 @@ struct ipr_resource_table {
 
 struct ipr_misc_cbs {
        struct ipr_ioa_vpd ioa_vpd;
+       struct ipr_inquiry_page0 page0_data;
        struct ipr_inquiry_page3 page3_data;
        struct ipr_mode_pages mode_pages;
        struct ipr_supported_device supp_dev;
@@ -813,6 +811,7 @@ struct ipr_trace_entry {
 struct ipr_sglist {
        u32 order;
        u32 num_sg;
+       u32 num_dma_sg;
        u32 buffer_len;
        struct scatterlist scatterlist[1];
 };
@@ -825,6 +824,13 @@ enum ipr_sdt_state {
        DUMP_OBTAINED
 };
 
+enum ipr_cache_state {
+       CACHE_NONE,
+       CACHE_DISABLED,
+       CACHE_ENABLED,
+       CACHE_INVALID
+};
+
 /* Per-controller data */
 struct ipr_ioa_cfg {
        char eye_catcher[8];
@@ -841,6 +847,7 @@ struct ipr_ioa_cfg {
        u8 allow_cmds:1;
        u8 allow_ml_add_del:1;
 
+       enum ipr_cache_state cache_state;
        u16 type; /* CCIN of the card */
 
        u8 log_level;
@@ -1114,9 +1121,8 @@ struct ipr_ucode_image_header {
 #define ipr_warn(...) printk(KERN_WARNING IPR_NAME": "__VA_ARGS__)
 #define ipr_dbg(...) IPR_DBG_CMD(printk(KERN_INFO IPR_NAME ": "__VA_ARGS__))
 
-#define ipr_sdev_printk(level, sdev, fmt, ...) \
-       printk(level IPR_NAME ": %d:%d:%d:%d: " fmt, sdev->host->host_no, \
-               sdev->channel, sdev->id, sdev->lun, ##__VA_ARGS__)
+#define ipr_sdev_printk(level, sdev, fmt, args...) \
+       sdev_printk(level, sdev, fmt, ## args)
 
 #define ipr_sdev_err(sdev, fmt, ...) \
        ipr_sdev_printk(KERN_ERR, sdev, fmt, ##__VA_ARGS__)
@@ -1136,6 +1142,17 @@ struct ipr_ucode_image_header {
 #define ipr_res_dbg(ioa_cfg, res, fmt, ...) \
        IPR_DBG_CMD(ipr_res_printk(KERN_INFO, ioa_cfg, res, fmt, ##__VA_ARGS__))
 
+#define ipr_phys_res_err(ioa_cfg, res, fmt, ...)                       \
+{                                                                      \
+       if ((res).bus >= IPR_MAX_NUM_BUSES) {                           \
+               ipr_err(fmt": unknown\n", ##__VA_ARGS__);               \
+       } else {                                                        \
+               ipr_err(fmt": %d:%d:%d:%d\n",                           \
+                       ##__VA_ARGS__, (ioa_cfg)->host->host_no,        \
+                       (res).bus, (res).target, (res).lun);            \
+       }                                                               \
+}
+
 #define ipr_trace ipr_dbg("%s: %s: Line: %d\n",\
        __FILE__, __FUNCTION__, __LINE__)