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
717717 * "efi_mm" cannot be used to check if the page fault had occurred
718718 * in the firmware context because efi=old_map doesn't use efi_pgd.
719719 */
720− if (efi_rts_work.efi_rts_id == NONE)
720+ if (efi_rts_work.efi_rts_id == EFI_NONE)
721721 return;
722722
723723 /*
@@ -742,7 +742,7 @@ void efi_recover_from_page_fault(unsigned long phys_addr) · 18 unmodified lines
742742 * because this case occurs *very* rarely and hence could be improved
743743 * on a need by basis.
744744 */
745− if (efi_rts_work.efi_rts_id == RESET_SYSTEM) {
745+ if (efi_rts_work.efi_rts_id == EFI_RESET_SYSTEM) {
746746 pr_info("efi_reset_system() buggy! Reboot through BIOS\n");
747747 machine_real_restart(MRR_BIOS);
748748 return;
drivers/firmware/efi/runtime-wrappers.c+24−24
@@ -85,7 +85,7 @@ struct efi_runtime_work efi_rts_work; · 84 unmodified lines
8585 pr_err("Failed to queue work to efi_rts_wq.\n"); \
8686 \
8787 exit: \
88− efi_rts_work.efi_rts_id = NONE; \
88+ efi_rts_work.efi_rts_id = EFI_NONE; \
8989 efi_rts_work.status; \
9090 })
9191
@@ -168,50 +168,50 @@ static void efi_call_rts(struct work_struct *work) · 76 unmodified lines
168168 arg5 = efi_rts_work.arg5;
169169
170170 switch (efi_rts_work.efi_rts_id) {
171− case GET_TIME:
171+ case EFI_GET_TIME:
172172 status = efi_call_virt(get_time, (efi_time_t *)arg1,
173173 (efi_time_cap_t *)arg2);
174174 break;
175− case SET_TIME:
175+ case EFI_SET_TIME:
176176 status = efi_call_virt(set_time, (efi_time_t *)arg1);
177177 break;
178− case GET_WAKEUP_TIME:
178+ case EFI_GET_WAKEUP_TIME:
179179 status = efi_call_virt(get_wakeup_time, (efi_bool_t *)arg1,
180180 (efi_bool_t *)arg2, (efi_time_t *)arg3);
181181 break;
182− case SET_WAKEUP_TIME:
182+ case EFI_SET_WAKEUP_TIME:
183183 status = efi_call_virt(set_wakeup_time, *(efi_bool_t *)arg1,
184184 (efi_time_t *)arg2);
185185 break;
186− case GET_VARIABLE:
186+ case EFI_GET_VARIABLE:
187187 status = efi_call_virt(get_variable, (efi_char16_t *)arg1,
188188 (efi_guid_t *)arg2, (u32 *)arg3,
189189 (unsigned long *)arg4, (void *)arg5);
190190 break;
191− case GET_NEXT_VARIABLE:
191+ case EFI_GET_NEXT_VARIABLE:
192192 status = efi_call_virt(get_next_variable, (unsigned long *)arg1,
193193 (efi_char16_t *)arg2,
194194 (efi_guid_t *)arg3);
195195 break;
196− case SET_VARIABLE:
196+ case EFI_SET_VARIABLE:
197197 status = efi_call_virt(set_variable, (efi_char16_t *)arg1,
198198 (efi_guid_t *)arg2, *(u32 *)arg3,
199199 *(unsigned long *)arg4, (void *)arg5);
200200 break;
201− case QUERY_VARIABLE_INFO:
201+ case EFI_QUERY_VARIABLE_INFO:
202202 status = efi_call_virt(query_variable_info, *(u32 *)arg1,
203203 (u64 *)arg2, (u64 *)arg3, (u64 *)arg4);
204204 break;
205− case GET_NEXT_HIGH_MONO_COUNT:
205+ case EFI_GET_NEXT_HIGH_MONO_COUNT:
206206 status = efi_call_virt(get_next_high_mono_count, (u32 *)arg1);
207207 break;
208− case UPDATE_CAPSULE:
208+ case EFI_UPDATE_CAPSULE:
209209 status = efi_call_virt(update_capsule,
210210 (efi_capsule_header_t **)arg1,
211211 *(unsigned long *)arg2,
212212 *(unsigned long *)arg3);
213213 break;
214− case QUERY_CAPSULE_CAPS:
214+ case EFI_QUERY_CAPSULE_CAPS:
215215 status = efi_call_virt(query_capsule_caps,
216216 (efi_capsule_header_t **)arg1,
217217 *(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
235235
236236 if (down_interruptible(&efi_runtime_lock))
237237 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);
239239 up(&efi_runtime_lock);
240240 return status;
241241 }
@@ -246,7 +246,7 @@ static efi_status_t virt_efi_set_time(efi_time_t *tm) · 4 unmodified lines
246246
247247 if (down_interruptible(&efi_runtime_lock))
248248 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);
250250 up(&efi_runtime_lock);
251251 return status;
252252 }
@@ -259,7 +259,7 @@ static efi_status_t virt_efi_get_wakeup_time(efi_bool_t *enabled, · 6 unmodified lines
259259
260260 if (down_interruptible(&efi_runtime_lock))
261261 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,
263263 NULL);
264264 up(&efi_runtime_lock);
265265 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
271271
272272 if (down_interruptible(&efi_runtime_lock))
273273 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,
275275 NULL);
276276 up(&efi_runtime_lock);
277277 return status;
@@ -287,7 +287,7 @@ static efi_status_t virt_efi_get_variable(efi_char16_t *name, · 9 unmodified lines
287287
288288 if (down_interruptible(&efi_runtime_lock))
289289 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,
291291 data);
292292 up(&efi_runtime_lock);
293293 return status;
@@ -301,7 +301,7 @@ static efi_status_t virt_efi_get_next_variable(unsigned long *name_size, · 7 unmodified lines
301301
302302 if (down_interruptible(&efi_runtime_lock))
303303 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,
305305 NULL, NULL);
306306 up(&efi_runtime_lock);
307307 return status;
@@ -317,7 +317,7 @@ static efi_status_t virt_efi_set_variable(efi_char16_t *name, · 9 unmodified lines
317317
318318 if (down_interruptible(&efi_runtime_lock))
319319 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,
321321 data);
322322 up(&efi_runtime_lock);
323323 return status;
@@ -352,7 +352,7 @@ static efi_status_t virt_efi_query_variable_info(u32 attr, · 28 unmodified lines
352352
353353 if (down_interruptible(&efi_runtime_lock))
354354 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,
356356 remaining_space, max_variable_size, NULL);
357357 up(&efi_runtime_lock);
358358 return status;
@@ -384,7 +384,7 @@ static efi_status_t virt_efi_get_next_high_mono_count(u32 *count) · 25 unmodified lines
384384
385385 if (down_interruptible(&efi_runtime_lock))
386386 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,
388388 NULL, NULL);
389389 up(&efi_runtime_lock);
390390 return status;
@@ -400,7 +400,7 @@ static void virt_efi_reset_system(int reset_type, · 9 unmodified lines
400400 "could not get exclusive access to the firmware\n");
401401 return;
402402 }
403− efi_rts_work.efi_rts_id = RESET_SYSTEM;
403+ efi_rts_work.efi_rts_id = EFI_RESET_SYSTEM;
404404 __efi_call_virt(reset_system, reset_type, status, data_size, data);
405405 up(&efi_runtime_lock);
406406 }
@@ -416,7 +416,7 @@ static efi_status_t virt_efi_update_capsule(efi_capsule_header_t **capsules, · 9 unmodified lines
416416
417417 if (down_interruptible(&efi_runtime_lock))
418418 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,
420420 NULL, NULL);
421421 up(&efi_runtime_lock);
422422 return status;
@@ -434,7 +434,7 @@ static efi_status_t virt_efi_query_capsule_caps(efi_capsule_header_t **capsules, · 11 unmodified lines
434434
435435 if (down_interruptible(&efi_runtime_lock))
436436 return EFI_ABORTED;
437− status = efi_queue_work(QUERY_CAPSULE_CAPS, capsules, &count,
437+ status = efi_queue_work(EFI_QUERY_CAPSULE_CAPS, capsules, &count,
438438 max_size, reset_type, NULL);
439439 up(&efi_runtime_lock);
440440 return status;
include/linux/efi.h+13−13
@@ -1719,19 +1719,19 @@ extern int efi_tpm_eventlog_init(void); · 1718 unmodified lines
17191719 * fault happened while executing an efi runtime service.
17201720 */
17211721 enum efi_rts_ids {
1722− NONE,
1723− GET_TIME,
1724− SET_TIME,
1725− GET_WAKEUP_TIME,
1726− SET_WAKEUP_TIME,
1727− GET_VARIABLE,
1728− GET_NEXT_VARIABLE,
1729− SET_VARIABLE,
1730− QUERY_VARIABLE_INFO,
1731− GET_NEXT_HIGH_MONO_COUNT,
1732− RESET_SYSTEM,
1733− UPDATE_CAPSULE,
1734− QUERY_CAPSULE_CAPS,
1722+ EFI_NONE,
1723+ EFI_GET_TIME,
1724+ EFI_SET_TIME,
1725+ EFI_GET_WAKEUP_TIME,
1726+ EFI_SET_WAKEUP_TIME,
1727+ EFI_GET_VARIABLE,
1728+ EFI_GET_NEXT_VARIABLE,
1729+ EFI_SET_VARIABLE,
1730+ EFI_QUERY_VARIABLE_INFO,
1731+ EFI_GET_NEXT_HIGH_MONO_COUNT,
1732+ EFI_RESET_SYSTEM,
1733+ EFI_UPDATE_CAPSULE,
1734+ EFI_QUERY_CAPSULE_CAPS,
17351735 };
17361736
17371737 /*

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