Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * Copyright 2018-2020 Broadcom.
0004  */
0005 
0006 #ifndef __UAPI_LINUX_MISC_BCM_VK_H
0007 #define __UAPI_LINUX_MISC_BCM_VK_H
0008 
0009 #include <linux/ioctl.h>
0010 #include <linux/types.h>
0011 
0012 #define BCM_VK_MAX_FILENAME 64
0013 
0014 struct vk_image {
0015     __u32 type; /* Type of image */
0016 #define VK_IMAGE_TYPE_BOOT1 1 /* 1st stage (load to SRAM) */
0017 #define VK_IMAGE_TYPE_BOOT2 2 /* 2nd stage (load to DDR) */
0018     __u8 filename[BCM_VK_MAX_FILENAME]; /* Filename of image */
0019 };
0020 
0021 struct vk_reset {
0022     __u32 arg1;
0023     __u32 arg2;
0024 };
0025 
0026 #define VK_MAGIC        0x5e
0027 
0028 /* Load image to Valkyrie */
0029 #define VK_IOCTL_LOAD_IMAGE _IOW(VK_MAGIC, 0x2, struct vk_image)
0030 
0031 /* Send Reset to Valkyrie */
0032 #define VK_IOCTL_RESET      _IOW(VK_MAGIC, 0x4, struct vk_reset)
0033 
0034 /*
0035  * Firmware Status accessed directly via BAR space
0036  */
0037 #define VK_BAR_FWSTS            0x41c
0038 #define VK_BAR_COP_FWSTS        0x428
0039 /* VK_FWSTS definitions */
0040 #define VK_FWSTS_RELOCATION_ENTRY   (1UL << 0)
0041 #define VK_FWSTS_RELOCATION_EXIT    (1UL << 1)
0042 #define VK_FWSTS_INIT_START     (1UL << 2)
0043 #define VK_FWSTS_ARCH_INIT_DONE     (1UL << 3)
0044 #define VK_FWSTS_PRE_KNL1_INIT_DONE (1UL << 4)
0045 #define VK_FWSTS_PRE_KNL2_INIT_DONE (1UL << 5)
0046 #define VK_FWSTS_POST_KNL_INIT_DONE (1UL << 6)
0047 #define VK_FWSTS_INIT_DONE      (1UL << 7)
0048 #define VK_FWSTS_APP_INIT_START     (1UL << 8)
0049 #define VK_FWSTS_APP_INIT_DONE      (1UL << 9)
0050 #define VK_FWSTS_MASK           0xffffffff
0051 #define VK_FWSTS_READY          (VK_FWSTS_INIT_START | \
0052                      VK_FWSTS_ARCH_INIT_DONE | \
0053                      VK_FWSTS_PRE_KNL1_INIT_DONE | \
0054                      VK_FWSTS_PRE_KNL2_INIT_DONE | \
0055                      VK_FWSTS_POST_KNL_INIT_DONE | \
0056                      VK_FWSTS_INIT_DONE | \
0057                      VK_FWSTS_APP_INIT_START | \
0058                      VK_FWSTS_APP_INIT_DONE)
0059 /* Deinit */
0060 #define VK_FWSTS_APP_DEINIT_START   (1UL << 23)
0061 #define VK_FWSTS_APP_DEINIT_DONE    (1UL << 24)
0062 #define VK_FWSTS_DRV_DEINIT_START   (1UL << 25)
0063 #define VK_FWSTS_DRV_DEINIT_DONE    (1UL << 26)
0064 #define VK_FWSTS_RESET_DONE     (1UL << 27)
0065 #define VK_FWSTS_DEINIT_TRIGGERED   (VK_FWSTS_APP_DEINIT_START | \
0066                      VK_FWSTS_APP_DEINIT_DONE  | \
0067                      VK_FWSTS_DRV_DEINIT_START | \
0068                      VK_FWSTS_DRV_DEINIT_DONE)
0069 /* Last nibble for reboot reason */
0070 #define VK_FWSTS_RESET_REASON_SHIFT 28
0071 #define VK_FWSTS_RESET_REASON_MASK  (0xf << VK_FWSTS_RESET_REASON_SHIFT)
0072 #define VK_FWSTS_RESET_SYS_PWRUP    (0x0 << VK_FWSTS_RESET_REASON_SHIFT)
0073 #define VK_FWSTS_RESET_MBOX_DB      (0x1 << VK_FWSTS_RESET_REASON_SHIFT)
0074 #define VK_FWSTS_RESET_M7_WDOG      (0x2 << VK_FWSTS_RESET_REASON_SHIFT)
0075 #define VK_FWSTS_RESET_TEMP     (0x3 << VK_FWSTS_RESET_REASON_SHIFT)
0076 #define VK_FWSTS_RESET_PCI_FLR      (0x4 << VK_FWSTS_RESET_REASON_SHIFT)
0077 #define VK_FWSTS_RESET_PCI_HOT      (0x5 << VK_FWSTS_RESET_REASON_SHIFT)
0078 #define VK_FWSTS_RESET_PCI_WARM     (0x6 << VK_FWSTS_RESET_REASON_SHIFT)
0079 #define VK_FWSTS_RESET_PCI_COLD     (0x7 << VK_FWSTS_RESET_REASON_SHIFT)
0080 #define VK_FWSTS_RESET_L1       (0x8 << VK_FWSTS_RESET_REASON_SHIFT)
0081 #define VK_FWSTS_RESET_L0       (0x9 << VK_FWSTS_RESET_REASON_SHIFT)
0082 #define VK_FWSTS_RESET_UNKNOWN      (0xf << VK_FWSTS_RESET_REASON_SHIFT)
0083 
0084 #endif /* __UAPI_LINUX_MISC_BCM_VK_H */