Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
0002 /*
0003  * Greybus Firmware Management User Header
0004  *
0005  * Copyright(c) 2016 Google Inc. All rights reserved.
0006  * Copyright(c) 2016 Linaro Ltd. All rights reserved.
0007  */
0008 
0009 #ifndef __GREYBUS_FIRMWARE_USER_H
0010 #define __GREYBUS_FIRMWARE_USER_H
0011 
0012 #include <linux/ioctl.h>
0013 #include <linux/types.h>
0014 
0015 #define GB_FIRMWARE_U_TAG_MAX_SIZE      10
0016 
0017 #define GB_FW_U_LOAD_METHOD_UNIPRO      0x01
0018 #define GB_FW_U_LOAD_METHOD_INTERNAL        0x02
0019 
0020 #define GB_FW_U_LOAD_STATUS_FAILED      0x00
0021 #define GB_FW_U_LOAD_STATUS_UNVALIDATED     0x01
0022 #define GB_FW_U_LOAD_STATUS_VALIDATED       0x02
0023 #define GB_FW_U_LOAD_STATUS_VALIDATION_FAILED   0x03
0024 
0025 #define GB_FW_U_BACKEND_FW_STATUS_SUCCESS   0x01
0026 #define GB_FW_U_BACKEND_FW_STATUS_FAIL_FIND 0x02
0027 #define GB_FW_U_BACKEND_FW_STATUS_FAIL_FETCH    0x03
0028 #define GB_FW_U_BACKEND_FW_STATUS_FAIL_WRITE    0x04
0029 #define GB_FW_U_BACKEND_FW_STATUS_INT       0x05
0030 #define GB_FW_U_BACKEND_FW_STATUS_RETRY     0x06
0031 #define GB_FW_U_BACKEND_FW_STATUS_NOT_SUPPORTED 0x07
0032 
0033 #define GB_FW_U_BACKEND_VERSION_STATUS_SUCCESS      0x01
0034 #define GB_FW_U_BACKEND_VERSION_STATUS_NOT_AVAILABLE    0x02
0035 #define GB_FW_U_BACKEND_VERSION_STATUS_NOT_SUPPORTED    0x03
0036 #define GB_FW_U_BACKEND_VERSION_STATUS_RETRY        0x04
0037 #define GB_FW_U_BACKEND_VERSION_STATUS_FAIL_INT     0x05
0038 
0039 /* IOCTL support */
0040 struct fw_mgmt_ioc_get_intf_version {
0041     __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE];
0042     __u16 major;
0043     __u16 minor;
0044 } __attribute__ ((__packed__));
0045 
0046 struct fw_mgmt_ioc_get_backend_version {
0047     __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE];
0048     __u16 major;
0049     __u16 minor;
0050     __u8 status;
0051 } __attribute__ ((__packed__));
0052 
0053 struct fw_mgmt_ioc_intf_load_and_validate {
0054     __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE];
0055     __u8 load_method;
0056     __u8 status;
0057     __u16 major;
0058     __u16 minor;
0059 } __attribute__ ((__packed__));
0060 
0061 struct fw_mgmt_ioc_backend_fw_update {
0062     __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE];
0063     __u8 status;
0064 } __attribute__ ((__packed__));
0065 
0066 #define FW_MGMT_IOCTL_BASE          'F'
0067 #define FW_MGMT_IOC_GET_INTF_FW         _IOR(FW_MGMT_IOCTL_BASE, 0, struct fw_mgmt_ioc_get_intf_version)
0068 #define FW_MGMT_IOC_GET_BACKEND_FW      _IOWR(FW_MGMT_IOCTL_BASE, 1, struct fw_mgmt_ioc_get_backend_version)
0069 #define FW_MGMT_IOC_INTF_LOAD_AND_VALIDATE  _IOWR(FW_MGMT_IOCTL_BASE, 2, struct fw_mgmt_ioc_intf_load_and_validate)
0070 #define FW_MGMT_IOC_INTF_BACKEND_FW_UPDATE  _IOWR(FW_MGMT_IOCTL_BASE, 3, struct fw_mgmt_ioc_backend_fw_update)
0071 #define FW_MGMT_IOC_SET_TIMEOUT_MS      _IOW(FW_MGMT_IOCTL_BASE, 4, unsigned int)
0072 #define FW_MGMT_IOC_MODE_SWITCH         _IO(FW_MGMT_IOCTL_BASE, 5)
0073 
0074 #endif /* __GREYBUS_FIRMWARE_USER_H */
0075