openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

soc_ser_log.h (4078B)


      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  * File: soc_ser_log.h
      7  * Purpose: SER logging using a circular buffer
      8  */
      9 
     10 #ifndef _SOC_SER_LOG_H_
     11 #define _SOC_SER_LOG_H_
     12 
     13 #include <soc/mem.h>
     14 
     15 typedef enum {
     16     SOC_PARITY_TYPE_NONE,
     17     SOC_PARITY_TYPE_GENERIC,
     18     SOC_PARITY_TYPE_PARITY,
     19     SOC_PARITY_TYPE_ECC,
     20     SOC_PARITY_TYPE_HASH,
     21     SOC_PARITY_TYPE_EDATABUF,
     22     SOC_PARITY_TYPE_COUNTER,
     23     SOC_PARITY_TYPE_MXQPORT,
     24     SOC_PARITY_TYPE_SER
     25 } soc_ser_parity_type_t;
     26 
     27 typedef enum {
     28     SOC_SER_UNKNOWN = -1,
     29     SOC_SER_UNCORRECTED = 0,
     30     SOC_SER_CORRECTED = 1
     31 } soc_ser_correct_t;
     32 
     33 /* Used to indicate the format of the data/value portion of a TLV */
     34 typedef enum {
     35     SOC_SER_LOG_TLV_NONE = 0,
     36     SOC_SER_LOG_TLV_MEMORY = 1,
     37     SOC_SER_LOG_TLV_REGISTER = 2,
     38     SOC_SER_LOG_TLV_CONTENTS = 3,
     39     SOC_SER_LOG_TLV_SER_FIFO = 4,
     40     SOC_SER_LOG_TLV_CACHE = 5,
     41     SOC_SER_LOG_TLV_GENERIC = 6
     42 } soc_ser_log_tlv_type_t;
     43 
     44 typedef enum {
     45     SOC_SER_LOG_ACC_ANY = -1,
     46     SOC_SER_LOG_ACC_GROUP = 0,
     47     SOC_SER_LOG_ACC_X = 1,
     48     SOC_SER_LOG_ACC_Y = 2,
     49     SOC_SER_LOG_ACC_SBS = 6
     50 } soc_ser_log_acc_type_t;
     51 
     52 /* Type length value header for elements of the log */
     53 typedef struct soc_ser_log_tlv_hdr_s {
     54     int type;
     55     int length;
     56 } soc_ser_log_tlv_hdr_t;
     57 
     58 /* Data/value portion of memory TLVs */
     59 typedef struct soc_ser_log_tlv_memory_s {
     60     soc_mem_t memory;
     61     int index;
     62     uint32 hwbase;
     63 } soc_ser_log_tlv_memory_t;
     64 
     65 /* Data/value portion of register TLVs */
     66 typedef struct soc_ser_log_tlv_register_s {
     67     soc_reg_t reg;
     68     int index;
     69     int port;
     70 } soc_ser_log_tlv_register_t;
     71 
     72 typedef enum {
     73     SOC_SER_LOG_FLAG_ERR_SRC = 1,
     74     SOC_SER_LOG_FLAG_MULTIBIT = 1 << 1,
     75     SOC_SER_LOG_FLAG_DOUBLEBIT = 1 << 2
     76 } soc_ser_log_flag_t;
     77 
     78 /* Data/value portion of generic TLVs */
     79 typedef struct soc_ser_log_tlv_generic_s {
     80     soc_ser_log_flag_t      flags;
     81     sal_usecs_t             time;
     82     uint8                   boot_count;
     83     uint32                  address;
     84     soc_ser_log_acc_type_t  acc_type;
     85     soc_block_t             block_type;
     86     soc_ser_parity_type_t   parity_type;
     87     int                     ser_response_flag;
     88     int                     corrected;
     89     int                     pipe_num;
     90     int                     inst;
     91     uint8                   hw_cache; /* Recover from other pipe */
     92 } soc_ser_log_tlv_generic_t;
     93 
     94 #define _SOC_SER_LOG_BUFFER_SIZE 5000
     95 
     96 extern int soc_ser_log_init(int unit, void *location, int size);
     97 extern int soc_ser_log_invalidate(int unit);
     98 extern int soc_ser_log_get_entry_size(int unit, int id, int *size);
     99 extern int soc_ser_log_get_entry(int unit, int id, int size, void *entry);
    100 extern int soc_ser_log_create_entry(int unit, int size);
    101 extern int soc_ser_bus_buffer_log_find(int unit, uint32 hwbase);
    102 extern int soc_ser_log_find_recent(int unit, soc_mem_t mem, int index, sal_usecs_t time);
    103 extern int soc_ser_log_print_entry(int unit, void *buffer);
    104 extern int soc_ser_log_add_tlv( int unit, 
    105                                 int id,
    106                                 soc_ser_log_tlv_type_t type, 
    107                                 int size, 
    108                                 void * buffer);
    109 
    110 extern int soc_ser_log_get_tlv( int unit, 
    111                                 int id,
    112                                 soc_ser_log_tlv_type_t type, 
    113                                 int size, 
    114                                 void * buffer);
    115 
    116 extern int soc_ser_log_mod_tlv( int unit, 
    117                                 int id,
    118                                 soc_ser_log_tlv_type_t type, 
    119                                 int size, 
    120                                 void * buffer);
    121 extern int soc_ser_log_find_tlv(void *buffer, soc_ser_log_tlv_type_t type);
    122 extern int soc_ser_log_print_tlv(int unit, void *buffer);
    123 extern int soc_ser_log_get_boot_count(int unit);
    124 extern int soc_ser_log_print_all(int unit);
    125 extern int soc_ser_log_print_one(int unit, int id);
    126 #endif