mirror of
				https://git.proxmox.com/git/efi-boot-shim
				synced 2025-10-31 04:59:19 +00:00 
			
		
		
		
	Merge console_control.h and console.h
Since these are topically the same thing, they can live together. Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
		
							parent
							
								
									bc71a15ed5
								
							
						
					
					
						commit
						417077f8de
					
				
							
								
								
									
										4
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
									
									
									
									
								
							| @ -38,9 +38,9 @@ VERSION		= 0.4 | ||||
| TARGET	= shim.efi MokManager.efi.signed fallback.efi.signed | ||||
| OBJS	= shim.o netboot.o cert.o replacements.o | ||||
| KEYS	= shim_cert.h ocsp.* ca.* shim.crt shim.csr shim.p12 shim.pem shim.key | ||||
| SOURCES	= shim.c shim.h netboot.c include/PeImage.h include/wincert.h include/console.h replacements.c replacements.h include/console_control.h | ||||
| SOURCES	= shim.c shim.h netboot.c include/PeImage.h include/wincert.h include/console.h replacements.c replacements.h | ||||
| MOK_OBJS = MokManager.o PasswordCrypt.o crypt_blowfish.o | ||||
| MOK_SOURCES = MokManager.c shim.h include/console_control.h PasswordCrypt.c PasswordCrypt.h crypt_blowfish.c crypt_blowfish.h | ||||
| MOK_SOURCES = MokManager.c shim.h include/console.h PasswordCrypt.c PasswordCrypt.h crypt_blowfish.c crypt_blowfish.h | ||||
| FALLBACK_OBJS = fallback.o | ||||
| FALLBACK_SRCS = fallback.c | ||||
| 
 | ||||
|  | ||||
| @ -2,7 +2,6 @@ | ||||
| #include <efilib.h> | ||||
| #include <Library/BaseCryptLib.h> | ||||
| #include <openssl/x509.h> | ||||
| #include "console_control.h" | ||||
| #include "shim.h" | ||||
| #include "PeImage.h" | ||||
| #include "PasswordCrypt.h" | ||||
|  | ||||
| @ -1,3 +1,6 @@ | ||||
| #ifndef _SHIM_LIB_CONSOLE_H | ||||
| #define _SHIM_LIB_CONSOLE_H 1 | ||||
| 
 | ||||
| EFI_INPUT_KEY | ||||
| console_get_keystroke(void); | ||||
| void | ||||
| @ -19,3 +22,47 @@ console_notify(CHAR16 *string); | ||||
| void | ||||
| console_reset(void); | ||||
| #define NOSEL 0x7fffffff | ||||
| 
 | ||||
| #define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \ | ||||
|   { 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} } | ||||
| 
 | ||||
| typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL   EFI_CONSOLE_CONTROL_PROTOCOL; | ||||
| 
 | ||||
| typedef enum { | ||||
|   EfiConsoleControlScreenText, | ||||
|   EfiConsoleControlScreenGraphics, | ||||
|   EfiConsoleControlScreenMaxValue | ||||
| } EFI_CONSOLE_CONTROL_SCREEN_MODE; | ||||
| 
 | ||||
| typedef | ||||
| EFI_STATUS | ||||
| (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE) ( | ||||
|   IN  EFI_CONSOLE_CONTROL_PROTOCOL      *This, | ||||
|   OUT EFI_CONSOLE_CONTROL_SCREEN_MODE   *Mode, | ||||
|   OUT BOOLEAN                           *GopUgaExists,  OPTIONAL   | ||||
|   OUT BOOLEAN                           *StdInLocked    OPTIONAL | ||||
|   ); | ||||
| 
 | ||||
| typedef | ||||
| EFI_STATUS | ||||
| (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE) ( | ||||
|   IN  EFI_CONSOLE_CONTROL_PROTOCOL      *This, | ||||
|   IN  EFI_CONSOLE_CONTROL_SCREEN_MODE   Mode | ||||
|   ); | ||||
| 
 | ||||
| typedef | ||||
| EFI_STATUS | ||||
| (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN) ( | ||||
|   IN  EFI_CONSOLE_CONTROL_PROTOCOL      *This, | ||||
|   IN CHAR16                             *Password | ||||
|   ); | ||||
| 
 | ||||
| struct _EFI_CONSOLE_CONTROL_PROTOCOL { | ||||
|   EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE           GetMode; | ||||
|   EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE           SetMode; | ||||
|   EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN        LockStdIn; | ||||
| }; | ||||
| 
 | ||||
| extern VOID setup_console (int text); | ||||
| 
 | ||||
| #endif /* _SHIM_LIB_CONSOLE_H */ | ||||
|  | ||||
| @ -1,46 +0,0 @@ | ||||
| #ifndef _SHIM_CONSOLE_CONTROL_H | ||||
| #define _SHIM_CONSOLE_CONTROL_H 1 | ||||
| 
 | ||||
| #define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \ | ||||
|   { 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} } | ||||
| 
 | ||||
| typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL   EFI_CONSOLE_CONTROL_PROTOCOL; | ||||
| 
 | ||||
| typedef enum { | ||||
|   EfiConsoleControlScreenText, | ||||
|   EfiConsoleControlScreenGraphics, | ||||
|   EfiConsoleControlScreenMaxValue | ||||
| } EFI_CONSOLE_CONTROL_SCREEN_MODE; | ||||
| 
 | ||||
