Blame SOURCES/0262-Add-new-defines-GRUB_RSDP_SIGNATURE_SIZE-and-GRUB_RS.patch

f96e0b
From b880c54029696992290b7a0a635343762a4675c9 Mon Sep 17 00:00:00 2001
f96e0b
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
f96e0b
Date: Fri, 5 Apr 2013 10:56:43 +0200
f96e0b
Subject: [PATCH 262/482] 	Add new defines GRUB_RSDP_SIGNATURE_SIZE and
f96e0b
 GRUB_RSDP_SIGNATURE.
f96e0b
f96e0b
---
f96e0b
 ChangeLog                         |  4 ++++
f96e0b
 grub-core/commands/acpi.c         | 10 +++++-----
f96e0b
 grub-core/commands/i386/pc/acpi.c |  8 ++++----
f96e0b
 include/grub/acpi.h               |  5 ++++-
f96e0b
 4 files changed, 17 insertions(+), 10 deletions(-)
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index e52e7ee..3431895 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,5 +1,9 @@
f96e0b
 2013-04-05  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
 
f96e0b
+	Add new defines GRUB_RSDP_SIGNATURE_SIZE and GRUB_RSDP_SIGNATURE.
f96e0b
+
f96e0b
+2013-04-05  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
+
f96e0b
 	* grub-core/commands/verify.c: Use GRUB_CHAR_BIT.
f96e0b
 
f96e0b
 2013-04-05  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c
