wok diff linux-libre/stuff/linux-libre-efi-3.18.129-gnu.u @ rev 22005

added tar-lang 1.32
author Hans-G?nter Theisgen
date Fri Oct 18 17:38:24 2019 +0100 (2019-10-18)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/linux-libre/stuff/linux-libre-efi-3.18.129-gnu.u	Fri Oct 18 17:38:24 2019 +0100
     1.3 @@ -0,0 +1,220 @@
     1.4 +--- linux-3.16.53/drivers/firmware/efi/libstub/efi-stub-helper.c
     1.5 ++++ linux-3.16.53/drivers/firmware/efi/libstub/efi-stub-helper.c
     1.6 +@@ -341,6 +341,79 @@
     1.7 + }
     1.8 + 
     1.9 + /*
    1.10 ++ *
    1.11 ++ */
    1.12 ++static efi_status_t get_file_size(efi_system_table_t *sys_table_arg,
    1.13 ++				  efi_loaded_image_t *image,
    1.14 ++				  efi_char16_t *filename_16,
    1.15 ++				  struct file_info *file)
    1.16 ++{
    1.17 ++	efi_status_t status;
    1.18 ++	efi_file_handle_t *fh = NULL;
    1.19 ++#ifdef CONFIG_X86_64
    1.20 ++	efi_char16_t *p, c;
    1.21 ++#endif
    1.22 ++
    1.23 ++	/* Only open the volume once. */
    1.24 ++	if (!fh) {
    1.25 ++		status = efi_open_volume(sys_table_arg, image,
    1.26 ++					 (void **)&fh);
    1.27 ++		if (status != EFI_SUCCESS)
    1.28 ++			return status;
    1.29 ++	}
    1.30 ++#ifdef CONFIG_X86_64
    1.31 ++	for (p = filename_16; *p != '\0'; p++);
    1.32 ++	c = p[-2];
    1.33 ++	file->size = EFI_FILE_SIZE_MUTE;
    1.34 ++	while (1) {
    1.35 ++#endif
    1.36 ++		status = efi_file_size(sys_table_arg, fh, filename_16,
    1.37 ++				       (void **)&file->handle, &file->size);
    1.38 ++#ifdef CONFIG_X86_64
    1.39 ++		if (status != EFI_SUCCESS && p[-2] != '\0') {
    1.40 ++			p[-2] = '\0';
    1.41 ++			file->size++;
    1.42 ++			continue;
    1.43 ++		}
    1.44 ++		break;
    1.45 ++	}
    1.46 ++	p[-2] = c;
    1.47 ++#endif
    1.48 ++	return status;
    1.49 ++}
    1.50 ++
    1.51 ++/*
    1.52 ++ *
    1.53 ++ */
    1.54 ++static efi_status_t read_efi_file(efi_system_table_t *sys_table_arg,
    1.55 ++			      struct file_info *file,
    1.56 ++			      unsigned long addr,
    1.57 ++			      unsigned long size)
    1.58 ++{
    1.59 ++	efi_status_t status;
    1.60 ++
    1.61 ++	while (size) {
    1.62 ++		unsigned long chunksize;
    1.63 ++		if (size > __chunk_size)
    1.64 ++			chunksize = __chunk_size;
    1.65 ++		else
    1.66 ++			chunksize = size;
    1.67 ++
    1.68 ++		status = efi_file_read(file->handle,
    1.69 ++				       &chunksize,
    1.70 ++				       (void *)addr);
    1.71 ++		if (status != EFI_SUCCESS) {
    1.72 ++			pr_efi_err(sys_table_arg, "Failed to read file\n");
    1.73 ++			break;
    1.74 ++		}
    1.75 ++		addr += chunksize;
    1.76 ++		size -= chunksize;
    1.77 ++	}
    1.78 ++	efi_file_close(file->handle);
    1.79 ++	return status;
    1.80 ++}
    1.81 ++
    1.82 ++/*
    1.83 +  * Check the cmdline for a LILO-style file= arguments.
    1.84 +  *
    1.85 +  * We only support loading a file from the same filesystem as
    1.86 +@@ -434,18 +507,14 @@
    1.87 + 			}
    1.88 + 		}
    1.89 + 
    1.90 ++#ifdef CONFIG_X86_64
    1.91 ++		*p++ = '6';
    1.92 ++		*p++ = '4';
    1.93 ++#endif
    1.94 + 		*p = '\0';
    1.95 + 
    1.96 +-		/* Only open the volume once. */
    1.97 +-		if (!i) {
    1.98 +-			status = efi_open_volume(sys_table_arg, image,
    1.99 +-						 (void **)&fh);
   1.100 +-			if (status != EFI_SUCCESS)
   1.101 +-				goto free_files;
   1.102 +-		}
   1.103 +-
   1.104 +-		status = efi_file_size(sys_table_arg, fh, filename_16,
   1.105 +-				       (void **)&file->handle, &file->size);
   1.106 ++		status = get_file_size(sys_table_arg,image,filename_16,file);
   1.107 ++	
   1.108 + 		if (status != EFI_SUCCESS)
   1.109 + 			goto close_handles;
   1.110 + 
   1.111 +@@ -476,28 +545,11 @@
   1.112 + 
   1.113 + 		addr = file_addr;
   1.114 + 		for (j = 0; j < nr_files; j++) {
   1.115 +-			unsigned long size;
   1.116 +-
   1.117 +-			size = files[j].size;
   1.118 +-			while (size) {
   1.119 +-				unsigned long chunksize;
   1.120 +-				if (size > __chunk_size)
   1.121 +-					chunksize = __chunk_size;
   1.122 +-				else
   1.123 +-					chunksize = size;
   1.124 +-
   1.125 +-				status = efi_file_read(files[j].handle,
   1.126 +-						       &chunksize,
   1.127 +-						       (void *)addr);
   1.128 +-				if (status != EFI_SUCCESS) {
   1.129 +-					pr_efi_err(sys_table_arg, "Failed to read file\n");
   1.130 +-					goto free_file_total;
   1.131 +-				}
   1.132 +-				addr += chunksize;
   1.133 +-				size -= chunksize;
   1.134 +-			}
   1.135 +-
   1.136 +-			efi_file_close(files[j].handle);
   1.137 ++			status = read_efi_file(sys_table_arg, &files[j], addr, files[j].size);
   1.138 ++			if (status != EFI_SUCCESS)
   1.139 ++				goto free_file_total;
   1.140 ++			addr += files[j].size + 3;
   1.141 ++			addr &= 0xFFFFFFFCUL;
   1.142 + 		}
   1.143 + 
   1.144 + 	}
   1.145 +@@ -669,6 +721,30 @@
   1.146 + 	}
   1.147 + 
   1.148 + 	if (!options_chars) {
   1.149 ++		/* No command line options, look for linux.cmdline */
   1.150 ++#ifdef CONFIG_X86_64
   1.151 ++#define cmdline_name L"EFI\\BOOT\\linux.cmdline64"
   1.152 ++#else
   1.153 ++#define cmdline_name L"EFI\\BOOT\\linux.cmdline"
   1.154 ++#endif
   1.155 ++		struct file_info file;
   1.156 ++		efi_char16_t filename_16[sizeof(cmdline_name)];
   1.157 ++
   1.158 ++		memcpy((void *)filename_16, (void *)cmdline_name, sizeof(cmdline_name));
   1.159 ++		if (get_file_size(sys_table_arg, image, filename_16, &file) != EFI_SUCCESS)
   1.160 ++			goto no_cmdline_file;
   1.161 ++
   1.162 ++		options_bytes = file.size+1;
   1.163 ++		if (efi_low_alloc(sys_table_arg, options_bytes, 0, &cmdline_addr) != EFI_SUCCESS)
   1.164 ++			goto no_cmdline_file;
   1.165 ++
   1.166 ++		*((u8 *)cmdline_addr + file.size) = '\0';
   1.167 ++		if (read_efi_file(sys_table_arg, &file, cmdline_addr, file.size) == EFI_SUCCESS)
   1.168 ++			goto return_cmdline;
   1.169 ++	}
   1.170 ++	no_cmdline_file:
   1.171 ++
   1.172 ++	if (!options_chars) {
   1.173 + 		/* No command line options, so return empty string*/
   1.174 + 		options = &zero;
   1.175 + 	}
   1.176 +@@ -685,6 +761,7 @@
   1.177 + 	s1 = efi_utf16_to_utf8(s1, s2, options_chars);
   1.178 + 	*s1 = '\0';
   1.179 + 
   1.180 ++return_cmdline:
   1.181 + 	*cmd_line_len = options_bytes;
   1.182 + 	return (char *)cmdline_addr;
   1.183 + }
   1.184 +--- linux-3.16.53/arch/x86/boot/compressed/eboot.c
   1.185 ++++ linux-3.16.53/arch/x86/boot/compressed/eboot.c
   1.186 +@@ -50,6 +50,7 @@
   1.187 + 
   1.188 + void efi_char16_printk(efi_system_table_t *, efi_char16_t *);
   1.189 + 
   1.190 ++#define EFI_FILE_SIZE_MUTE	0x4554554d20525245LL
   1.191 + static efi_status_t
   1.192 + __file_size32(void *__fh, efi_char16_t *filename_16,
   1.193 + 	      void **handle, u64 *file_sz)
   1.194 +@@ -63,9 +64,11 @@
   1.195 + 	status = efi_early->call((unsigned long)fh->open, fh, &h, filename_16,
   1.196 + 				 EFI_FILE_MODE_READ, (u64)0);
   1.197 + 	if (status != EFI_SUCCESS) {
   1.198 +-		efi_printk(sys_table, "Failed to open file: ");
   1.199 +-		efi_char16_printk(sys_table, filename_16);
   1.200 +-		efi_printk(sys_table, "\n");
   1.201 ++		if (*file_sz != EFI_FILE_SIZE_MUTE) {
   1.202 ++			efi_printk(sys_table, "Failed to open file: ");
   1.203 ++			efi_char16_printk(sys_table, filename_16);
   1.204 ++			efi_printk(sys_table, "\n");
   1.205 ++		}
   1.206 + 		return status;
   1.207 + 	}
   1.208 + 
   1.209 +@@ -116,9 +119,11 @@
   1.210 + 	status = efi_early->call((unsigned long)fh->open, fh, &h, filename_16,
   1.211 + 				 EFI_FILE_MODE_READ, (u64)0);
   1.212 + 	if (status != EFI_SUCCESS) {
   1.213 +-		efi_printk(sys_table, "Failed to open file: ");
   1.214 +-		efi_char16_printk(sys_table, filename_16);
   1.215 +-		efi_printk(sys_table, "\n");
   1.216 ++		if (*file_sz != EFI_FILE_SIZE_MUTE) {
   1.217 ++			efi_printk(sys_table, "Failed to open file: ");
   1.218 ++			efi_char16_printk(sys_table, filename_16);
   1.219 ++			efi_printk(sys_table, "\n");
   1.220 ++		}
   1.221 + 		return status;
   1.222 + 	}
   1.223 +