// File: /workspace/github_c_makefile_star2_O2/intel[P]pf-bb-config/vrb2/vrb2_cfg_app.c
// Function: vrb2_device_data
void vrb2_device_data(void *dev)
{
	uint32_t vf_idx, num, min, max;
	uint64_t avg;
	hw_device *accel_dev = (hw_device *)dev;
	uint8_t *bar0addr = accel_dev->bar0Addr;

	LOG_RESP(INFO, "Device Status:: %d VFs", accel_dev->numvfs);
	for (vf_idx = 0; vf_idx < accel_dev->numvfs; vf_idx++)
		LOG_RESP(INFO, "-  VF %d %s", vf_idx,
			 bb_acc_device_status_str(accel_dev->dev_status[vf_idx]));
	LOG_RESP(INFO, "5GUL counters: Code Blocks");
	print_all_stat32(accel_dev, HWPfPermonACountVf, accel_dev->numvfs, VRB2_PMON_OFF_1);
	LOG_RESP(INFO, "5GUL counters: Data (Bytes)");
	print_all_stat32(accel_dev, HWPfPermonAKCntLoVf, accel_dev->numvfs, VRB2_PMON_OFF_1);
	LOG_RESP(INFO, "5GUL counters: Per Engine");
	print_all_stat32(accel_dev, HWPfPermonACbCountFec, VRB2_5GUL_ENGS, VRB2_PMON_OFF_2);
	LOG_RESP(INFO, "5GDL counters: Code Blocks");
	print_all_stat32(accel_dev, HWPfPermonBCountVf, accel_dev->numvfs, VRB2_PMON_OFF_1);
	LOG_RESP(INFO, "5GDL counters: Data (Bytes)");
	print_all_stat32(accel_dev, HWPfPermonBKCntLoVf, accel_dev->numvfs, VRB2_PMON_OFF_1);
	LOG_RESP(INFO, "5GDL counters: Per Engine");
	print_all_stat32(accel_dev, HWPfPermonBCbCountFec, VRB2_5GDL_ENGS, VRB2_PMON_OFF_2);
	LOG_RESP(INFO, "4GUL counters: Code Blocks");
	print_all_stat32(accel_dev, HWPfPermonCCountVf, accel_dev->numvfs, VRB2_PMON_OFF_1);
	LOG_RESP(INFO, "4GUL counters: Data (Bytes)");
	print_all_stat32(accel_dev, HWPfPermonCKCntLoVf, accel_dev->numvfs, VRB2_PMON_OFF_1);
	LOG_RESP(INFO, "4GUL counters: Per Engine");
	print_all_stat32(accel_dev, HWPfPermonCCbCountFec, VRB2_4GUL_ENGS, VRB2_PMON_OFF_2);
	LOG_RESP(INFO, "4GDL counters: Code Blocks");
	print_all_stat32(accel_dev, HWPfPermonDCountVf, accel_dev->numvfs, VRB2_PMON_OFF_1);
	LOG_RESP(INFO, "4GDL counters: Data (Bytes)");
	print_all_stat32(accel_dev, HWPfPermonDKCntLoVf, accel_dev->numvfs, VRB2_PMON_OFF_1);
	LOG_RESP(INFO, "4GDL counters: Per Engine");
	print_all_stat32(accel_dev, HWPfPermonDCbCountFec, VRB2_4GDL_ENGS, VRB2_PMON_OFF_2);
	LOG_RESP(INFO, "FFT counters: Code Blocks");
	print_all_stat32(accel_dev, HWPfPermonECountVf, accel_dev->numvfs, VRB2_PMON_OFF_1);
	LOG_RESP(INFO, "FFT counters: Data (Bytes)");
	print_all_stat32(accel_dev, HWPfPermonEKCntLoVf, accel_dev->numvfs, VRB2_PMON_OFF_1);
	LOG_RESP(INFO, "FFT counters: Per Engine");
	print_all_stat32(accel_dev, HWPfPermonECbCountFec, VRB2_FFT_ENGS, VRB2_PMON_OFF_2);
	LOG_RESP(INFO, "MLD counters: Code Blocks");
	print_all_stat32(accel_dev, HWPfPermonFCountVf, accel_dev->numvfs, VRB2_PMON_OFF_1);
	LOG_RESP(INFO, "MLD counters: Data (Bytes)");
	print_all_stat32(accel_dev, HWPfPermonFKCntLoVf, accel_dev->numvfs, VRB2_PMON_OFF_1);
	LOG_RESP(INFO, "MLD counters: Per Engine");
	print_all_stat32(accel_dev, HWPfPermonFCbCountFec, VRB2_MLD_ENGS, VRB2_PMON_OFF_2);
	/* Bus Monitor */
	vrb2_reg_write(bar0addr, HWPfPermonAControlBusMon, VRB2_BUSMON_STOP);
	min = vrb2_reg_read(bar0addr, HWPfPermonAMinLatBusMon);
	max = vrb2_reg_read(bar0addr, HWPfPermonAMaxLatBusMon);
	num = vrb2_reg_read(bar0addr, HWPfPermonATotalReqCntBusMon);
	if (num > 0) {
		avg = (vrb2_reg_read(bar0addr, HWPfPermonATotalLatLowBusMon) +
				vrb2_reg_read(bar0addr, HWPfPermonATotalLatUpperBusMon)
				* ((uint64_t)1 << 32)) / num;
		LOG_RESP(INFO, "Bus Monitor A (ns) Avg %u - Num %u - Min %d - Max %d",
				(uint32_t) avg, num, min, max);
	}
	vrb2_reg_write(bar0addr, HWPfPermonAControlBusMon, VRB2_BUSMON_RESET);
	vrb2_reg_write(bar0addr, HWPfPermonAControlBusMon, VRB2_BUSMON_START);
	vrb2_reg_write(bar0addr, HWPfPermonCControlBusMon, VRB2_BUSMON_STOP);
	min = vrb2_reg_read(bar0addr, HWPfPermonCMinLatBusMon);
	max = vrb2_reg_read(bar0addr, HWPfPermonCMaxLatBusMon);
	num = vrb2_reg_read(bar0addr, HWPfPermonCTotalReqCntBusMon);
	if (num > 0) {
		avg = (vrb2_reg_read(bar0addr, HWPfPermonCTotalLatLowBusMon) +
				vrb2_reg_read(bar0addr, HWPfPermonCTotalLatUpperBusMon)
				* ((uint64_t)1 << 32)) / num;
		LOG_RESP(INFO, "Bus Monitor C (ns) Avg %u - Num %u - Min %d - Max %d",
				(uint32_t) avg, num, min, max);
	}
	vrb2_reg_write(bar0addr, HWPfPermonCControlBusMon, VRB2_BUSMON_RESET);
	vrb2_reg_write(bar0addr, HWPfPermonCControlBusMon, VRB2_BUSMON_START);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0xb0(%rdi), %rax
movq %rax, (%rsp)
callq 0x16020
leaq 0x1f473(%rip), %rbx     # 0x34ed0
movq 0x10(%rbx), %r8
movl 0x4f8(%r14), %r9d
leaq 0x5cab(%rip), %rdx      # 0x1b71a
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
leaq 0x5cb2(%rip), %r15      # 0x1b738
xorl %r12d, %r12d
movq %r14, %rbp
movl 0x4f8(%r14), %r14d
callq 0x16020
movq %rax, %r13
movq 0x10(%rbx), %rbx
cmpq %r14, %r12
jae 0x15ae4
movq %rbp, %r14
movl 0xf0(%rbp,%r12,8), %edi
callq 0x196f4
movq %rax, %r10
subq $0x8, %rsp
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
movq %r15, %rdx
movq %r13, %rcx
movq %rbx, %r8
movl %r12d, %r9d
xorl %eax, %eax
pushq %r10
callq 0x19400
popq %rcx
popq %rdx
incq %r12
leaq 0x1f3ee(%rip), %rbx     # 0x34ed0
jmp 0x15a89
leaq 0x5c60(%rip), %rdx      # 0x1b74b
pushq $0x2
popq %r14
pushq $0x1
popq %r12
movl %r14d, %edi
movl %r12d, %esi
movq %r13, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x19400
movq %rbp, %rbx
movl 0x4f8(%rbp), %edx
movq %rbp, %rdi
movl $0xb98008, %esi         # imm = 0xB98008
movl $0x100, %ecx            # imm = 0x100
callq 0x1a116
callq 0x16020
leaq 0x1f3a3(%rip), %r15     # 0x34ed0
movq 0x10(%r15), %r8
leaq 0x5c35(%rip), %rdx      # 0x1b76d
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl 0x4f8(%rbp), %edx
movq %rbp, %rdi
movl $0xb98010, %esi         # imm = 0xB98010
movl $0x100, %ecx            # imm = 0x100
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x5c20(%rip), %rdx      # 0x1b790
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
pushq $0x6
popq %rdx
pushq $0x10
popq %r13
movq %rbp, %rdi
movl $0xb9c100, %esi         # imm = 0xB9C100
movl %r13d, %ecx
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x5c0a(%rip), %rdx      # 0x1b7b1
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl 0x4f8(%rbp), %edx
movq %rbp, %rdi
movl $0xba8008, %esi         # imm = 0xBA8008
movl $0x100, %ecx            # imm = 0x100
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x5bf4(%rip), %rdx      # 0x1b7d3
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl 0x4f8(%rbp), %edx
movq %rbp, %rdi
movl $0xba8010, %esi         # imm = 0xBA8010
movl $0x100, %ecx            # imm = 0x100
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x5bdf(%rip), %rdx      # 0x1b7f6
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
pushq $0x3
popq %rbp
movq %rbx, %rdi
movl $0xbac100, %esi         # imm = 0xBAC100
movl %ebp, %edx
movl %r13d, %ecx
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x73ed(%rip), %rdx      # 0x1d039
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl 0x4f8(%rbx), %edx
movq %rbx, %rdi
movl $0xbb8008, %esi         # imm = 0xBB8008
movl $0x100, %ecx            # imm = 0x100
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x73d7(%rip), %rdx      # 0x1d05b
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl 0x4f8(%rbx), %edx
movq %rbx, %rdi
movl $0xbb8010, %esi         # imm = 0xBB8010
movl $0x100, %ecx            # imm = 0x100
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x73c2(%rip), %rdx      # 0x1d07e
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
pushq $0x5
popq %rdx
movq %rbx, %rdi
movl $0xbbc100, %esi         # imm = 0xBBC100
movl %r13d, %ecx
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x73b0(%rip), %rdx      # 0x1d09f
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl 0x4f8(%rbx), %edx
movq %rbx, %rdi
movl $0xbc8008, %esi         # imm = 0xBC8008
movl $0x100, %ecx            # imm = 0x100
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x739a(%rip), %rdx      # 0x1d0c1
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl 0x4f8(%rbx), %edx
movq %rbx, %rdi
movl $0xbc8010, %esi         # imm = 0xBC8010
movl $0x100, %ecx            # imm = 0x100
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x7385(%rip), %rdx      # 0x1d0e4
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movq %rbx, %rdi
movl $0xbcc100, %esi         # imm = 0xBCC100
movl %ebp, %edx
movl %r13d, %ecx
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x657d(%rip), %rdx      # 0x1c30e
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl 0x4f8(%rbx), %edx
movq %rbx, %rdi
movl $0xbd8008, %esi         # imm = 0xBD8008
movl $0x100, %ecx            # imm = 0x100
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x6566(%rip), %rdx      # 0x1c32f
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl 0x4f8(%rbx), %edx
movq %rbx, %rdi
movl $0xbd8010, %esi         # imm = 0xBD8010
movl $0x100, %ecx            # imm = 0x100
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x6550(%rip), %rdx      # 0x1c351
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movq %rbx, %rdi
movl $0xbdc100, %esi         # imm = 0xBDC100
movl %ebp, %edx
movl %r13d, %ecx
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x72d2(%rip), %rdx      # 0x1d105
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl 0x4f8(%rbx), %edx
movq %rbx, %rdi
movl $0xbe8008, %esi         # imm = 0xBE8008
movl $0x100, %ecx            # imm = 0x100
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x72bb(%rip), %rdx      # 0x1d126
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl 0x4f8(%rbx), %edx
movq %rbx, %rdi
movl $0xbe8010, %esi         # imm = 0xBE8010
movl $0x100, %ecx            # imm = 0x100
callq 0x1a116
callq 0x16020
movq 0x10(%r15), %r8
leaq 0x72a5(%rip), %rdx      # 0x1d148
movl %r14d, %edi
movl %r12d, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movq %rbx, %rdi
movl $0xbec100, %esi         # imm = 0xBEC100
movl %r12d, %edx
movl %r13d, %ecx
callq 0x1a116
movq (%rsp), %r13
movl $0x0, 0xb9c400(%r13)
movl %r12d, %edi
callq 0xd460
movl 0xb9c40c(%r13), %r14d
movl 0xb9c500(%r13), %r12d
movl 0xb9c50c(%r13), %ebp
testq %rbp, %rbp
je 0x15f44
movl 0xb9c504(%r13), %ecx
movl 0xb9c508(%r13), %eax
shlq $0x20, %rax
orq %rcx, %rax
xorl %edx, %edx
divq %rbp
movq %rax, %rbx
callq 0x16020
movq 0x10(%r15), %r8
subq $0x8, %rsp
leaq 0x6449(%rip), %rdx      # 0x1c371
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
movq %rax, %rcx
movl %ebx, %r9d
xorl %eax, %eax
pushq %r12
pushq %r14
pushq %rbp
callq 0x19400
addq $0x20, %rsp
movl $0x1, 0xb9c400(%r13)
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0xd460
movl $0x2, 0xb9c400(%r13)
movl %ebx, %edi
callq 0xd460
movl $0x0, 0xbbc400(%r13)
movl %ebx, %edi
callq 0xd460
movl 0xbbc40c(%r13), %r15d
movl 0xbbc500(%r13), %r12d
movl 0xbbc50c(%r13), %ebp
testq %rbp, %rbp
je 0x15feb
movl 0xbbc504(%r13), %ecx
movl 0xbbc508(%r13), %eax
shlq $0x20, %rax
orq %rcx, %rax
xorl %edx, %edx
divq %rbp
movq %rax, %rbx
callq 0x16020
leaq 0x1ef10(%rip), %rcx     # 0x34ed0
movq 0x10(%rcx), %r8
subq $0x8, %rsp
leaq 0x63de(%rip), %rdx      # 0x1c3ad
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
movq %rax, %rcx
movl %ebx, %r9d
xorl %eax, %eax
pushq %r12
pushq %r15
pushq %rbp
callq 0x19400
addq $0x20, %rsp
movl $0x1, 0xbbc400(%r13)
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0xd460
movl $0x2, 0xbbc400(%r13)
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd460