merge mainline into net
This commit is contained in:
		
						commit
						dc5aeea5b9
					
				
					 103 changed files with 2530 additions and 690 deletions
				
			
		|  | @ -16,9 +16,28 @@ | |||
|  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
|  */ | ||||
| 
 | ||||
| #ifdef GRUB_DSDT_TEST | ||||
| #include <stdio.h> | ||||
| #include <unistd.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdint.h> | ||||
| #include <string.h> | ||||
| 
 | ||||
| #define grub_dprintf(cond, args...) printf ( args ) | ||||
| #define grub_printf printf | ||||
| typedef uint64_t grub_uint64_t; | ||||
| typedef uint32_t grub_uint32_t; | ||||
| typedef uint16_t grub_uint16_t; | ||||
| typedef uint8_t grub_uint8_t; | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
| #include <grub/acpi.h> | ||||
| 
 | ||||
| #ifndef GRUB_DSDT_TEST | ||||
| #include <grub/misc.h> | ||||
| #include <grub/cpu/io.h> | ||||
| #endif | ||||
| 
 | ||||
| static inline grub_uint32_t | ||||
| decode_length (const grub_uint8_t *ptr, int *numlen) | ||||
|  | @ -123,6 +142,7 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end) | |||
| 	return 0; | ||||
|       break; | ||||
|     case GRUB_ACPI_EXTOPCODE_FIELD_OP: | ||||
|     case GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP: | ||||
|       ptr++; | ||||
|       ptr += decode_length (ptr, 0); | ||||
|       break; | ||||
|  | @ -136,7 +156,7 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end) | |||
| static int | ||||
| get_sleep_type (grub_uint8_t *table, grub_uint8_t *end) | ||||
| { | ||||
|   grub_uint8_t *ptr, *prev; | ||||
|   grub_uint8_t *ptr, *prev = table; | ||||
|   int sleep_type = -1; | ||||
|    | ||||
|   ptr = table + sizeof (struct grub_acpi_table_header); | ||||
|  | @ -156,11 +176,12 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *end) | |||
| 	  break; | ||||
| 	case GRUB_ACPI_OPCODE_NAME: | ||||
| 	  ptr++; | ||||
| 	  if (memcmp (ptr, "_S5_", 4) == 0) | ||||
| 	  if (memcmp (ptr, "_S5_", 4) == 0 || memcmp (ptr, "\\_S5_", 4) == 0) | ||||
| 	    { | ||||
| 	      int ll; | ||||
| 	      grub_uint8_t *ptr2 = ptr; | ||||
| 	      ptr2 += 4; | ||||
| 	      grub_dprintf ("acpi", "S5 found\n"); | ||||
| 	      ptr2 += skip_name_string (ptr, end); | ||||
| 	      if (*ptr2 != 0x12) | ||||
| 		{ | ||||
| 		  grub_printf ("Unknown opcode in _S5: 0x%x\n", *ptr2); | ||||
|  | @ -208,6 +229,47 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *end) | |||
|   return sleep_type; | ||||
| } | ||||
| 
 | ||||
| #ifdef GRUB_DSDT_TEST | ||||
| int | ||||
| main (int argc, char **argv) | ||||
| { | ||||
|   FILE *f; | ||||
|   size_t len; | ||||
|   unsigned char *buf; | ||||
|   if (argc < 2) | ||||
|     printf ("Usage: %s FILE\n", argv[0]); | ||||
|   f = fopen (argv[1], "rb"); | ||||
|   if (!f) | ||||
|     { | ||||
|       printf ("Couldn't open file\n"); | ||||
|       return 1; | ||||
|     } | ||||
|   fseek (f, 0, SEEK_END); | ||||
|   len = ftell (f); | ||||
|   fseek (f, 0, SEEK_SET); | ||||
|   buf = malloc (len); | ||||
|   if (!buf) | ||||
|     { | ||||
|       printf ("Couldn't malloc buffer\n"); | ||||
|       fclose (f); | ||||
|       return 2; | ||||
|     } | ||||
|   if (fread (buf, 1, len, f) != len) | ||||
|     { | ||||
|       printf ("Read failed\n"); | ||||
|       free (buf); | ||||
|       fclose (f); | ||||
|       return 2; | ||||
|     } | ||||
| 
 | ||||
|   printf ("Sleep type = %d\n", get_sleep_type (buf, buf + len)); | ||||
|   free (buf); | ||||
|   fclose (f); | ||||
|   return 0; | ||||
| } | ||||
| 
 | ||||
| #else | ||||
| 
 | ||||
| void | ||||
| grub_acpi_halt (void) | ||||
| { | ||||
|  | @ -264,3 +326,4 @@ grub_acpi_halt (void) | |||
| 
 | ||||
|   grub_printf ("ACPI shutdown failed\n"); | ||||
| } | ||||
| #endif | ||||
|  |  | |||
|  | @ -225,7 +225,9 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)), | |||
| 			int argc, char **args) | ||||
| { | ||||
|   int i; | ||||
| #ifdef TODO | ||||
|   int no_mem_option = 0; | ||||
| #endif | ||||
|   struct grub_command *cmd; | ||||
|   char **cutargs; | ||||
|   int cutargc; | ||||
|  | @ -235,7 +237,9 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)), | |||
|       /* FIXME: really support this.  */ | ||||
|       if (argc >= 1 && grub_strcmp (args[0], "--no-mem-option") == 0) | ||||
| 	{ | ||||
| #ifdef TODO | ||||
| 	  no_mem_option = 1; | ||||
| #endif | ||||
| 	  argc--; | ||||
| 	  args++; | ||||
| 	  continue; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue