xref: /openbmc/linux/include/uapi/linux/misc/bcm_vk.h (revision 88222762)
1*88222762SScott Branden /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2*88222762SScott Branden /*
3*88222762SScott Branden  * Copyright 2018-2020 Broadcom.
4*88222762SScott Branden  */
5*88222762SScott Branden 
6*88222762SScott Branden #ifndef __UAPI_LINUX_MISC_BCM_VK_H
7*88222762SScott Branden #define __UAPI_LINUX_MISC_BCM_VK_H
8*88222762SScott Branden 
9*88222762SScott Branden #include <linux/ioctl.h>
10*88222762SScott Branden #include <linux/types.h>
11*88222762SScott Branden 
12*88222762SScott Branden #define BCM_VK_MAX_FILENAME 64
13*88222762SScott Branden 
14*88222762SScott Branden struct vk_image {
15*88222762SScott Branden 	__u32 type; /* Type of image */
16*88222762SScott Branden #define VK_IMAGE_TYPE_BOOT1 1 /* 1st stage (load to SRAM) */
17*88222762SScott Branden #define VK_IMAGE_TYPE_BOOT2 2 /* 2nd stage (load to DDR) */
18*88222762SScott Branden 	__u8 filename[BCM_VK_MAX_FILENAME]; /* Filename of image */
19*88222762SScott Branden };
20*88222762SScott Branden 
21*88222762SScott Branden struct vk_reset {
22*88222762SScott Branden 	__u32 arg1;
23*88222762SScott Branden 	__u32 arg2;
24*88222762SScott Branden };
25*88222762SScott Branden 
26*88222762SScott Branden #define VK_MAGIC		0x5e
27*88222762SScott Branden 
28*88222762SScott Branden /* Load image to Valkyrie */
29*88222762SScott Branden #define VK_IOCTL_LOAD_IMAGE	_IOW(VK_MAGIC, 0x2, struct vk_image)
30*88222762SScott Branden 
31*88222762SScott Branden /* Send Reset to Valkyrie */
32*88222762SScott Branden #define VK_IOCTL_RESET		_IOW(VK_MAGIC, 0x4, struct vk_reset)
33*88222762SScott Branden 
34*88222762SScott Branden /*
35*88222762SScott Branden  * Firmware Status accessed directly via BAR space
36*88222762SScott Branden  */
37*88222762SScott Branden #define VK_BAR_FWSTS			0x41c
38*88222762SScott Branden #define VK_BAR_COP_FWSTS		0x428
39*88222762SScott Branden /* VK_FWSTS definitions */
40*88222762SScott Branden #define VK_FWSTS_RELOCATION_ENTRY	(1UL << 0)
41*88222762SScott Branden #define VK_FWSTS_RELOCATION_EXIT	(1UL << 1)
42*88222762SScott Branden #define VK_FWSTS_INIT_START		(1UL << 2)
43*88222762SScott Branden #define VK_FWSTS_ARCH_INIT_DONE		(1UL << 3)
44*88222762SScott Branden #define VK_FWSTS_PRE_KNL1_INIT_DONE	(1UL << 4)
45*88222762SScott Branden #define VK_FWSTS_PRE_KNL2_INIT_DONE	(1UL << 5)
46*88222762SScott Branden #define VK_FWSTS_POST_KNL_INIT_DONE	(1UL << 6)
47*88222762SScott Branden #define VK_FWSTS_INIT_DONE		(1UL << 7)
48*88222762SScott Branden #define VK_FWSTS_APP_INIT_START		(1UL << 8)
49*88222762SScott Branden #define VK_FWSTS_APP_INIT_DONE		(1UL << 9)
50*88222762SScott Branden #define VK_FWSTS_MASK			0xffffffff
51*88222762SScott Branden #define VK_FWSTS_READY			(VK_FWSTS_INIT_START | \
52*88222762SScott Branden 					 VK_FWSTS_ARCH_INIT_DONE | \
53*88222762SScott Branden 					 VK_FWSTS_PRE_KNL1_INIT_DONE | \
54*88222762SScott Branden 					 VK_FWSTS_PRE_KNL2_INIT_DONE | \
55*88222762SScott Branden 					 VK_FWSTS_POST_KNL_INIT_DONE | \
56*88222762SScott Branden 					 VK_FWSTS_INIT_DONE | \
57*88222762SScott Branden 					 VK_FWSTS_APP_INIT_START | \
58*88222762SScott Branden 					 VK_FWSTS_APP_INIT_DONE)
59*88222762SScott Branden /* Deinit */
60*88222762SScott Branden #define VK_FWSTS_APP_DEINIT_START	(1UL << 23)
61*88222762SScott Branden #define VK_FWSTS_APP_DEINIT_DONE	(1UL << 24)
62*88222762SScott Branden #define VK_FWSTS_DRV_DEINIT_START	(1UL << 25)
63*88222762SScott Branden #define VK_FWSTS_DRV_DEINIT_DONE	(1UL << 26)
64*88222762SScott Branden #define VK_FWSTS_RESET_DONE		(1UL << 27)
65*88222762SScott Branden #define VK_FWSTS_DEINIT_TRIGGERED	(VK_FWSTS_APP_DEINIT_START | \
66*88222762SScott Branden 					 VK_FWSTS_APP_DEINIT_DONE  | \
67*88222762SScott Branden 					 VK_FWSTS_DRV_DEINIT_START | \
68*88222762SScott Branden 					 VK_FWSTS_DRV_DEINIT_DONE)
69*88222762SScott Branden /* Last nibble for reboot reason */
70*88222762SScott Branden #define VK_FWSTS_RESET_REASON_SHIFT	28
71*88222762SScott Branden #define VK_FWSTS_RESET_REASON_MASK	(0xf << VK_FWSTS_RESET_REASON_SHIFT)
72*88222762SScott Branden #define VK_FWSTS_RESET_SYS_PWRUP	(0x0 << VK_FWSTS_RESET_REASON_SHIFT)
73*88222762SScott Branden #define VK_FWSTS_RESET_MBOX_DB		(0x1 << VK_FWSTS_RESET_REASON_SHIFT)
74*88222762SScott Branden #define VK_FWSTS_RESET_M7_WDOG		(0x2 << VK_FWSTS_RESET_REASON_SHIFT)
75*88222762SScott Branden #define VK_FWSTS_RESET_TEMP		(0x3 << VK_FWSTS_RESET_REASON_SHIFT)
76*88222762SScott Branden #define VK_FWSTS_RESET_PCI_FLR		(0x4 << VK_FWSTS_RESET_REASON_SHIFT)
77*88222762SScott Branden #define VK_FWSTS_RESET_PCI_HOT		(0x5 << VK_FWSTS_RESET_REASON_SHIFT)
78*88222762SScott Branden #define VK_FWSTS_RESET_PCI_WARM		(0x6 << VK_FWSTS_RESET_REASON_SHIFT)
79*88222762SScott Branden #define VK_FWSTS_RESET_PCI_COLD		(0x7 << VK_FWSTS_RESET_REASON_SHIFT)
80*88222762SScott Branden #define VK_FWSTS_RESET_L1		(0x8 << VK_FWSTS_RESET_REASON_SHIFT)
81*88222762SScott Branden #define VK_FWSTS_RESET_L0		(0x9 << VK_FWSTS_RESET_REASON_SHIFT)
82*88222762SScott Branden #define VK_FWSTS_RESET_UNKNOWN		(0xf << VK_FWSTS_RESET_REASON_SHIFT)
83*88222762SScott Branden 
84*88222762SScott Branden #endif /* __UAPI_LINUX_MISC_BCM_VK_H */
85