| typedef | ||||
| EFI_STATUS | ||||
| (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE) ( | ||||
|   IN  EFI_CONSOLE_CONTROL_PROTOCOL      *This, | ||||
|   OUT EFI_CONSOLE_CONTROL_SCREEN_MODE   *Mode, | ||||
|   OUT BOOLEAN                           *GopUgaExists,  OPTIONAL   | ||||
|   OUT BOOLEAN                           *StdInLocked    OPTIONAL | ||||
|   ); | ||||
| 
 | ||||
| typedef | ||||
| EFI_STATUS | ||||
| (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE) ( | ||||
|   IN  EFI_CONSOLE_CONTROL_PROTOCOL      *This, | ||||
|   IN  EFI_CONSOLE_CONTROL_SCREEN_MODE   Mode | ||||
|   ); | ||||
| 
 | ||||
| typedef | ||||
| EFI_STATUS | ||||
| (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN) ( | ||||
|   IN  EFI_CONSOLE_CONTROL_PROTOCOL      *This, | ||||
|   IN CHAR16                             *Password | ||||
|   ); | ||||
| 
 | ||||
| struct _EFI_CONSOLE_CONTROL_PROTOCOL { | ||||
|   EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE           GetMode; | ||||
|   EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE           SetMode; | ||||
|   EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN        LockStdIn; | ||||
| }; | ||||
| 
 | ||||
| extern VOID setup_console (int text); | ||||
| 
 | ||||
| #endif /* _SHIM_CONSOLE_CONTROL_H */ | ||||
| @ -1,6 +1,6 @@ | ||||
| TARGET = lib.a | ||||
| 
 | ||||
| LIBFILES = simple_file.o guid.o console.o execute.o configtable.o shell.o variables.o security_policy.o console_control.o | ||||
| LIBFILES = simple_file.o guid.o console.o execute.o configtable.o shell.o variables.o security_policy.o | ||||
| 
 | ||||
| ARCH            = $(shell uname -m | sed s,i[3456789]86,ia32,) | ||||
| 
 | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| /*
 | ||||
|  * Copyright 2012 <James.Bottomley@HansenPartnership.com> | ||||
|  * Copyright 2013 Red Hat Inc. <pjones@redhat.com> | ||||
|  * | ||||
|  * see COPYING file | ||||
|  */ | ||||
| @ -400,3 +401,31 @@ console_reset(void) | ||||
| 	uefi_call_wrapper(co->SetMode, 2, co, 0); | ||||
| 	uefi_call_wrapper(co->ClearScreen, 1, co); | ||||
| } | ||||
| 
 | ||||
| VOID setup_console (int text) | ||||
| { | ||||
| 	EFI_STATUS status; | ||||
| 	EFI_GUID console_control_guid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID; | ||||
| 	EFI_CONSOLE_CONTROL_PROTOCOL *concon; | ||||
| 	static EFI_CONSOLE_CONTROL_SCREEN_MODE mode = | ||||
| 					EfiConsoleControlScreenGraphics; | ||||
| 	EFI_CONSOLE_CONTROL_SCREEN_MODE new_mode; | ||||
| 
 | ||||
| 	status = LibLocateProtocol(&console_control_guid, (VOID **)&concon); | ||||
| 	if (status != EFI_SUCCESS) | ||||
| 		return; | ||||
| 
 | ||||
| 	if (text) { | ||||
| 		new_mode = EfiConsoleControlScreenText; | ||||
| 
 | ||||
| 		status = uefi_call_wrapper(concon->GetMode, 4, concon, &mode, | ||||
| 						0, 0); | ||||
| 		/* If that didn't work, assume it's graphics */ | ||||
| 		if (status != EFI_SUCCESS) | ||||
| 			mode = EfiConsoleControlScreenGraphics; | ||||
| 	} else { | ||||
| 		new_mode = mode; | ||||
| 	} | ||||
| 
 | ||||
| 	uefi_call_wrapper(concon->SetMode, 2, concon, new_mode); | ||||
| } | ||||
|  | ||||
| @ -1,32 +0,0 @@ | ||||
| #include <efi.h> | ||||
| #include <efilib.h> | ||||
| 
 | ||||
| #include "console_control.h" | ||||
| 
 | ||||
| VOID setup_console (int text) | ||||
| { | ||||
| 	EFI_STATUS status; | ||||
| 	EFI_GUID console_control_guid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID; | ||||
| 	EFI_CONSOLE_CONTROL_PROTOCOL *concon; | ||||
| 	static EFI_CONSOLE_CONTROL_SCREEN_MODE mode = | ||||
| 					EfiConsoleControlScreenGraphics; | ||||
| 	EFI_CONSOLE_CONTROL_SCREEN_MODE new_mode; | ||||
| 
 | ||||
| 	status = LibLocateProtocol(&console_control_guid, (VOID **)&concon); | ||||
| 	if (status != EFI_SUCCESS) | ||||
| 		return; | ||||
| 
 | ||||
| 	if (text) { | ||||
| 		new_mode = EfiConsoleControlScreenText; | ||||
| 
 | ||||
| 		status = uefi_call_wrapper(concon->GetMode, 4, concon, &mode, | ||||
| 						0, 0); | ||||
| 		/* If that didn't work, assume it's graphics */ | ||||
| 		if (status != EFI_SUCCESS) | ||||
| 			mode = EfiConsoleControlScreenGraphics; | ||||
| 	} else { | ||||
| 		new_mode = mode; | ||||
| 	} | ||||
| 
 | ||||
| 	uefi_call_wrapper(concon->SetMode, 2, concon, new_mode); | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Peter Jones
						Peter Jones