Switchtec Userspace  PROJECT_NUMBER = 3.1
fabric.h
1 /*
2  * Microsemi Switchtec(tm) PCIe Management Library
3  * Copyright (c) 2017, Microsemi Corporation
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21  * OTHER DEALINGS IN THE SOFTWARE.
22  *
23  */
24 
25 #ifndef LIBSWITCHTEC_FABRIC_H
26 #define LIBSWITCHTEC_FABRIC_H
27 
28 #include "mrpc.h"
29 #include "portable.h"
30 #include "registers.h"
31 
32 #include <switchtec/switchtec.h>
33 
34 #include <stdlib.h>
35 #include <stdint.h>
36 #include <stdio.h>
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 /********** TOPO INFO *********/
43 
48  uint8_t phys_port_id;
49  uint8_t port_type;
52 
53  struct gpio_idx_val {
54  uint16_t gpio_idx;
55  uint8_t value;
56  uint8_t rsvd;
58 
59  struct gpio_idx_val conn_sig_dsp_perst;
60  struct gpio_idx_val conn_sig_usp_perst;
61  struct gpio_idx_val conn_sig_presence;
62  struct gpio_idx_val conn_sig_8639;
63 
64  uint8_t port_cfg_width;
65  uint8_t port_neg_width;
66  uint8_t port_cfg_rate;
67  uint8_t port_neg_rate;
68  uint8_t port_major_ltssm;
69  uint8_t port_minor_ltssm;
70  uint8_t rsvd[2];
71 };
72 
77  uint8_t sw_idx;
78  uint8_t rsvd[3];
80  uint32_t stack_bif[8];
81  uint8_t route_port[16];
82  uint64_t port_bitmap;
83 
91  struct switchtec_fab_port_info port_info_list[SWITCHTEC_MAX_PORTS];
92 };
93 
94 int switchtec_topo_info_dump(struct switchtec_dev *dev,
95  struct switchtec_fab_topo_info *topo_info);
96 
97 /********** GFMS BIND *********/
98 
99 #define SWITCHTEC_FABRIC_MULTI_FUNC_NUM 8
100 
102  uint8_t host_sw_idx;
103  uint8_t host_phys_port_id;
104  uint8_t host_log_port_id;
105  int ep_number;
106  uint16_t ep_pdfid[SWITCHTEC_FABRIC_MULTI_FUNC_NUM];
107 };
108 
110  uint8_t host_sw_idx;
111  uint8_t host_phys_port_id;
112  uint8_t host_log_port_id;
113  uint16_t pdfid;
114  uint8_t option;
115 };
116 
117 int switchtec_gfms_bind(struct switchtec_dev *dev,
118  struct switchtec_gfms_bind_req *req);
119 int switchtec_gfms_unbind(struct switchtec_dev *dev,
120  struct switchtec_gfms_unbind_req *req);
121 
122 /********** PORT CONTROL *********/
123 
124 enum switchtec_fabric_port_control_type {
125  SWITCTEC_PORT_CONTROL_DISABLE,
126  SWITCTEC_PORT_CONTROL_ENABLE,
127  SWITCTEC_PORT_CONTROL_LINK_RETRAIN,
128  SWITCTEC_PORT_CONTROL_LINK_HOT_RESET,
129 };
130 
131 enum switchtec_fabric_hot_reset_flag {
132  SWITCTEC_PORT_CONTROL_HOT_RESET_STATUS_CLEAR,
133  SWITCTEC_PORT_CONTROL_HOT_RESET_STATUS_SET,
134 };
135 
136 int switchtec_port_control(struct switchtec_dev *dev, uint8_t control_type,
137  uint8_t phys_port_id, uint8_t hot_reset_flag);
138 
139 /********** PORT MANAGEMENT *********/
140 
144 enum switchtec_fab_port_type {
145  SWITCHTEC_FAB_PORT_TYPE_UNUSED,
146  SWITCHTEC_FAB_PORT_TYPE_FABRIC,
147  SWITCHTEC_FAB_PORT_TYPE_FABRIC_EP,
148  SWITCHTEC_FAB_PORT_TYPE_FABRIC_HOST,
149  SWITCHTEC_FAB_PORT_TYPE_INVALID,
150 };
151 
155 enum switchtec_fab_port_clock_sris {
156  SWITCHTEC_FAB_PORT_CLOCK_SRIS_DISABLE,
157  SWITCHTEC_FAB_PORT_CLOCK_SRIS_ENABLE,
158  SWITCHTEC_FAB_PORT_CLOCK_SRIS_INVALID,
159 };
160 
165  uint8_t port_type;
166  uint8_t clock_source;
167  uint8_t clock_sris;
168  uint8_t hvd_inst;
169 };
170 
171 int switchtec_fab_port_config_get(struct switchtec_dev *dev,
172  uint8_t phys_port_id,
173  struct switchtec_fab_port_config *info);
174 int switchtec_fab_port_config_set(struct switchtec_dev *dev,
175  uint8_t phys_port_id,
176  struct switchtec_fab_port_config *info);
177 
178 /********** GFMS DUMP *********/
179 
180 #define SWITCHTEC_FABRIC_MAX_SWITCH_NUM 16
181 #define SWITCHTEC_FABRIC_MAX_HOST_PER_SWITCH 16
182 #define SWITCHTEC_FABRIC_MAX_DEV_PER_SWITCH 32
183 #define SWITCHTEC_FABRIC_MAX_FUNC_PER_DEV 32
184 #define SWITCHTEC_FABRIC_MAX_BAR_NUM 6
185 #define SWITCHTEC_FABRIC_MAX_DSP_PER_HOST 32
186 #define SWITCHTEC_FABRIC_MAX_BINDING_NUM 512
187 
188 enum switchtec_gfms_db_ep_attached_device_type {
189  SWITCHTEC_GFMS_DB_TYPE_EP,
190  SWITCHTEC_GFMS_DB_TYPE_SWITCH,
191  SWITCHTEC_GFMS_DB_TYPE_NON,
192 };
193 
194 enum switchtec_gfms_db_reach_type {
195  SWITCHTEC_GFMS_DB_REACH_UC,
196  SWITCHTEC_GFMS_DB_REACH_BC,
197  SWITCHTEC_GFMS_DB_REACH_UR,
198 };
199 
200 enum switchtec_gfms_db_hvd_usp_link_state {
201  SWITCHTEC_GFMS_DB_HVD_USP_LINK_DOWN,
202  SWITCHTEC_GFMS_DB_HVD_USP_LINK_UP,
203 };
204 
205 enum switchtec_gfms_db_vep_type {
206  SWITCHTEC_GFMS_DB_VEP_TYPE_MGMT = 6,
207 };
208 
209 enum switchtec_gfms_db_ep_port_bar_type {
210  SWITCHTEC_GFMS_DB_EP_BAR_TYPE_MEM_32_PREFETCH = 0x8,
211  SWITCHTEC_GFMS_DB_EP_BAR_TYPE_MEM_64_PREFETCH = 0xc,
212  SWITCHTEC_GFMS_DB_EP_BAR_TYPE_MEM_32_NON_PREFETCH = 0x0,
213  SWITCHTEC_GFMS_DB_EP_BAR_TYPE_MEM_64_NON_PREFETCH = 0x4,
214  SWITCHTEC_GFMS_DB_EP_BAR_TYPE_IO_32_PREFETCH = 0x9,
215  SWITCHTEC_GFMS_DB_EP_BAR_TYPE_IO_64_PREFETCH = 0xd,
216  SWITCHTEC_GFMS_DB_EP_BAR_TYPE_IO_32_NON_PREFETCH = 0x1,
217  SWITCHTEC_GFMS_DB_EP_BAR_TYPE_IO_64_NON_PREFETCH = 0x5,
218 };
219 
221  uint8_t section_class;
222  uint8_t pax_idx;
223  uint16_t swfid;
224  uint32_t resp_size_dw;
225  uint32_t rsvd;
226 };
227 
229  uint32_t rsvd[3];
230  struct pax_idx_info {
231  uint8_t pax_idx;
232  uint8_t reachable_type;
233  uint16_t rsvd;
234  } pax_idx[16];
235 };
236 
240 };
241 
243  uint8_t phy_port_count;
244  uint8_t hvd_count;
245  uint16_t ep_count;
246  uint16_t ep_function_count;
247  uint16_t rsvd0;
248  uint32_t rsvd1[3];
249  uint16_t fid_start;
250  uint16_t fid_end;
251  uint16_t hfid_start;
252  uint16_t hfid_end;
253  uint16_t vdfid_start;
254  uint16_t vdfid_end;
255  uint16_t pdfid_start;
256  uint16_t pdfid_end;
257  uint32_t rc_port_map_low;
258  uint32_t rc_port_map_high;
259  uint32_t ep_port_map_low;
260  uint32_t ep_port_map_high;
261  uint32_t fab_port_map_low;
262  uint32_t fab_port_map_high;
263  uint32_t free_port_map_low;
264  uint32_t free_port_map_high;
265 };
266 
270 };
271 
273  uint8_t hvd_inst_id;
274  uint8_t phy_pid;
275  uint16_t hfid;
276  uint16_t logical_port_count;
277  uint16_t rsvd;
278  struct port_bound {
279  uint8_t log_pid;
280  uint8_t bound;
281  uint16_t bound_pdfid;
282  } bound[SWITCHTEC_FABRIC_MULTI_FUNC_NUM *
283  SWITCHTEC_FABRIC_MAX_DSP_PER_HOST];
284 };
285 
288  struct switchtec_gfms_db_hvd_body body;
289 };
290 
292  int hvd_count;
294  struct switchtec_gfms_db_hvd_body bodies[
295  SWITCHTEC_FABRIC_MAX_HOST_PER_SWITCH];
296 };
297 
299  uint8_t log_pid;
300  uint8_t bound;
301  uint16_t dsp_bdf;
302  uint16_t bound_pdfid;
303  uint16_t bound_hvd_bdf;
304 };
305 
307  uint8_t hvd_inst_id;
308  uint8_t phy_pid;
309  uint16_t hfid;
310  uint8_t vep_count;
311  uint8_t usp_status;
312  uint8_t rsvd[2];
313  struct {
314  uint8_t type;
315  uint8_t rsvd;
316  uint16_t bdf;
317  } vep_region[7];
318 
319  uint16_t log_dsp_count;
320  uint16_t usp_bdf;
322  log_port_region[SWITCHTEC_FABRIC_MULTI_FUNC_NUM *
323  SWITCHTEC_FABRIC_MAX_DSP_PER_HOST];
324 
325  uint32_t log_port_p2p_enable_bitmap_low;
326  uint32_t log_port_p2p_enable_bitmap_high;
327  uint8_t log_port_count;
329  uint32_t config_bitmap_low;
330  uint32_t config_bitmap_high;
331  uint32_t active_bitmap_low;
332  uint32_t active_bitmap_high;
333  } log_port_p2p_bitmap[SWITCHTEC_FABRIC_MAX_DSP_PER_HOST];
334 };
335 
339 };
340 
342  uint8_t phy_pid;
343  uint8_t rsvd0[3];
344  uint8_t attached_phy_pid;
345  uint8_t attached_sw_idx;
346  uint16_t attached_swfid;
347  uint32_t attached_fw_version;
348  uint32_t rsvd1[2];
349 };
350 
354 };
355 
357  uint16_t func_id;
358  uint16_t pdfid;
359  uint8_t sriov_cap_pf;
360  uint8_t vf_num;
361  uint16_t rsvd;
362  uint8_t bound;
363  uint8_t bound_pax_id;
364  uint8_t bound_hvd_phy_pid;
365  uint8_t bound_hvd_log_pid;
366  uint16_t vid;
367  uint16_t did;
368  uint16_t sub_sys_vid;
369  uint16_t sub_sys_did;
370  uint32_t device_class: 24;
371  uint32_t bar_number: 8;
372  struct bar {
373  uint8_t type;
374  uint8_t size;
375  } bars[6];
376 };
377 
379  uint16_t func_id;
380  uint16_t enumid;
381  uint32_t rsvd0[2];
382  uint16_t vid;
383  uint16_t did;
384  uint16_t rsvd1[2];
385  uint32_t device_class: 24;
386  uint32_t bar_num: 8;
387  struct {
388  uint8_t type;
389  uint8_t size;
390  } bar[6];
391 };
392 
394  uint16_t function_number;
395  uint16_t attached_dsp_enumid;
396  uint32_t size_dw: 24;
397  uint32_t rsvd: 8;
398 };
399 
403  functions[SWITCHTEC_FABRIC_MAX_FUNC_PER_DEV];
404 };
405 
410  internal_functions[
411  SWITCHTEC_FABRIC_MAX_HOST_PER_SWITCH +
412  SWITCHTEC_FABRIC_MAX_DEV_PER_SWITCH];
413  } ds_switch;
414 
416  switch_eps[SWITCHTEC_FABRIC_MAX_DEV_PER_SWITCH];
417 };
418 
420  uint8_t type;
421  uint8_t phy_pid;
422  uint16_t ep_count;
423  uint32_t size_dw: 24;
424  uint32_t rsvd: 8;
425 };
426 
428  struct switchtec_gfms_db_ep_port_hdr port_hdr;
429  union {
430  struct switchtec_gfms_db_ep_port_switch ep_switch;
431  struct switchtec_gfms_db_ep_port_ep ep_ep;
432  };
433 };
434 
437  struct switchtec_gfms_db_ep_port ep_port;
438 };
439 
441  int ep_port_count;
443  struct switchtec_gfms_db_ep_port ep_ports[
444  SWITCHTEC_FABRIC_MAX_DEV_PER_SWITCH];
445 };
446 
448  struct switchtec_gfms_db_fabric_general fabric_general;
449  struct switchtec_gfms_db_hvd_all hvd_all;
450  struct switchtec_gfms_db_pax_general pax_general;
451  struct switchtec_gfms_db_ep_port_all_section ep_port_all;
452 };
453 
454 static inline int switchtec_ep_port_bar_type_str(uint8_t bar_type,
455  char *bar_type_str,
456  size_t len)
457 {
458  switch (bar_type) {
459  case SWITCHTEC_GFMS_DB_EP_BAR_TYPE_MEM_32_PREFETCH:
460  strncpy(bar_type_str, "Memory, Prefetchable, 32-bit", len);
461  break;
462  case SWITCHTEC_GFMS_DB_EP_BAR_TYPE_MEM_64_PREFETCH:
463  strncpy(bar_type_str, "Memory, Prefetchable, 64-bit", len);
464  break;
465  case SWITCHTEC_GFMS_DB_EP_BAR_TYPE_MEM_32_NON_PREFETCH:
466  strncpy(bar_type_str, "Memory, Non-prefetchable, 32-bit", len);
467  break;
468  case SWITCHTEC_GFMS_DB_EP_BAR_TYPE_MEM_64_NON_PREFETCH:
469  strncpy(bar_type_str, "Memory, Non-prefetchable, 64-bit", len);
470  break;
471  case SWITCHTEC_GFMS_DB_EP_BAR_TYPE_IO_32_PREFETCH:
472  strncpy(bar_type_str, "IO, Prefetchable, 32-bit", len);
473  break;
474  case SWITCHTEC_GFMS_DB_EP_BAR_TYPE_IO_64_PREFETCH:
475  strncpy(bar_type_str, "IO, Prefetchable, 64-bit", len);
476  break;
477  case SWITCHTEC_GFMS_DB_EP_BAR_TYPE_IO_32_NON_PREFETCH:
478  strncpy(bar_type_str, "IO, Non-prefetchable, 32-bit", len);
479  break;
480  case SWITCHTEC_GFMS_DB_EP_BAR_TYPE_IO_64_NON_PREFETCH:
481  strncpy(bar_type_str, "IO, Non-prefetchable, 64-bit", len);
482  break;
483  default:
484  strncpy(bar_type_str, "Unknown", len);
485  }
486 
487  bar_type_str[len - 1] = '\0';
488  return 0;
489 }
490 
491 int switchtec_fab_gfms_db_dump_fabric_general(
492  struct switchtec_dev *dev,
493  struct switchtec_gfms_db_fabric_general *fabric_general);
494 int switchtec_fab_gfms_db_dump_pax_all(
495  struct switchtec_dev *dev,
496  struct switchtec_gfms_db_pax_all *pax_all);
497 int switchtec_fab_gfms_db_dump_pax_general(
498  struct switchtec_dev *dev,
499  struct switchtec_gfms_db_pax_general *pax_general);
500 int switchtec_fab_gfms_db_dump_hvd(struct switchtec_dev *dev,
501  uint8_t hvd_idx,
502  struct switchtec_gfms_db_hvd *hvd);
503 int switchtec_fab_gfms_db_dump_fab_port(
504  struct switchtec_dev *dev,
505  uint8_t phy_pid,
506  struct switchtec_gfms_db_fab_port *fab_port);
507 int switchtec_fab_gfms_db_dump_ep_port(
508  struct switchtec_dev *dev,
509  uint8_t phy_pid,
510  struct switchtec_gfms_db_ep_port_section *ep_port_section);
511 int switchtec_fab_gfms_db_dump_hvd_detail(
512  struct switchtec_dev *dev,
513  uint8_t hvd_idx,
514  struct switchtec_gfms_db_hvd_detail *hvd_detail);
515 
516 /********** GFMS Event *********/
517 
521 enum switchtec_gfms_event_type {
522  SWITCHTEC_GFMS_EVENT_HOST_LINK_UP = 0,
523  SWITCHTEC_GFMS_EVENT_HOST_LINK_DOWN = 1,
524  SWITCHTEC_GFMS_EVENT_DEV_ADD = 2,
525  SWITCHTEC_GFMS_EVENT_DEV_DEL = 3,
526  SWITCHTEC_GFMS_EVENT_FAB_LINK_UP = 4,
527  SWITCHTEC_GFMS_EVENT_FAB_LINK_DOWN = 5,
528  SWITCHTEC_GFMS_EVENT_BIND = 6,
529  SWITCHTEC_GFMS_EVENT_UNBIND = 7,
530  SWITCHTEC_GFMS_EVENT_DATABASE_CHANGED = 8,
531  SWITCHTEC_GFMS_EVENT_HVD_INST_ENABLE = 9,
532  SWITCHTEC_GFMS_EVENT_HVD_INST_DISABLE = 10,
533  SWITCHTEC_GFMS_EVENT_EP_PORT_REMOVE = 11,
534  SWITCHTEC_GFMS_EVENT_EP_PORT_ADD = 12,
535  SWITCHTEC_GFMS_EVENT_AER = 13,
536  SWITCHTEC_GFMS_EVENT_MAX = 14
537 };
538 
543  uint16_t phys_port_id;
544 };
545 
550  uint16_t phys_port_id;
551  uint16_t function_count;
552 };
553 
558  uint8_t host_sw_idx;
559  uint8_t host_phys_port_id;
560  uint8_t log_port_id;
561  uint8_t reserved1;
562  uint16_t pdfid;
563 };
564 
569  uint8_t hvd_inst_id;
570  uint8_t phys_port_id;
571  uint8_t clock_chan;
572 };
573 
578  uint8_t phys_port_id;
579 };
580 
585  uint16_t phys_port_id;
586  uint8_t handle;
587  uint8_t reserved1;
588  uint32_t ce_ue_err_sts;
589  uint32_t aer_err_log_time_stamp_high;
590  uint32_t aer_err_log_time_stamp_low;
591  uint32_t aer_header_log[4];
592 };
594 #define switchtec_gfms_aer_log(aer) (((aer)->handle) & 0x01)
596 #define switchtec_gfms_aer_dpc(aer) (((aer)->handle) & 0x02)
598 #define switchtec_gfms_aer_ce_ue(aer) (((aer)->handle) & 0x04)
599 
604  int event_code;
605  int src_sw_id;
606  union {
607  struct switchtec_gfms_event_host host;
608  struct switchtec_gfms_event_dev dev;
609  struct switchtec_gfms_event_bind bind;
610  struct switchtec_gfms_event_hvd hvd;
612  struct switchtec_gfms_event_aer aer;
613  uint32_t byte[8];
614  } data;
615 };
616 
617 int switchtec_get_gfms_events(struct switchtec_dev *dev,
618  struct switchtec_gfms_event *elist,
619  size_t elist_len, int *overflow,
620  size_t *remain_number);
621 
622 int switchtec_clear_gfms_events(struct switchtec_dev *dev);
623 
624 /********** DEVICE MANAGE *********/
625 #define SWITCHTEC_DEVICE_MANAGE_MAX_RESP 1016
626 
628  uint16_t pdfid;
629  uint16_t expected_rsp_len;
630 };
631 
633  uint16_t rsp_len;
634  uint16_t rsvd;
635 };
636 
639  uint8_t cmd_data[MRPC_MAX_DATA_LEN -
640  sizeof(struct switchtec_device_manage_req_hdr)];
641 };
642 
645  uint8_t rsp_data[SWITCHTEC_DEVICE_MANAGE_MAX_RESP];
646 };
647 
648 int switchtec_device_manage(struct switchtec_dev *dev,
649  struct switchtec_device_manage_req *req,
650  struct switchtec_device_manage_rsp *rsp);
651 
652 /********** EP TUNNEL MANAGEMENT *********/
653 enum switchtec_ep_tunnel_status{
654  SWITCHTEC_EP_TUNNEL_DISABLED = 0,
655  SWITCHTEC_EP_TUNNEL_ENABLED = 1,
656 };
657 
658 int switchtec_ep_tunnel_config(struct switchtec_dev *dev, uint16_t subcmd,
659  uint16_t pdfid, uint16_t expected_rsp_len,
660  uint8_t *meta_data, uint16_t meta_data_len,
661  uint8_t *rsp_data);
662 int switchtec_ep_tunnel_enable(struct switchtec_dev *dev, uint16_t pdfid);
663 int switchtec_ep_tunnel_disable(struct switchtec_dev *dev, uint16_t pdfid);
664 int switchtec_ep_tunnel_status(struct switchtec_dev *dev, uint16_t pdfid,
665  uint32_t *status);
666 
667 /********** EP RESOURCE MANAGEMENT *********/
668 #define SWITCHTEC_EP_CSR_MAX_READ_LEN 4
669 #define SWITCHTEC_EP_CSR_MAX_WRITE_LEN 4
670 #define SWITCHTEC_EP_BAR_MAX_READ_LEN SWITCHTEC_MRPC_PAYLOAD_SIZE
671 #define SWITCHTEC_EP_BAR_MAX_WRITE_LEN 128
672 
673 int switchtec_ep_csr_read8(struct switchtec_dev *dev, uint16_t pdfid,
674  uint16_t addr, uint8_t *val);
675 int switchtec_ep_csr_read16(struct switchtec_dev *dev, uint16_t pdfid,
676  uint16_t addr, uint16_t *val);
677 int switchtec_ep_csr_read32(struct switchtec_dev *dev, uint16_t pdfid,
678  uint16_t addr, uint32_t *val);
679 
680 int switchtec_ep_csr_write8(struct switchtec_dev *dev, uint16_t pdfid,
681  uint8_t val, uint16_t addr);
682 int switchtec_ep_csr_write16(struct switchtec_dev *dev, uint16_t pdfid,
683  uint16_t val, uint16_t addr);
684 int switchtec_ep_csr_write32(struct switchtec_dev *dev, uint16_t pdfid,
685  uint32_t val, uint16_t addr);
686 
687 int switchtec_ep_bar_read8(struct switchtec_dev *dev, uint16_t pdfid,
688  uint8_t bar_index, uint64_t addr, uint8_t *val);
689 int switchtec_ep_bar_read16(struct switchtec_dev *dev, uint16_t pdfid,
690  uint8_t bar_index, uint64_t addr, uint16_t *val);
691 int switchtec_ep_bar_read32(struct switchtec_dev *dev, uint16_t pdfid,
692  uint8_t bar_index, uint64_t addr, uint32_t *val);
693 int switchtec_ep_bar_read64(struct switchtec_dev *dev, uint16_t pdfid,
694  uint8_t bar_index, uint64_t addr, uint64_t *val);
695 
696 int switchtec_ep_bar_write8(struct switchtec_dev *dev, uint16_t pdfid,
697  uint8_t bar_index, uint8_t val, uint64_t addr);
698 int switchtec_ep_bar_write16(struct switchtec_dev *dev, uint16_t pdfid,
699  uint8_t bar_index, uint16_t val, uint64_t addr);
700 int switchtec_ep_bar_write32(struct switchtec_dev *dev, uint16_t pdfid,
701  uint8_t bar_index, uint32_t val, uint64_t addr);
702 int switchtec_ep_bar_write64(struct switchtec_dev *dev, uint16_t pdfid,
703  uint8_t bar_index, uint64_t val, uint64_t addr);
704 
705 /********** ADMIN PASSTHRU COMMAND *********/
706 #define SWITCHTEC_NVME_ADMIN_PASSTHRU_MAX_DATA_LEN (4096 + 16 * 4)
707 
708 int switchtec_nvme_admin_passthru(struct switchtec_dev *dev, uint16_t pdfid,
709  size_t data_len, void *data,
710  size_t *rsp_len, void *rsp);
711 
712 #ifdef __cplusplus
713 }
714 #endif
715 
716 #endif
The port config.
Definition: fabric.h:164
uint8_t clock_sris
Port clock sris, enable/disable.
Definition: fabric.h:167
uint8_t hvd_inst
HVM domain instance index for USP.
Definition: fabric.h:168
uint8_t port_type
Port type.
Definition: fabric.h:165
uint8_t clock_source
CSU channel index for port clock source(0-2)
Definition: fabric.h:166
uint16_t gpio_idx
GPIO index.
Definition: fabric.h:54
Represents each port in the in topology info.
Definition: fabric.h:47
struct gpio_idx_val conn_sig_presence
Presence GPIO pin.
Definition: fabric.h:61
struct gpio_idx_val conn_sig_dsp_perst
DSP PERST# GPIO pin.
Definition: fabric.h:59
uint8_t port_clock_channel
Clock channel.
Definition: fabric.h:50
uint8_t port_connector_id
Connector index.
Definition: fabric.h:51
struct gpio_idx_val conn_sig_8639
SFF-8639 IFDET GPIO pin.
Definition: fabric.h:62
uint8_t port_neg_rate
link rate negotiated
Definition: fabric.h:67
uint8_t phys_port_id
Physical port id.
Definition: fabric.h:48
uint8_t port_minor_ltssm
Minor LTSSM state.
Definition: fabric.h:69
uint8_t port_cfg_width
link width in config file
Definition: fabric.h:64
uint8_t port_cfg_rate
link rate in config file
Definition: fabric.h:66
struct switchtec_fab_port_info::gpio_idx_val conn_sig_pwrctrl
Power controller GPIO pin.
struct gpio_idx_val conn_sig_usp_perst
USP PERST# GPIO pin.
Definition: fabric.h:60
uint8_t port_type
Port type.
Definition: fabric.h:49
uint8_t port_neg_width
link width negotiated
Definition: fabric.h:65
uint8_t port_major_ltssm
Major LTSSM state.
Definition: fabric.h:68
Represents the topology info.
Definition: fabric.h:76
struct switchtec_fab_port_info port_info_list[SWITCHTEC_MAX_PORTS]
Port info list.
Definition: fabric.h:91
uint8_t sw_idx
Switch index.
Definition: fabric.h:77
int num_stack_bif
Number of port bifurcation fields.
Definition: fabric.h:79
uint8_t route_port[16]
Route port.
Definition: fabric.h:81
uint32_t stack_bif[8]
Port bifurcation.
Definition: fabric.h:80
uint64_t port_bitmap
Enabled physical port bitmap.
Definition: fabric.h:82
The event data for SWITCHTEC_GFMS_EVENT_AER.
Definition: fabric.h:584
The event data for SWITCHTEC_GFMS_EVENT_BIND/UNBIND.
Definition: fabric.h:557
The event data for SWITCHTEC_GFMS_EVENT_DEV_ADD/DEL.
Definition: fabric.h:549
The event data for SWITCHTEC_GFMS_EVENT_EP_PORT_ADD/REMOVE.
Definition: fabric.h:577
The event data for SWITCHTEC_GFMS_EVENT_HOST_LINK_UP/DOWN.
Definition: fabric.h:542
The event data for SWITCHTEC_GFMS_EVENT_HVD_INST_ENABLE/DISABLE.
Definition: fabric.h:568
Represents the GFMS event.
Definition: fabric.h:603
Main Switchtec header.