| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
/* |
| 3 |
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc. |
| 4 |
* Copyright (c) 2014- QLogic Corporation. |
| 5 |
* All rights reserved |
| 6 |
* www.qlogic.com |
| 7 |
* |
| 8 |
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter. |
| 9 |
*/ |
| 10 |
|
| 11 |
#ifndef __BFA_PORT_H__ |
| 12 |
#define __BFA_PORT_H__ |
| 13 |
|
| 14 |
#include "bfa_defs_svc.h" |
| 15 |
#include "bfa_ioc.h" |
| 16 |
#include "bfa_cs.h" |
| 17 |
|
| 18 |
typedef void (*bfa_port_stats_cbfn_t) (void *dev, bfa_status_t status); |
| 19 |
typedef void (*bfa_port_endis_cbfn_t) (void *dev, bfa_status_t status); |
| 20 |
|
| 21 |
struct bfa_port_s { |
| 22 |
void *dev; |
| 23 |
struct bfa_ioc_s *ioc; |
| 24 |
struct bfa_trc_mod_s *trcmod; |
| 25 |
u32 msgtag; |
| 26 |
bfa_boolean_t stats_busy; |
| 27 |
struct bfa_mbox_cmd_s stats_mb; |
| 28 |
bfa_port_stats_cbfn_t stats_cbfn; |
| 29 |
void *stats_cbarg; |
| 30 |
bfa_status_t stats_status; |
| 31 |
time64_t stats_reset_time; |
| 32 |
union bfa_port_stats_u *stats; |
| 33 |
struct bfa_dma_s stats_dma; |
| 34 |
bfa_boolean_t endis_pending; |
| 35 |
struct bfa_mbox_cmd_s endis_mb; |
| 36 |
bfa_port_endis_cbfn_t endis_cbfn; |
| 37 |
void *endis_cbarg; |
| 38 |
bfa_status_t endis_status; |
| 39 |
struct bfa_ioc_notify_s ioc_notify; |
| 40 |
bfa_boolean_t pbc_disabled; |
| 41 |
bfa_boolean_t dport_enabled; |
| 42 |
struct bfa_mem_dma_s port_dma; |
| 43 |
}; |
| 44 |
|
| 45 |
#define BFA_MEM_PORT_DMA(__bfa) (&((__bfa)->modules.port.port_dma)) |
| 46 |
|
| 47 |
void bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, |
| 48 |
void *dev, struct bfa_trc_mod_s *trcmod); |
| 49 |
void bfa_port_notify(void *arg, enum bfa_ioc_event_e event); |
| 50 |
|
| 51 |
bfa_status_t bfa_port_get_stats(struct bfa_port_s *port, |
| 52 |
union bfa_port_stats_u *stats, |
| 53 |
bfa_port_stats_cbfn_t cbfn, void *cbarg); |
| 54 |
bfa_status_t bfa_port_clear_stats(struct bfa_port_s *port, |
| 55 |
bfa_port_stats_cbfn_t cbfn, void *cbarg); |
| 56 |
bfa_status_t bfa_port_enable(struct bfa_port_s *port, |
| 57 |
bfa_port_endis_cbfn_t cbfn, void *cbarg); |
| 58 |
bfa_status_t bfa_port_disable(struct bfa_port_s *port, |
| 59 |
bfa_port_endis_cbfn_t cbfn, void *cbarg); |
| 60 |
u32 bfa_port_meminfo(void); |
| 61 |
void bfa_port_mem_claim(struct bfa_port_s *port, |
| 62 |
u8 *dma_kva, u64 dma_pa); |
| 63 |
void bfa_port_set_dportenabled(struct bfa_port_s *port, |
| 64 |
bfa_boolean_t enabled); |
| 65 |
|
| 66 |
/* |
| 67 |
* CEE declaration |
| 68 |
*/ |
| 69 |
typedef void (*bfa_cee_get_attr_cbfn_t) (void *dev, bfa_status_t status); |
| 70 |
typedef void (*bfa_cee_get_stats_cbfn_t) (void *dev, bfa_status_t status); |
| 71 |
typedef void (*bfa_cee_reset_stats_cbfn_t) (void *dev, bfa_status_t status); |
| 72 |
|
| 73 |
struct bfa_cee_cbfn_s { |
| 74 |
bfa_cee_get_attr_cbfn_t get_attr_cbfn; |
| 75 |
void *get_attr_cbarg; |
| 76 |
bfa_cee_get_stats_cbfn_t get_stats_cbfn; |
| 77 |
void *get_stats_cbarg; |
| 78 |
bfa_cee_reset_stats_cbfn_t reset_stats_cbfn; |
| 79 |
void *reset_stats_cbarg; |
| 80 |
}; |
| 81 |
|
| 82 |
struct bfa_cee_s { |
| 83 |
void *dev; |
| 84 |
bfa_boolean_t get_attr_pending; |
| 85 |
bfa_boolean_t get_stats_pending; |
| 86 |
bfa_boolean_t reset_stats_pending; |
| 87 |
bfa_status_t get_attr_status; |
| 88 |
bfa_status_t get_stats_status; |
| 89 |
bfa_status_t reset_stats_status; |
| 90 |
struct bfa_cee_cbfn_s cbfn; |
| 91 |
struct bfa_ioc_notify_s ioc_notify; |
| 92 |
struct bfa_trc_mod_s *trcmod; |
| 93 |
struct bfa_cee_attr_s *attr; |
| 94 |
struct bfa_cee_stats_s *stats; |
| 95 |
struct bfa_dma_s attr_dma; |
| 96 |
struct bfa_dma_s stats_dma; |
| 97 |
struct bfa_ioc_s *ioc; |
| 98 |
struct bfa_mbox_cmd_s get_cfg_mb; |
| 99 |
struct bfa_mbox_cmd_s get_stats_mb; |
| 100 |
struct bfa_mbox_cmd_s reset_stats_mb; |
| 101 |
struct bfa_mem_dma_s cee_dma; |
| 102 |
}; |
| 103 |
|
| 104 |
#define BFA_MEM_CEE_DMA(__bfa) (&((__bfa)->modules.cee.cee_dma)) |
| 105 |
|
| 106 |
u32 bfa_cee_meminfo(void); |
| 107 |
void bfa_cee_mem_claim(struct bfa_cee_s *cee, u8 *dma_kva, u64 dma_pa); |
| 108 |
void bfa_cee_attach(struct bfa_cee_s *cee, |
| 109 |
struct bfa_ioc_s *ioc, void *dev); |
| 110 |
bfa_status_t bfa_cee_get_attr(struct bfa_cee_s *cee, |
| 111 |
struct bfa_cee_attr_s *attr, |
| 112 |
bfa_cee_get_attr_cbfn_t cbfn, void *cbarg); |
| 113 |
bfa_status_t bfa_cee_get_stats(struct bfa_cee_s *cee, |
| 114 |
struct bfa_cee_stats_s *stats, |
| 115 |
bfa_cee_get_stats_cbfn_t cbfn, void *cbarg); |
| 116 |
bfa_status_t bfa_cee_reset_stats(struct bfa_cee_s *cee, |
| 117 |
bfa_cee_reset_stats_cbfn_t cbfn, void *cbarg); |
| 118 |
|
| 119 |
#endif /* __BFA_PORT_H__ */ |