Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
[cascardo/linux.git] / drivers / scsi / bfa / include / defs / bfa_defs_ioc.h
1 /*
2  * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
3  * All rights reserved
4  * www.brocade.com
5  *
6  * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License (GPL) Version 2 as
10  * published by the Free Software Foundation
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  */
17
18 #ifndef __BFA_DEFS_IOC_H__
19 #define __BFA_DEFS_IOC_H__
20
21 #include <protocol/types.h>
22 #include <defs/bfa_defs_types.h>
23 #include <defs/bfa_defs_version.h>
24 #include <defs/bfa_defs_adapter.h>
25 #include <defs/bfa_defs_pm.h>
26
27 enum {
28         BFA_IOC_DRIVER_LEN      = 16,
29         BFA_IOC_CHIP_REV_LEN    = 8,
30 };
31
32 /**
33  * Driver and firmware versions.
34  */
35 struct bfa_ioc_driver_attr_s {
36         char            driver[BFA_IOC_DRIVER_LEN];     /*  driver name */
37         char            driver_ver[BFA_VERSION_LEN];    /*  driver version */
38         char            fw_ver[BFA_VERSION_LEN];        /*  firmware version*/
39         char            bios_ver[BFA_VERSION_LEN];      /*  bios version */
40         char            efi_ver[BFA_VERSION_LEN];       /*  EFI version */
41         char            ob_ver[BFA_VERSION_LEN];        /*  openboot version*/
42 };
43
44 /**
45  * IOC PCI device attributes
46  */
47 struct bfa_ioc_pci_attr_s {
48         u16        vendor_id;   /*  PCI vendor ID */
49         u16        device_id;   /*  PCI device ID */
50         u16        ssid;                /*  subsystem ID */
51         u16        ssvid;               /*  subsystem vendor ID */
52         u32        pcifn;               /*  PCI device function */
53         u32        rsvd;                /* padding */
54         u8         chip_rev[BFA_IOC_CHIP_REV_LEN];       /*  chip revision */
55 };
56
57 /**
58  * IOC states
59  */
60 enum bfa_ioc_state {
61         BFA_IOC_RESET       = 1,  /*  IOC is in reset state */
62         BFA_IOC_SEMWAIT     = 2,  /*  Waiting for IOC hardware semaphore */
63         BFA_IOC_HWINIT      = 3,  /*  IOC hardware is being initialized */
64         BFA_IOC_GETATTR     = 4,  /*  IOC is being configured */
65         BFA_IOC_OPERATIONAL = 5,  /*  IOC is operational */
66         BFA_IOC_INITFAIL    = 6,  /*  IOC hardware failure */
67         BFA_IOC_HBFAIL      = 7,  /*  IOC heart-beat failure */
68         BFA_IOC_DISABLING   = 8,  /*  IOC is being disabled */
69         BFA_IOC_DISABLED    = 9,  /*  IOC is disabled */
70         BFA_IOC_FWMISMATCH  = 10, /*  IOC firmware different from drivers */
71 };
72
73 /**
74  * IOC firmware stats
75  */
76 struct bfa_fw_ioc_stats_s {
77         u32        hb_count;
78         u32        cfg_reqs;
79         u32        enable_reqs;
80         u32        disable_reqs;
81         u32        stats_reqs;
82         u32        clrstats_reqs;
83         u32        unknown_reqs;
84         u32        ic_reqs;             /*  interrupt coalesce reqs */
85 };
86
87 /**
88  * IOC driver stats
89  */
90 struct bfa_ioc_drv_stats_s {
91         u32     ioc_isrs;
92         u32     ioc_enables;
93         u32     ioc_disables;
94         u32     ioc_hbfails;
95         u32     ioc_boots;
96         u32     stats_tmos;
97         u32        hb_count;
98         u32        disable_reqs;
99         u32        enable_reqs;
100         u32        disable_replies;
101         u32        enable_replies;
102 };
103
104 /**
105  * IOC statistics
106  */
107 struct bfa_ioc_stats_s {
108         struct bfa_ioc_drv_stats_s      drv_stats; /*  driver IOC stats */
109         struct bfa_fw_ioc_stats_s       fw_stats;  /*  firmware IOC stats */
110 };
111
112
113 enum bfa_ioc_type_e {
114         BFA_IOC_TYPE_FC   = 1,
115         BFA_IOC_TYPE_FCoE = 2,
116         BFA_IOC_TYPE_LL   = 3,
117 };
118
119 /**
120  * IOC attributes returned in queries
121  */
122 struct bfa_ioc_attr_s {
123         enum bfa_ioc_type_e             ioc_type;
124         enum bfa_ioc_state              state;          /*  IOC state      */
125         struct bfa_adapter_attr_s       adapter_attr;   /*  HBA attributes */
126         struct bfa_ioc_driver_attr_s    driver_attr;    /*  driver attr    */
127         struct bfa_ioc_pci_attr_s       pci_attr;
128         u8                              port_id;        /*  port number    */
129 };
130
131 /**
132  * BFA IOC level events
133  */
134 enum bfa_ioc_aen_event {
135         BFA_IOC_AEN_HBGOOD      = 1,    /*  Heart Beat restore event    */
136         BFA_IOC_AEN_HBFAIL      = 2,    /*  Heart Beat failure event    */
137         BFA_IOC_AEN_ENABLE      = 3,    /*  IOC enabled event           */
138         BFA_IOC_AEN_DISABLE     = 4,    /*  IOC disabled event          */
139         BFA_IOC_AEN_FWMISMATCH  = 5,    /*  IOC firmware mismatch       */
140 };
141
142 /**
143  * BFA IOC level event data, now just a place holder
144  */
145 struct bfa_ioc_aen_data_s {
146         enum bfa_ioc_type_e ioc_type;
147         wwn_t   pwwn;
148         mac_t   mac;
149 };
150
151 #endif /* __BFA_DEFS_IOC_H__ */
152