History

PCI/switchtec: Separate Gen3 register structures into unions

Since the sys_info and flash_info registers differ significantly in Gen4 hardware, separate out the Gen3 registers into their own structure with a union in the main structure. No functional changes intended.

Logan Gunthorpe committed 6 years ago

Commit 993d2081 parent 6a3d1b52 files · +54 −25Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/switchtec.h+27−14
@@ -108,10 +108,7 @@ enum { · 107 unmodified lines
108108 SWITCHTEC_GEN3_IMG1_RUNNING = 0x07,
109109 };
110110
111−struct sys_info_regs {
112− u32 device_id;
113− u32 device_version;
114− u32 firmware_version;
111+struct sys_info_regs_gen3 {
115112 u32 reserved1;
116113 u32 vendor_table_revision;
117114 u32 table_format_version;
@@ -128,26 +125,36 @@ struct sys_info_regs { · 10 unmodified lines
128125 u8 component_revision;
129126 } __packed;
130127
131−struct flash_info_regs {
128+struct sys_info_regs {
129+ u32 device_id;
130+ u32 device_version;
131+ u32 firmware_version;
132+ union {
133+ struct sys_info_regs_gen3 gen3;
134+ };
135+} __packed;
136+
137+struct partition_info {
138+ u32 address;
139+ u32 length;
140+};
141+
142+struct flash_info_regs_gen3 {
132143 u32 flash_part_map_upd_idx;
133144
134− struct active_partition_info {
145+ struct active_partition_info_gen3 {
135146 u32 address;
136147 u32 build_version;
137148 u32 build_string;
138149 } active_img;
139150
140− struct active_partition_info active_cfg;
141− struct active_partition_info inactive_img;
142− struct active_partition_info inactive_cfg;
151+ struct active_partition_info_gen3 active_cfg;
152+ struct active_partition_info_gen3 inactive_img;
153+ struct active_partition_info_gen3 inactive_cfg;
143154
144155 u32 flash_length;
145156
146− struct partition_info {
147− u32 address;
148− u32 length;
149− } cfg0;
150−
157+ struct partition_info cfg0;
151158 struct partition_info cfg1;
152159 struct partition_info img0;
153160 struct partition_info img1;
@@ -155,6 +162,12 @@ struct flash_info_regs { · 1 unmodified line
155162 struct partition_info vendor[8];
156163 };
157164
165+struct flash_info_regs {
166+ union {
167+ struct flash_info_regs_gen3 gen3;
168+ };
169+};
170+
158171 enum {
159172 SWITCHTEC_NTB_REG_INFO_OFFSET = 0x0000,
160173 SWITCHTEC_NTB_REG_CTRL_OFFSET = 0x4000,