init.h (7048B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 * DO NOT EDIT THIS FILE! 9 * This file is auto-generated. 10 * Edits to this file will be lost when it is regenerated. 11 */ 12 13 #ifndef __BCM_INIT_H__ 14 #define __BCM_INIT_H__ 15 16 #include <bcm/types.h> 17 #include <bcm/module.h> 18 19 /* BCM Information structure. */ 20 typedef struct bcm_info_s { 21 uint32 vendor; /* PCI values used usually. */ 22 uint32 device; /* PCI values used usually. */ 23 uint32 revision; /* PCI values used usually. */ 24 uint32 capability; 25 int num_pipes; /* Number of pipes in the device. */ 26 } bcm_info_t; 27 28 /* Capability flags. */ 29 #define BCM_INFO_SWITCH 0x00000001 /* Network switch chip. */ 30 #define BCM_INFO_FABRIC 0x00000002 /* Fabric chip. */ 31 #define BCM_INFO_L3 0x00000004 /* Chip has layer 3. */ 32 #define BCM_INFO_IPMC 0x00000008 /* Chip has IP multicast. */ 33 34 #ifndef BCM_HIDE_DISPATCHABLE 35 36 /* Initialize the BCM software layer for a device. */ 37 extern int bcm_init( 38 int unit); 39 40 /* Initialize selected BCM modules for a device. */ 41 extern int bcm_init_selective( 42 int unit, 43 uint32 flags); 44 45 /* Check on initialization status of a unit. */ 46 extern int bcm_init_check( 47 int unit); 48 49 #endif /* BCM_HIDE_DISPATCHABLE */ 50 51 /* Attach a device as a BCM unit. */ 52 extern int bcm_attach( 53 int unit, 54 char *type, 55 char *subtype, 56 int remunit); 57 58 /* Attach only tx and rx modules to a device as a BCM unit. */ 59 extern int bcm_attach_early_txrx( 60 int unit, 61 char *type, 62 char *subtype, 63 int remunit); 64 65 /* Detach a device as a BCM unit. */ 66 extern int bcm_detach( 67 int unit); 68 69 /* Detach all modules excluding tx and rx from BCM unit. */ 70 extern int bcm_detach_late_txrx( 71 int unit); 72 73 /* Find a matching BCM unit. */ 74 extern int bcm_find( 75 char *type, 76 char *subtype, 77 int remunit); 78 79 /* Determine if a BCM unit is attached. */ 80 extern int bcm_attach_check( 81 int unit); 82 83 /* Determine highest BCM unit currently attached. */ 84 extern int bcm_attach_max( 85 int *max_units); 86 87 #ifndef BCM_HIDE_DISPATCHABLE 88 89 /* Get information about a BCM unit. */ 90 extern int bcm_info_get( 91 int unit, 92 bcm_info_t *info); 93 94 #endif /* BCM_HIDE_DISPATCHABLE */ 95 96 /* Groups of devices */ 97 typedef enum bcm_device_member_e { 98 bcmDeviceMemberDNX = 0, /* DNX FAP device */ 99 bcmDeviceMemberDNXF = 1, /* DNX Fabric element device */ 100 bcmDeviceMemberDPP = 2, /* DPP FAP device */ 101 bcmDeviceMemberDFE = 3, /* DFE Fabric element device */ 102 bcmDeviceMemberDNXC = 4 /* DNX FAP or Fabric element device */ 103 } bcm_device_member_t; 104 105 #ifndef BCM_HIDE_DISPATCHABLE 106 107 /* Check if the device is member of group 'member_type' */ 108 extern int bcm_device_member_get( 109 int unit, 110 uint32 flags, 111 bcm_device_member_t member_type, 112 int *is_member); 113 114 /* Initialize a device excluding stacking functionality. */ 115 extern int bcm_clear( 116 int unit); 117 118 #endif /* BCM_HIDE_DISPATCHABLE */ 119 120 /* Initialize the BCM Information structure. */ 121 extern void bcm_info_t_init( 122 bcm_info_t *info); 123 124 #if !defined(BCM_WARM_BOOT_SUPPORT) 125 /* Define as empty just to be safe. */ 126 #define _bcm_shutdown(unit) BCM_E_NONE 127 #endif 128 129 #ifndef BCM_HIDE_DISPATCHABLE 130 131 #if defined(BCM_WARM_BOOT_SUPPORT) 132 /* _bcm_shutdown */ 133 extern int _bcm_shutdown( 134 int unit); 135 #endif 136 137 #endif /* BCM_HIDE_DISPATCHABLE */ 138 139 /* Device State. */ 140 typedef enum bcm_device_state_e { 141 bcmDeviceStateAttach = 0, /* Device attach. */ 142 bcmDeviceStateDetach = 1 /* Device detach. */ 143 } bcm_device_state_t; 144 145 /* Attach/detach information. */ 146 typedef struct bcm_attach_info_s { 147 int unit; /* Attach/detach unit. */ 148 const char *type; /* Attach/detach type. */ 149 const char *subtype; /* Attach/detach subtype. */ 150 int remunit; /* Attach/detach remunit. */ 151 } bcm_attach_info_t; 152 153 /* Initialize the BCM Attach Information structure. */ 154 extern void bcm_attach_info_t_init( 155 bcm_attach_info_t *info); 156 157 /* Attach/detach callback */ 158 typedef int (*bcm_attach_cb_t)( 159 int unit, 160 bcm_device_state_t state, 161 bcm_attach_info_t *info, 162 void *user_data); 163 164 /* Register to receive callbacks during device attach/detach. */ 165 extern int bcm_attach_register( 166 int unit, 167 bcm_attach_cb_t cb, 168 void *user_data); 169 170 /* Unregister attach callback function. */ 171 extern int bcm_attach_unregister( 172 int unit, 173 bcm_attach_cb_t cb, 174 void *user_data); 175 176 /* Detach retry. */ 177 typedef struct bcm_detach_retry_s { 178 uint32 poll_usecs; /* Time poll interval in usecs. */ 179 int num_retries; /* Number of retries. */ 180 } bcm_detach_retry_t; 181 182 /* Initialize the BCM Detach Retry structure. */ 183 extern void bcm_detach_retry_t_init( 184 bcm_detach_retry_t *retry); 185 186 /* Set detach time poll interval and number of retries. */ 187 extern int bcm_detach_retry_set( 188 int unit, 189 bcm_detach_retry_t *retry); 190 191 /* Get detach time poll interval and number of retries. */ 192 extern int bcm_detach_retry_get( 193 int unit, 194 bcm_detach_retry_t *retry); 195 196 /* This structure should contain user's information. */ 197 typedef struct bcm_init_advanced_info_s { 198 uint32 debug_flags; /* Holds flags, such as print time stamp, print memory 199 utilization, test memory leak, etc. */ 200 } bcm_init_advanced_info_t; 201 202 #ifndef BCM_HIDE_DISPATCHABLE 203 204 /* 205 * API for initialization, caller can decide himself on flags and init 206 * info. 207 */ 208 extern int bcm_init_advanced( 209 int unit, 210 bcm_init_advanced_info_t *init_advanced_info); 211 212 #endif /* BCM_HIDE_DISPATCHABLE */ 213 214 #define BCM_INIT_ADVANCED_F_MEM_LEAK_DETECT 0x1 /* Memory Leak detection 215 Activated. */ 216 #define BCM_INIT_ADVANCED_F_MEM_LOG 0x2 /* Memory Logging. */ 217 #define BCM_INIT_ADVANCED_F_TIME_STAMP 0x4 /* Time Stamp saving 218 Activated. */ 219 #define BCM_INIT_ADVANCED_F_TIME_LOG 0x8 /* Time Stamp saving 220 Activated. */ 221 #define BCM_INIT_ADVANCED_F_SWSTATE_LOG 0x10 /* SW state resources 222 Logging. */ 223 #define BCM_INIT_ADVANCED_F_ACCESS_ONLY 0x20 /* Access only booting. 224 Will run just steps 225 marked with 226 UTILEX_SEQ_STEP_F_REQUIRED_FOR_ACCESS_ONLY 227 and 228 UTILEX_SEQ_STEP_F_REQUIRED_FOR_ACCESS_ONLY. */ 229 #define BCM_INIT_ADVANCED_F_TIME_ANALYZER_LOG 0x40 /* Display time analyzer 230 logging. */ 231 232 #endif /* __BCM_INIT_H__ */