return rc;
 }
 
-static void
+void
 bnxt_fill_coredump_seg_hdr(struct bnxt *bp,
                           struct bnxt_coredump_segment_hdr *seg_hdr,
                           struct coredump_segment_record *seg_rec, u32 seg_len,
-                          int status, u32 duration, u32 instance)
+                          int status, u32 duration, u32 instance, u32 comp_id,
+                          u32 seg_id)
 {
        memset(seg_hdr, 0, sizeof(*seg_hdr));
        memcpy(seg_hdr->signature, "sEgM", 4);
                seg_hdr->high_version = seg_rec->version_hi;
                seg_hdr->flags = cpu_to_le32(seg_rec->compress_flags);
        } else {
-               /* For hwrm_ver_get response Component id = 2
-                * and Segment id = 0
-                */
-               seg_hdr->component_id = cpu_to_le32(2);
-               seg_hdr->segment_id = 0;
+               seg_hdr->component_id = cpu_to_le32(comp_id);
+               seg_hdr->segment_id = cpu_to_le32(seg_id);
        }
        seg_hdr->function_id = cpu_to_le16(bp->pdev->devfn);
        seg_hdr->length = cpu_to_le32(seg_len);
        start_utc = sys_tz.tz_minuteswest * 60;
        seg_hdr_len = sizeof(seg_hdr);
 
-       /* First segment should be hwrm_ver_get response */
+       /* First segment should be hwrm_ver_get response.
+        * For hwrm_ver_get response Component id = 2 and Segment id = 0.
+        */
        *dump_len = seg_hdr_len + ver_get_resp_len;
        if (buf) {
                bnxt_fill_coredump_seg_hdr(bp, &seg_hdr, NULL, ver_get_resp_len,
-                                          0, 0, 0);
+                                          0, 0, 0, BNXT_VER_GET_COMP_ID, 0);
                memcpy(buf + offset, &seg_hdr, seg_hdr_len);
                offset += seg_hdr_len;
                memcpy(buf + offset, &bp->ver_resp, ver_get_resp_len);
                end = jiffies;
                duration = jiffies_to_msecs(end - start);
                bnxt_fill_coredump_seg_hdr(bp, &seg_hdr, seg_record, seg_len,
-                                          rc, duration, 0);
+                                          rc, duration, 0, 0, 0);
 
                if (buf) {
                        /* Write segment header into the buffer */
 
        __le16 rsvd3[313];
 };
 
+#define BNXT_VER_GET_COMP_ID   2
+
 #define BNXT_CRASH_DUMP_LEN    (8 << 20)
 
 #define COREDUMP_LIST_BUF_LEN          2048
 #define BNXT_DBG_CR_DUMP_MDM_CFG_DDR   \
        DBG_CRASHDUMP_MEDIUM_CFG_REQ_TYPE_DDR
 
+void bnxt_fill_coredump_seg_hdr(struct bnxt *bp,
+                               struct bnxt_coredump_segment_hdr *seg_hdr,
+                               struct coredump_segment_record *seg_rec,
+                               u32 seg_len, int status, u32 duration,
+                               u32 instance, u32 comp_id, u32 seg_id);
 int bnxt_get_coredump(struct bnxt *bp, u16 dump_type, void *buf, u32 *dump_len);
 int bnxt_hwrm_get_dump_len(struct bnxt *bp, u16 dump_type, u32 *dump_len);
 u32 bnxt_get_coredump_length(struct bnxt *bp, u16 dump_type);