blob: 2fcab6bc62807cdd2ea6fcc1f48131e2fa9944b0 [file] [log] [blame]
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001/*
2 * Copyright (c) 2005-2010 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_PORT_H__
19#define __BFA_PORT_H__
20
21#include "bfa_defs_svc.h"
22#include "bfa_ioc.h"
23#include "bfa_cs.h"
24
25typedef void (*bfa_port_stats_cbfn_t) (void *dev, bfa_status_t status);
26typedef void (*bfa_port_endis_cbfn_t) (void *dev, bfa_status_t status);
27
28struct bfa_port_s {
29 void *dev;
30 struct bfa_ioc_s *ioc;
31 struct bfa_trc_mod_s *trcmod;
32 u32 msgtag;
33 bfa_boolean_t stats_busy;
34 struct bfa_mbox_cmd_s stats_mb;
35 bfa_port_stats_cbfn_t stats_cbfn;
36 void *stats_cbarg;
37 bfa_status_t stats_status;
38 u32 stats_reset_time;
39 union bfa_port_stats_u *stats;
40 struct bfa_dma_s stats_dma;
41 bfa_boolean_t endis_pending;
42 struct bfa_mbox_cmd_s endis_mb;
43 bfa_port_endis_cbfn_t endis_cbfn;
44 void *endis_cbarg;
45 bfa_status_t endis_status;
Krishna Gudipatid37779f2011-06-13 15:42:10 -070046 struct bfa_ioc_notify_s ioc_notify;
Krishna Gudipati43ffdf42011-06-13 15:46:21 -070047 bfa_boolean_t pbc_disabled;
Krishna Gudipatie3535462012-09-21 17:26:07 -070048 bfa_boolean_t dport_enabled;
Krishna Gudipati45070252011-06-24 20:24:29 -070049 struct bfa_mem_dma_s port_dma;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070050};
51
Krishna Gudipati45070252011-06-24 20:24:29 -070052#define BFA_MEM_PORT_DMA(__bfa) (&((__bfa)->modules.port.port_dma))
53
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070054void bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc,
55 void *dev, struct bfa_trc_mod_s *trcmod);
Krishna Gudipatid37779f2011-06-13 15:42:10 -070056void bfa_port_notify(void *arg, enum bfa_ioc_event_e event);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070057
58bfa_status_t bfa_port_get_stats(struct bfa_port_s *port,
59 union bfa_port_stats_u *stats,
60 bfa_port_stats_cbfn_t cbfn, void *cbarg);
61bfa_status_t bfa_port_clear_stats(struct bfa_port_s *port,
62 bfa_port_stats_cbfn_t cbfn, void *cbarg);
63bfa_status_t bfa_port_enable(struct bfa_port_s *port,
64 bfa_port_endis_cbfn_t cbfn, void *cbarg);
65bfa_status_t bfa_port_disable(struct bfa_port_s *port,
66 bfa_port_endis_cbfn_t cbfn, void *cbarg);
67u32 bfa_port_meminfo(void);
68void bfa_port_mem_claim(struct bfa_port_s *port,
69 u8 *dma_kva, u64 dma_pa);
Krishna Gudipatie3535462012-09-21 17:26:07 -070070void bfa_port_set_dportenabled(struct bfa_port_s *port,
71 bfa_boolean_t enabled);
Krishna Gudipati148d6102011-06-24 20:25:36 -070072
73/*
74 * CEE declaration
75 */
76typedef void (*bfa_cee_get_attr_cbfn_t) (void *dev, bfa_status_t status);
77typedef void (*bfa_cee_get_stats_cbfn_t) (void *dev, bfa_status_t status);
78typedef void (*bfa_cee_reset_stats_cbfn_t) (void *dev, bfa_status_t status);
79
80struct bfa_cee_cbfn_s {
81 bfa_cee_get_attr_cbfn_t get_attr_cbfn;
82 void *get_attr_cbarg;
83 bfa_cee_get_stats_cbfn_t get_stats_cbfn;
84 void *get_stats_cbarg;
85 bfa_cee_reset_stats_cbfn_t reset_stats_cbfn;
86 void *reset_stats_cbarg;
87};
88
89struct bfa_cee_s {
90 void *dev;
91 bfa_boolean_t get_attr_pending;
92 bfa_boolean_t get_stats_pending;
93 bfa_boolean_t reset_stats_pending;
94 bfa_status_t get_attr_status;
95 bfa_status_t get_stats_status;
96 bfa_status_t reset_stats_status;
97 struct bfa_cee_cbfn_s cbfn;
98 struct bfa_ioc_notify_s ioc_notify;
99 struct bfa_trc_mod_s *trcmod;
100 struct bfa_cee_attr_s *attr;
101 struct bfa_cee_stats_s *stats;
102 struct bfa_dma_s attr_dma;
103 struct bfa_dma_s stats_dma;
104 struct bfa_ioc_s *ioc;
105 struct bfa_mbox_cmd_s get_cfg_mb;
106 struct bfa_mbox_cmd_s get_stats_mb;
107 struct bfa_mbox_cmd_s reset_stats_mb;
108 struct bfa_mem_dma_s cee_dma;
109};
110
111#define BFA_MEM_CEE_DMA(__bfa) (&((__bfa)->modules.cee.cee_dma))
112
113u32 bfa_cee_meminfo(void);
114void bfa_cee_mem_claim(struct bfa_cee_s *cee, u8 *dma_kva, u64 dma_pa);
115void bfa_cee_attach(struct bfa_cee_s *cee,
116 struct bfa_ioc_s *ioc, void *dev);
117bfa_status_t bfa_cee_get_attr(struct bfa_cee_s *cee,
118 struct bfa_cee_attr_s *attr,
119 bfa_cee_get_attr_cbfn_t cbfn, void *cbarg);
120bfa_status_t bfa_cee_get_stats(struct bfa_cee_s *cee,
121 struct bfa_cee_stats_s *stats,
122 bfa_cee_get_stats_cbfn_t cbfn, void *cbarg);
123bfa_status_t bfa_cee_reset_stats(struct bfa_cee_s *cee,
124 bfa_cee_reset_stats_cbfn_t cbfn, void *cbarg);
125
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700126#endif /* __BFA_PORT_H__ */