126 lines · c
1/* Broadcom NetXtreme-C/E network driver.2 *3 * Copyright (c) 2018 Broadcom Inc4 *5 * This program is free software; you can redistribute it and/or modify6 * it under the terms of the GNU General Public License as published by7 * the Free Software Foundation.8 */9 10#ifndef BNXT_COREDUMP_H11#define BNXT_COREDUMP_H12 13#include <linux/utsname.h>14#include <linux/time.h>15#include <linux/rtc.h>16 17struct bnxt_coredump_segment_hdr {18 __u8 signature[4];19 __le32 component_id;20 __le32 segment_id;21 __le32 flags;22 __u8 low_version;23 __u8 high_version;24 __le16 function_id;25 __le32 offset;26 __le32 length;27 __le32 status;28 __le32 duration;29 __le32 data_offset;30 __le32 instance;31 __le32 rsvd[5];32};33 34struct bnxt_coredump_record {35 __u8 signature[4];36 __le32 flags;37 __u8 low_version;38 __u8 high_version;39 __u8 asic_state;40 __u8 rsvd0[5];41 char system_name[32];42 __le16 year;43 __le16 month;44 __le16 day;45 __le16 hour;46 __le16 minute;47 __le16 second;48 __le16 utc_bias;49 __le16 rsvd1;50 char commandline[256];51 __le32 total_segments;52 __le32 os_ver_major;53 __le32 os_ver_minor;54 __le32 rsvd2;55 char os_name[32];56 __le16 end_year;57 __le16 end_month;58 __le16 end_day;59 __le16 end_hour;60 __le16 end_minute;61 __le16 end_second;62 __le16 end_utc_bias;63 __le32 asic_id1;64 __le32 asic_id2;65 __le32 coredump_status;66 __u8 ioctl_low_version;67 __u8 ioctl_high_version;68 __le16 rsvd3[313];69};70 71#define BNXT_CRASH_DUMP_LEN (8 << 20)72 73#define COREDUMP_LIST_BUF_LEN 204874#define COREDUMP_RETRIEVE_BUF_LEN 409675 76struct bnxt_coredump {77 void *data;78 int data_size;79 u16 total_segs;80};81 82#define BNXT_COREDUMP_BUF_LEN(len) ((len) - sizeof(struct bnxt_coredump_record))83 84struct bnxt_hwrm_dbg_dma_info {85 void *dest_buf;86 int dest_buf_size;87 u16 dma_len;88 u16 seq_off;89 u16 data_len_off;90 u16 segs;91 u32 seg_start;92 u32 buf_len;93};94 95struct hwrm_dbg_cmn_input {96 __le16 req_type;97 __le16 cmpl_ring;98 __le16 seq_id;99 __le16 target_id;100 __le64 resp_addr;101 __le64 host_dest_addr;102 __le32 host_buf_len;103};104 105struct hwrm_dbg_cmn_output {106 __le16 error_code;107 __le16 req_type;108 __le16 seq_id;109 __le16 resp_len;110 u8 flags;111 #define HWRM_DBG_CMN_FLAGS_MORE 1112};113 114#define BNXT_DBG_FL_CR_DUMP_SIZE_SOC \115 DBG_QCFG_REQ_FLAGS_CRASHDUMP_SIZE_FOR_DEST_DEST_SOC_DDR116#define BNXT_DBG_FL_CR_DUMP_SIZE_HOST \117 DBG_QCFG_REQ_FLAGS_CRASHDUMP_SIZE_FOR_DEST_DEST_HOST_DDR118#define BNXT_DBG_CR_DUMP_MDM_CFG_DDR \119 DBG_CRASHDUMP_MEDIUM_CFG_REQ_TYPE_DDR120 121int bnxt_get_coredump(struct bnxt *bp, u16 dump_type, void *buf, u32 *dump_len);122int bnxt_hwrm_get_dump_len(struct bnxt *bp, u16 dump_type, u32 *dump_len);123u32 bnxt_get_coredump_length(struct bnxt *bp, u16 dump_type);124 125#endif126