Skip to content

Commit f9386c9

Browse files
Russ WeightLee Jones
authored andcommitted
mfd: intel-m10-bmc: Add support for MAX10 BMC Secure Updates
Add macros and definitions required by the MAX10 BMC Secure Update driver. Signed-off-by: Russ Weight <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent 2397c3e commit f9386c9

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

include/linux/mfd/intel-m10-bmc.h

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
#define M10BMC_FLASH_END 0x1fffffff
1717
#define M10BMC_MEM_END M10BMC_FLASH_END
1818

19+
#define M10BMC_STAGING_BASE 0x18000000
20+
#define M10BMC_STAGING_SIZE 0x3800000
21+
1922
/* Register offset of system registers */
2023
#define NIOS2_FW_VERSION 0x0
2124
#define M10BMC_MAC_LOW 0x10
@@ -33,6 +36,88 @@
3336
#define M10BMC_VER_PCB_INFO_MSK GENMASK(31, 24)
3437
#define M10BMC_VER_LEGACY_INVALID 0xffffffff
3538

39+
/* Secure update doorbell register, in system register region */
40+
#define M10BMC_DOORBELL 0x400
41+
42+
/* Authorization Result register, in system register region */
43+
#define M10BMC_AUTH_RESULT 0x404
44+
45+
/* Doorbell register fields */
46+
#define DRBL_RSU_REQUEST BIT(0)
47+
#define DRBL_RSU_PROGRESS GENMASK(7, 4)
48+
#define DRBL_HOST_STATUS GENMASK(11, 8)
49+
#define DRBL_RSU_STATUS GENMASK(23, 16)
50+
#define DRBL_PKVL_EEPROM_LOAD_SEC BIT(24)
51+
#define DRBL_PKVL1_POLL_EN BIT(25)
52+
#define DRBL_PKVL2_POLL_EN BIT(26)
53+
#define DRBL_CONFIG_SEL BIT(28)
54+
#define DRBL_REBOOT_REQ BIT(29)
55+
#define DRBL_REBOOT_DISABLED BIT(30)
56+
57+
/* Progress states */
58+
#define RSU_PROG_IDLE 0x0
59+
#define RSU_PROG_PREPARE 0x1
60+
#define RSU_PROG_READY 0x3
61+
#define RSU_PROG_AUTHENTICATING 0x4
62+
#define RSU_PROG_COPYING 0x5
63+
#define RSU_PROG_UPDATE_CANCEL 0x6
64+
#define RSU_PROG_PROGRAM_KEY_HASH 0x7
65+
#define RSU_PROG_RSU_DONE 0x8
66+
#define RSU_PROG_PKVL_PROM_DONE 0x9
67+
68+
/* Device and error states */
69+
#define RSU_STAT_NORMAL 0x0
70+
#define RSU_STAT_TIMEOUT 0x1
71+
#define RSU_STAT_AUTH_FAIL 0x2
72+
#define RSU_STAT_COPY_FAIL 0x3
73+
#define RSU_STAT_FATAL 0x4
74+
#define RSU_STAT_PKVL_REJECT 0x5
75+
#define RSU_STAT_NON_INC 0x6
76+
#define RSU_STAT_ERASE_FAIL 0x7
77+
#define RSU_STAT_WEAROUT 0x8
78+
#define RSU_STAT_NIOS_OK 0x80
79+
#define RSU_STAT_USER_OK 0x81
80+
#define RSU_STAT_FACTORY_OK 0x82
81+
#define RSU_STAT_USER_FAIL 0x83
82+
#define RSU_STAT_FACTORY_FAIL 0x84
83+
#define RSU_STAT_NIOS_FLASH_ERR 0x85
84+
#define RSU_STAT_FPGA_FLASH_ERR 0x86
85+
86+
#define HOST_STATUS_IDLE 0x0
87+
#define HOST_STATUS_WRITE_DONE 0x1
88+
#define HOST_STATUS_ABORT_RSU 0x2
89+
90+
#define rsu_prog(doorbell) FIELD_GET(DRBL_RSU_PROGRESS, doorbell)
91+
#define rsu_stat(doorbell) FIELD_GET(DRBL_RSU_STATUS, doorbell)
92+
93+
/* interval 100ms and timeout 5s */
94+
#define NIOS_HANDSHAKE_INTERVAL_US (100 * 1000)
95+
#define NIOS_HANDSHAKE_TIMEOUT_US (5 * 1000 * 1000)
96+
97+
/* RSU PREP Timeout (2 minutes) to erase flash staging area */
98+
#define RSU_PREP_INTERVAL_MS 100
99+
#define RSU_PREP_TIMEOUT_MS (2 * 60 * 1000)
100+
101+
/* RSU Complete Timeout (40 minutes) for full flash update */
102+
#define RSU_COMPLETE_INTERVAL_MS 1000
103+
#define RSU_COMPLETE_TIMEOUT_MS (40 * 60 * 1000)
104+
105+
/* Addresses for security related data in FLASH */
106+
#define BMC_REH_ADDR 0x17ffc004
107+
#define BMC_PROG_ADDR 0x17ffc000
108+
#define BMC_PROG_MAGIC 0x5746
109+
110+
#define SR_REH_ADDR 0x17ffd004
111+
#define SR_PROG_ADDR 0x17ffd000
112+
#define SR_PROG_MAGIC 0x5253
113+
114+
#define PR_REH_ADDR 0x17ffe004
115+
#define PR_PROG_ADDR 0x17ffe000
116+
#define PR_PROG_MAGIC 0x5250
117+
118+
/* Address of 4KB inverted bit vector containing staging area FLASH count */
119+
#define STAGING_FLASH_COUNT 0x17ffb000
120+
36121
/**
37122
* struct intel_m10bmc - Intel MAX 10 BMC parent driver data structure
38123
* @dev: this device

0 commit comments

Comments
 (0)