History

efi: Fix build error due to enum collision between efi.h and ima.h

The following commit: a893ea15d764 ("tpm: move tpm_chip definition to include/linux/tpm.h") introduced a build error when both IMA and EFI are enabled: In file included from ../security/integrity/ima/ima_fs.c:30: ../security/integrity/ima/ima.h:176:7: error: redeclaration of enumerator "NONE" What happens is that both headers (ima.h and efi.h) defines the same 'NONE' constant, and it broke when they started getting included from the same file: Rework to prefix the EFI enum with 'EFI_*'.

Anders Roxell committed 7 years ago

Commit 5c418dc1 parent 69c1f393 files · +39 −39Browse files

Unified · Split

3 files
  1. arch/x86/platform/efi/quirks.c +2 −2
  2. drivers/firmware/efi/runtime-wrappers.c +24 −24
  3. include/linux/efi.h +13 −13
arch/x86/platform/efi/quirks.c+2−2
@@ -717,7 +717,7 @@ void efi_recover_from_page_fault(unsigned long phys_addr) · 716 unmodified lines
717 * "efi_mm" cannot be used to check if the page fault had occurred717 * "efi_mm" cannot be used to check if the page fault had occurred
718 * in the firmware context because efi=old_map doesn't use efi_pgd.718 * in the firmware context because efi=old_map doesn't use efi_pgd.
719 */719 */
720 if (efi_rts_work.efi_rts_id == NONE)720 if (efi_rts_work.efi_rts_id == EFI_NONE)
721 return;721 return;
722 722
723 /*723 /*
@@ -742,7 +742,7 @@ void efi_recover_from_page_fault(unsigned long phys_addr) · 18 unmodified lines
742 * because this case occurs *very* rarely and hence could be improved742 * because this case occurs *very* rarely and hence could be improved
743 * on a need by basis.743 * on a need by basis.
744 */744 */
745 if (efi_rts_work.efi_rts_id == RESET_SYSTEM) {745 if (efi_rts_work.efi_rts_id == EFI_RESET_SYSTEM) {
746 pr_info("efi_reset_system() buggy! Reboot through BIOS\n");746 pr_info("efi_reset_system() buggy! Reboot through BIOS\n");
747 machine_real_restart(MRR_BIOS);747 machine_real_restart(MRR_BIOS);
748 return;748 return;
drivers/firmware/efi/runtime-wrappers.c+24−24
@@ -85,7 +85,7 @@ struct efi_runtime_work efi_rts_work; · 84 unmodified lines
85 pr_err("Failed to queue work to efi_rts_wq.\n"); \85 pr_err("Failed to queue work to efi_rts_wq.\n"); \
86 \86 \
87exit: \87exit: \
88 efi_rts_work.efi_rts_id = NONE; \88 efi_rts_work.efi_rts_id = EFI_NONE; \
89 efi_rts_work.status; \89 efi_rts_work.status; \
90})90})
91 91
@@ -168,50 +168,50 @@ static void efi_call_rts(struct work_struct *work) · 76 unmodified lines
168 arg5 = efi_rts_work.arg5;168 arg5 = efi_rts_work.arg5;
169 169
170 switch (efi_rts_work.efi_rts_id) {170 switch (efi_rts_work.efi_rts_id) {
171 case GET_TIME:171 case EFI_GET_TIME:
172 status = efi_call_virt(get_time, (efi_time_t *)arg1,172 status = efi_call_virt(get_time, (efi_time_t *)arg1,
173 (efi_time_cap_t *)arg2);173 (efi_time_cap_t *)arg2);
174 break;174 break;
175 case SET_TIME:175 case EFI_SET_TIME:
176 status = efi_call_virt(set_time, (efi_time_t *)arg1);176 status = efi_call_virt(set_time, (efi_time_t *)arg1);
177 break;177 break;
178 case GET_WAKEUP_TIME:178 case EFI_GET_WAKEUP_TIME:
179 status = efi_call_virt(get_wakeup_time, (efi_bool_t *)arg1,179 status = efi_call_virt(get_wakeup_time, (efi_bool_t *)arg1,
180 (efi_bool_t *)arg2, (efi_time_t *)arg3);180 (efi_bool_t *)arg2, (efi_time_t *)arg3);
181 break;181 break;
182 case SET_WAKEUP_TIME:182 case EFI_SET_WAKEUP_TIME:
183 status = efi_call_virt(set_wakeup_time, *(efi_bool_t *)arg1,183 status = efi_call_virt(set_wakeup_time, *(efi_bool_t *)arg1,
184 (efi_time_t *)arg2);184 (efi_time_t *)arg2);
185 break;185 break;
186 case GET_VARIABLE:186 case EFI_GET_VARIABLE:
187 status = efi_call_virt(get_variable, (efi_char16_t *)arg1,187 status = efi_call_virt(get_variable, (efi_char16_t *)arg1,
188 (efi_guid_t *)arg2, (u32 *)arg3,188 (efi_guid_t *)arg2, (u32 *)arg3,
189 (unsigned long *)arg4, (void *)arg5);189 (unsigned long *)arg4, (void *)arg5);
190 break;190 break;
191 case GET_NEXT_VARIABLE:191 case EFI_GET_NEXT_VARIABLE:
192 status = efi_call_virt(get_next_variable, (unsigned long *)arg1,192 status = efi_call_virt(get_next_variable, (unsigned long *)arg1,
193 (efi_char16_t *)arg2,193 (efi_char16_t *)arg2,
194 (efi_guid_t *)arg3);194 (efi_guid_t *)arg3);
195 break;195 break;
196 case SET_VARIABLE:196 case EFI_SET_VARIABLE:
197 status = efi_call_virt(set_variable, (efi_char16_t *)arg1,197 status = efi_call_virt(set_variable, (efi_char16_t *)arg1,
198 (efi_guid_t *)arg2, *(u32 *)arg3,198 (efi_guid_t *)arg2, *(u32 *)arg3,
199 *(unsigned long *)arg4, (void *)arg5);199 *(unsigned long *)arg4, (void *)arg5);
200 break;200 break;
201 case QUERY_VARIABLE_INFO:201 case EFI_QUERY_VARIABLE_INFO:
202 status = efi_call_virt(query_variable_info, *(u32 *)arg1,202 status = efi_call_virt(query_variable_info, *(u32 *)arg1,
203 (u64 *)arg2, (u64 *)arg3, (u64 *)arg4);203 (u64 *)arg2, (u64 *)arg3, (u64 *)arg4);
204 break;204 break;
205 case GET_NEXT_HIGH_MONO_COUNT:205 case EFI_GET_NEXT_HIGH_MONO_COUNT:
206 status = efi_call_virt(get_next_high_mono_count, (u32 *)arg1);206 status = efi_call_virt(get_next_high_mono_count, (u32 *)arg1);
207 break;207 break;
208 case UPDATE_CAPSULE:208 case EFI_UPDATE_CAPSULE:
209 status = efi_call_virt(update_capsule,209 status = efi_call_virt(update_capsule,
210 (efi_capsule_header_t **)arg1,210 (efi_capsule_header_t **)arg1,
211 *(unsigned long *)arg2,211 *(unsigned long *)arg2,
212 *(unsigned long *)arg3);212 *(unsigned long *)arg3);
213 break;213 break;
214 case QUERY_CAPSULE_CAPS:214 case EFI_QUERY_CAPSULE_CAPS:
215 status = efi_call_virt(query_capsule_caps,215 status = efi_call_virt(query_capsule_caps,
216 (efi_capsule_header_t **)arg1,216 (efi_capsule_header_t **)arg1,
217 *(unsigned long *)arg2, (u64 *)arg3,217 *(unsigned long *)arg2, (u64 *)arg3,
@@ -235,7 +235,7 @@ static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) · 17 unmodified lines
235 235
236 if (down_interruptible(&efi_runtime_lock))236 if (down_interruptible(&efi_runtime_lock))
237 return EFI_ABORTED;237 return EFI_ABORTED;
238 status = efi_queue_work(GET_TIME, tm, tc, NULL, NULL, NULL);238 status = efi_queue_work(EFI_GET_TIME, tm, tc, NULL, NULL, NULL);
239 up(&efi_runtime_lock);239 up(&efi_runtime_lock);
240 return status;240 return status;
241}241}
@@ -246,7 +246,7 @@ static efi_status_t virt_efi_set_time(efi_time_t *tm) · 4 unmodified lines
246 246
247 if (down_interruptible(&efi_runtime_lock))247 if (down_interruptible(&efi_runtime_lock))
248 return EFI_ABORTED;248 return EFI_ABORTED;
249 status = efi_queue_work(SET_TIME, tm, NULL, NULL, NULL, NULL);249 status = efi_queue_work(EFI_SET_TIME, tm, NULL, NULL, NULL, NULL);
250 up(&efi_runtime_lock);250 up(&efi_runtime_lock);
251 return status;251 return status;
252}252}
@@ -259,7 +259,7 @@ static efi_status_t virt_efi_get_wakeup_time(efi_bool_t *enabled, · 6 unmodified lines
259 259
260 if (down_interruptible(&efi_runtime_lock))260 if (down_interruptible(&efi_runtime_lock))
261 return EFI_ABORTED;261 return EFI_ABORTED;
262 status = efi_queue_work(GET_WAKEUP_TIME, enabled, pending, tm, NULL,262 status = efi_queue_work(EFI_GET_WAKEUP_TIME, enabled, pending, tm, NULL,
263 NULL);263 NULL);
264 up(&efi_runtime_lock);264 up(&efi_runtime_lock);
265 return status;265 return status;
@@ -271,7 +271,7 @@ static efi_status_t virt_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) · 5 unmodified lines
271 271
272 if (down_interruptible(&efi_runtime_lock))272 if (down_interruptible(&efi_runtime_lock))
273 return EFI_ABORTED;273 return EFI_ABORTED;
274 status = efi_queue_work(SET_WAKEUP_TIME, &enabled, tm, NULL, NULL,274 status = efi_queue_work(EFI_SET_WAKEUP_TIME, &enabled, tm, NULL, NULL,
275 NULL);275 NULL);
276 up(&efi_runtime_lock);276 up(&efi_runtime_lock);
277 return status;277 return status;
@@ -287,7 +287,7 @@ static efi_status_t virt_efi_get_variable(efi_char16_t *name, · 9 unmodified lines
287 287
288 if (down_interruptible(&efi_runtime_lock))288 if (down_interruptible(&efi_runtime_lock))
289 return EFI_ABORTED;289 return EFI_ABORTED;
290 status = efi_queue_work(GET_VARIABLE, name, vendor, attr, data_size,290 status = efi_queue_work(EFI_GET_VARIABLE, name, vendor, attr, data_size,
291 data);291 data);
292 up(&efi_runtime_lock);292 up(&efi_runtime_lock);
293 return status;293 return status;
@@ -301,7 +301,7 @@ static efi_status_t virt_efi_get_next_variable(unsigned long *name_size, · 7 unmodified lines
301 301
302 if (down_interruptible(&efi_runtime_lock))302 if (down_interruptible(&efi_runtime_lock))
303 return EFI_ABORTED;303 return EFI_ABORTED;
304 status = efi_queue_work(GET_NEXT_VARIABLE, name_size, name, vendor,304 status = efi_queue_work(EFI_GET_NEXT_VARIABLE, name_size, name, vendor,
305 NULL, NULL);305 NULL, NULL);
306 up(&efi_runtime_lock);306 up(&efi_runtime_lock);
307 return status;307 return status;
@@ -317,7 +317,7 @@ static efi_status_t virt_efi_set_variable(efi_char16_t *name, · 9 unmodified lines
317 317
318 if (down_interruptible(&efi_runtime_lock))318 if (down_interruptible(&efi_runtime_lock))
319 return EFI_ABORTED;319 return EFI_ABORTED;
320 status = efi_queue_work(SET_VARIABLE, name, vendor, &attr, &data_size,320 status = efi_queue_work(EFI_SET_VARIABLE, name, vendor, &attr, &data_size,
321 data);321 data);
322 up(&efi_runtime_lock);322 up(&efi_runtime_lock);
323 return status;323 return status;
@@ -352,7 +352,7 @@ static efi_status_t virt_efi_query_variable_info(u32 attr, · 28 unmodified lines
352 352
353 if (down_interruptible(&efi_runtime_lock))353 if (down_interruptible(&efi_runtime_lock))
354 return EFI_ABORTED;354 return EFI_ABORTED;
355 status = efi_queue_work(QUERY_VARIABLE_INFO, &attr, storage_space,355 status = efi_queue_work(EFI_QUERY_VARIABLE_INFO, &attr, storage_space,
356 remaining_space, max_variable_size, NULL);356 remaining_space, max_variable_size, NULL);
357 up(&efi_runtime_lock);357 up(&efi_runtime_lock);
358 return status;358 return status;
@@ -384,7 +384,7 @@ static efi_status_t virt_efi_get_next_high_mono_count(u32 *count) · 25 unmodified lines
384 384
385 if (down_interruptible(&efi_runtime_lock))385 if (down_interruptible(&efi_runtime_lock))
386 return EFI_ABORTED;386 return EFI_ABORTED;
387 status = efi_queue_work(GET_NEXT_HIGH_MONO_COUNT, count, NULL, NULL,387 status = efi_queue_work(EFI_GET_NEXT_HIGH_MONO_COUNT, count, NULL, NULL,
388 NULL, NULL);388 NULL, NULL);
389 up(&efi_runtime_lock);389 up(&efi_runtime_lock);
390 return status;390 return status;
@@ -400,7 +400,7 @@ static void virt_efi_reset_system(int reset_type, · 9 unmodified lines
400 "could not get exclusive access to the firmware\n");400 "could not get exclusive access to the firmware\n");
401 return;401 return;
402 }402 }
403 efi_rts_work.efi_rts_id = RESET_SYSTEM;403 efi_rts_work.efi_rts_id = EFI_RESET_SYSTEM;
404 __efi_call_virt(reset_system, reset_type, status, data_size, data);404 __efi_call_virt(reset_system, reset_type, status, data_size, data);
405 up(&efi_runtime_lock);405 up(&efi_runtime_lock);
406}406}
@@ -416,7 +416,7 @@ static efi_status_t virt_efi_update_capsule(efi_capsule_header_t **capsules, · 9 unmodified lines
416 416
417 if (down_interruptible(&efi_runtime_lock))417 if (down_interruptible(&efi_runtime_lock))
418 return EFI_ABORTED;418 return EFI_ABORTED;
419 status = efi_queue_work(UPDATE_CAPSULE, capsules, &count, &sg_list,419 status = efi_queue_work(EFI_UPDATE_CAPSULE, capsules, &count, &sg_list,
420 NULL, NULL);420 NULL, NULL);
421 up(&efi_runtime_lock);421 up(&efi_runtime_lock);
422 return status;422 return status;
@@ -434,7 +434,7 @@ static efi_status_t virt_efi_query_capsule_caps(efi_capsule_header_t **capsules, · 11 unmodified lines
434 434
435 if (down_interruptible(&efi_runtime_lock))435 if (down_interruptible(&efi_runtime_lock))
436 return EFI_ABORTED;436 return EFI_ABORTED;
437 status = efi_queue_work(QUERY_CAPSULE_CAPS, capsules, &count,437 status = efi_queue_work(EFI_QUERY_CAPSULE_CAPS, capsules, &count,
438 max_size, reset_type, NULL);438 max_size, reset_type, NULL);
439 up(&efi_runtime_lock);439 up(&efi_runtime_lock);
440 return status;440 return status;
include/linux/efi.h+13−13
@@ -1719,19 +1719,19 @@ extern int efi_tpm_eventlog_init(void); · 1718 unmodified lines
1719 * fault happened while executing an efi runtime service.1719 * fault happened while executing an efi runtime service.
1720 */1720 */
1721enum efi_rts_ids {1721enum efi_rts_ids {
1722 NONE,1722 EFI_NONE,
1723 GET_TIME,1723 EFI_GET_TIME,
1724 SET_TIME,1724 EFI_SET_TIME,
1725 GET_WAKEUP_TIME,1725 EFI_GET_WAKEUP_TIME,
1726 SET_WAKEUP_TIME,1726 EFI_SET_WAKEUP_TIME,
1727 GET_VARIABLE,1727 EFI_GET_VARIABLE,
1728 GET_NEXT_VARIABLE,1728 EFI_GET_NEXT_VARIABLE,
1729 SET_VARIABLE,1729 EFI_SET_VARIABLE,
1730 QUERY_VARIABLE_INFO,1730 EFI_QUERY_VARIABLE_INFO,
1731 GET_NEXT_HIGH_MONO_COUNT,1731 EFI_GET_NEXT_HIGH_MONO_COUNT,
1732 RESET_SYSTEM,1732 EFI_RESET_SYSTEM,
1733 UPDATE_CAPSULE,1733 EFI_UPDATE_CAPSULE,
1734 QUERY_CAPSULE_CAPS,1734 EFI_QUERY_CAPSULE_CAPS,
1735};1735};
1736 1736
1737/*1737/*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t