f96e0b
index 8000873..4ca8cf7 100644
f96e0b
--- a/grub-core/commands/acpi.c
f96e0b
+++ b/grub-core/commands/acpi.c
f96e0b
@@ -217,7 +217,7 @@ grub_acpi_create_ebda (void)
f96e0b
     {
f96e0b
       grub_dprintf ("acpi", "Scanning EBDA for old rsdpv2\n");
f96e0b
       for (; target < targetebda + 0x400 - v2->length; target += 0x10)
f96e0b
-	if (grub_memcmp (target, "RSD PTR ", 8) == 0
f96e0b
+	if (grub_memcmp (target, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
f96e0b
 	    && grub_byte_checksum (target,
f96e0b
 				   sizeof (struct grub_acpi_rsdp_v10)) == 0
f96e0b
 	    && ((struct grub_acpi_rsdp_v10 *) target)->revision != 0
f96e0b
@@ -238,7 +238,7 @@ grub_acpi_create_ebda (void)
f96e0b
       grub_dprintf ("acpi", "Scanning EBDA for old rsdpv1\n");
f96e0b
       for (; target < targetebda + 0x400 - sizeof (struct grub_acpi_rsdp_v10);
f96e0b
 	   target += 0x10)
f96e0b
-	if (grub_memcmp (target, "RSD PTR ", 8) == 0
f96e0b
+	if (grub_memcmp (target, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
f96e0b
 	    && grub_byte_checksum (target,
f96e0b
 				   sizeof (struct grub_acpi_rsdp_v10)) == 0)
f96e0b
 	  {
f96e0b
@@ -299,7 +299,7 @@ grub_acpi_create_ebda (void)
f96e0b
   for (target = targetebda;
f96e0b
        target < targetebda + 0x400 - sizeof (struct grub_acpi_rsdp_v10);
f96e0b
        target += 0x10)
f96e0b
-    if (grub_memcmp (target, "RSD PTR ", 8) == 0
f96e0b
+    if (grub_memcmp (target, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
f96e0b
 	&& grub_byte_checksum (target,
f96e0b
 			       sizeof (struct grub_acpi_rsdp_v10)) == 0
f96e0b
 	&& target != v1inebda && target != v2inebda)
f96e0b
@@ -394,7 +394,7 @@ setv1table (void)
f96e0b
   /* Create RSDP. */
f96e0b
   rsdpv1_new = (struct grub_acpi_rsdp_v10 *) playground_ptr;
f96e0b
   playground_ptr += sizeof (struct grub_acpi_rsdp_v10);
f96e0b
-  grub_memcpy (&(rsdpv1_new->signature), "RSD PTR ",
f96e0b
+  grub_memcpy (&(rsdpv1_new->signature), GRUB_RSDP_SIGNATURE,
f96e0b
 	       sizeof (rsdpv1_new->signature));
f96e0b
   grub_memcpy (&(rsdpv1_new->oemid), root_oemid, sizeof  (rsdpv1_new->oemid));
f96e0b
   rsdpv1_new->revision = 0;
f96e0b
@@ -438,7 +438,7 @@ setv2table (void)
f96e0b
   /* Create RSDPv2. */
f96e0b
   rsdpv2_new = (struct grub_acpi_rsdp_v20 *) playground_ptr;
f96e0b
   playground_ptr += sizeof (struct grub_acpi_rsdp_v20);
f96e0b
-  grub_memcpy (&(rsdpv2_new->rsdpv1.signature), "RSD PTR ",
f96e0b
+  grub_memcpy (&(rsdpv2_new->rsdpv1.signature), GRUB_RSDP_SIGNATURE,
f96e0b
 	       sizeof (rsdpv2_new->rsdpv1.signature));
f96e0b
   grub_memcpy (&(rsdpv2_new->rsdpv1.oemid), root_oemid,
f96e0b
 	       sizeof (rsdpv2_new->rsdpv1.oemid));
f96e0b
diff --git a/grub-core/commands/i386/pc/acpi.c b/grub-core/commands/i386/pc/acpi.c
f96e0b
index 88e4f55..d415d23 100644
f96e0b
--- a/grub-core/commands/i386/pc/acpi.c
f96e0b
+++ b/grub-core/commands/i386/pc/acpi.c
f96e0b
@@ -32,7 +32,7 @@ grub_machine_acpi_get_rsdpv1 (void)
f96e0b
   if (! ebda_len)
f96e0b
     return 0;
f96e0b
   for (ptr = ebda; ptr < ebda + 0x400; ptr += 16)
f96e0b
-    if (grub_memcmp (ptr, "RSD PTR ", 8) == 0
f96e0b
+    if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
f96e0b
 	&& grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
f96e0b
 	&& ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0)
f96e0b
       return (struct grub_acpi_rsdp_v10 *) ptr;
f96e0b
@@ -40,7 +40,7 @@ grub_machine_acpi_get_rsdpv1 (void)
f96e0b
   grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n");
f96e0b
   for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000;
f96e0b
        ptr += 16)
f96e0b
-    if (grub_memcmp (ptr, "RSD PTR ", 8) == 0
f96e0b
+    if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
f96e0b
 	&& grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
f96e0b
 	&& ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0)
f96e0b
       return (struct grub_acpi_rsdp_v10 *) ptr;
f96e0b
@@ -59,7 +59,7 @@ grub_machine_acpi_get_rsdpv2 (void)
f96e0b
   if (! ebda_len)
f96e0b
     return 0;
f96e0b
   for (ptr = ebda; ptr < ebda + 0x400; ptr += 16)
f96e0b
-    if (grub_memcmp (ptr, "RSD PTR ", 8) == 0
f96e0b
+    if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
f96e0b
 	&& grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
f96e0b
 	&& ((struct grub_acpi_rsdp_v10 *) ptr)->revision != 0
f96e0b
 	&& ((struct grub_acpi_rsdp_v20 *) ptr)->length < 1024
f96e0b
@@ -70,7 +70,7 @@ grub_machine_acpi_get_rsdpv2 (void)
f96e0b
   grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n");
f96e0b
   for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000;
f96e0b
        ptr += 16)
f96e0b
-    if (grub_memcmp (ptr, "RSD PTR ", 8) == 0
f96e0b
+    if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
f96e0b
 	&& grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
f96e0b
 	&& ((struct grub_acpi_rsdp_v10 *) ptr)->revision != 0
f96e0b
 	&& ((struct grub_acpi_rsdp_v20 *) ptr)->length < 1024
f96e0b
diff --git a/include/grub/acpi.h b/include/grub/acpi.h
f96e0b
index 8fa957d..32bb95c 100644
f96e0b
--- a/include/grub/acpi.h
f96e0b
+++ b/include/grub/acpi.h
f96e0b
@@ -24,9 +24,12 @@
f96e0b
 #include <grub/err.h>
f96e0b
 #endif
f96e0b
 
f96e0b
+#define GRUB_RSDP_SIGNATURE "RSD PTR "
f96e0b
+#define GRUB_RSDP_SIGNATURE_SIZE 8
f96e0b
+
f96e0b
 struct grub_acpi_rsdp_v10
f96e0b
 {
f96e0b
-  grub_uint8_t signature[8];
f96e0b
+  grub_uint8_t signature[GRUB_RSDP_SIGNATURE_SIZE];
f96e0b
   grub_uint8_t checksum;
f96e0b
   grub_uint8_t oemid[6];
f96e0b
   grub_uint8_t revision;
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b