scache_dictionary.h (2229B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * This file contains structure and routine declarations for the 8 * storage cache misc management internal api. 9 * 10 * The misc operations are used to backup inconstant variables in scache 11 */ 12 13 #ifndef _SOC_SCACHE_DICTIONARY_H_ 14 #define _SOC_SCACHE_DICTIONARY_H_ 15 #ifdef BCM_WARM_BOOT_SUPPORT 16 17 #include <sal/core/libc.h> 18 19 /* dictionary entry size is 2+2+56+4=64 byte */ 20 #define SOC_SCACHE_DICTIONARY_ENTRY_NAME_MAX 56 21 22 typedef struct soc_scache_dictionary_entry_s { 23 uint16 owner; 24 uint16 key; 25 char name[SOC_SCACHE_DICTIONARY_ENTRY_NAME_MAX]; 26 int value; 27 } soc_scache_dictionary_entry_t; 28 29 /* soc scache dictionary entry name */ 30 #define ssden_SOC_MAX_NUM_PORTS "soc_max_num_ports" 31 #define ssden_SOC_MAX_NUM_PP_PORTS "soc_max_num_pp_ports" 32 #define ssden_SOC_MAX_NUM_BLKS "soc_max_num_blks" 33 #define ssden_SOC_MAX_NUM_PIPES "soc_max_num_pipes" 34 #define ssden_SOC_MAX_MEM_BYTES "soc_max_num_bytes" 35 #define ssden_SOC_PBMP_PORT_MAX "soc_pbmp_port_max" 36 37 extern int 38 soc_scache_dictionary_alloc(int unit); 39 extern int 40 soc_scache_dictionary_recover(int unit); 41 extern int 42 soc_scache_dictionary_sync(int unit); 43 extern int 44 soc_scache_dictionary_entry_get(int unit, const char *name, int defl); 45 extern int 46 soc_scache_dictionary_entry_set(int unit, char *name, int value); 47 48 #define SOC_SCACHE_SIZE_MIN(_sz1_, _sz2_) \ 49 ((_sz1_) < (_sz2_) ? (_sz1_) : (_sz2_)) 50 #define SOC_SCACHE_SIZE_MIN_RECOVER(_scache_ptr_, _local_ptr_, _scache_sz_, _local_sz_) \ 51 do { \ 52 if ((_local_ptr_)) { \ 53 sal_memcpy((_local_ptr_), (_scache_ptr_), \ 54 SOC_SCACHE_SIZE_MIN(_scache_sz_, _local_sz_)); \ 55 } \ 56 (_scache_ptr_) += (_scache_sz_); \ 57 } while (0) 58 59 #endif /* BCM_WARM_BOOT_SUPPORT */ 60 #endif /* _SOC_SCACHE_DICTIONARY_H_ */