Changeset babcb148 in mainline for arch/ia32/src/acpi/acpi.c
- Timestamp:
- 2005-04-27T21:19:42Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 10a2e22
- Parents:
- 434f700
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/src/acpi/acpi.c
r434f700 rbabcb148 28 28 29 29 #include <arch/acpi/acpi.h> 30 #include <arch/bios/bios.h> 31 32 #define RSDP_SIGNATURE "RSD PTR " 33 #define RSDP_REVISION_OFFS 15 30 34 31 35 struct acpi_rsdp *acpi_rsdp = NULL; 32 36 37 int rsdp_check(__u8 *rsdp) { 38 struct acpi_rsdp *r = (struct acpi_rsdp *) rsdp; 39 __u8 sum = 0; 40 int i; 41 42 for (i=0; i<20; i++) 43 sum += rsdp[i]; 44 45 if (sum) 46 return 0; /* bad checksum */ 47 48 if (r->revision == 0) 49 return 1; /* ACPI 1.0 */ 50 51 for (; i<r->length; i++) 52 sum += rsdp[i]; 53 54 return !sum; 55 56 } 57 33 58 void acpi_init(void) 34 59 { 60 __u8 *addr[2] = { NULL, (__u8 *) 0xe0000 }; 61 int i, j, length[2] = { 1024, 128*1024 }; 62 __u64 *sig = (__u64 *) RSDP_SIGNATURE; 63 64 /* 65 * Find Root System Description Pointer 66 * 1. search first 1K of EBDA 67 * 2. search 128K starting at 0xe0000 68 */ 69 70 addr[0] = (__u8 *) ebda; 71 for (i = (ebda ? 0 : 1); i < 2; i++) { 72 for (j = 0; j < length[i]; j += 16) { 73 if (*((__u64 *) &addr[i][j]) == *sig && rsdp_check(&addr[i][j])) { 74 acpi_rsdp = (struct acpi_rsdp *) &addr[i][j]; 75 goto rsdp_found; 76 } 77 } 78 } 79 80 return; 81 82 rsdp_found: 83 printf("%L: ACPI Root System Description Pointer\n", acpi_rsdp); 35 84 }
Note:
See TracChangeset
for help on using the changeset viewer.