summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/interface/pcbios/rsdp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/x86/interface/pcbios/rsdp.c')
-rw-r--r--src/arch/x86/interface/pcbios/rsdp.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/arch/x86/interface/pcbios/rsdp.c b/src/arch/x86/interface/pcbios/rsdp.c
index 3c67b7525..6913be552 100644
--- a/src/arch/x86/interface/pcbios/rsdp.c
+++ b/src/arch/x86/interface/pcbios/rsdp.c
@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#include <stdint.h>
+#include <string.h>
#include <realmode.h>
#include <bios.h>
#include <ipxe/acpi.h>
@@ -53,50 +54,51 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
* @v start Start address to search
* @v len Length to search
- * @ret rsdt ACPI root system description table, or UNULL
+ * @ret rsdt ACPI root system description table, or NULL
*/
-static userptr_t rsdp_find_rsdt_range ( userptr_t start, size_t len ) {
+static const struct acpi_rsdt * rsdp_find_rsdt_range ( const void *start,
+ size_t len ) {
static const char signature[8] = RSDP_SIGNATURE;
- struct acpi_rsdp rsdp;
- userptr_t rsdt;
+ const struct acpi_rsdp *rsdp;
+ const struct acpi_rsdt *rsdt;
size_t offset;
uint8_t sum;
unsigned int i;
/* Search for RSDP */
- for ( offset = 0 ; ( ( offset + sizeof ( rsdp ) ) < len ) ;
+ for ( offset = 0 ; ( ( offset + sizeof ( *rsdp ) ) < len ) ;
offset += RSDP_STRIDE ) {
/* Check signature and checksum */
- copy_from_user ( &rsdp, start, offset, sizeof ( rsdp ) );
- if ( memcmp ( rsdp.signature, signature,
+ rsdp = ( start + offset );
+ if ( memcmp ( rsdp->signature, signature,
sizeof ( signature ) ) != 0 )
continue;
- for ( sum = 0, i = 0 ; i < sizeof ( rsdp ) ; i++ )
- sum += *( ( ( uint8_t * ) &rsdp ) + i );
+ for ( sum = 0, i = 0 ; i < sizeof ( *rsdp ) ; i++ )
+ sum += *( ( ( uint8_t * ) rsdp ) + i );
if ( sum != 0 )
continue;
/* Extract RSDT */
- rsdt = phys_to_user ( le32_to_cpu ( rsdp.rsdt ) );
+ rsdt = phys_to_virt ( le32_to_cpu ( rsdp->rsdt ) );
DBGC ( rsdt, "RSDT %#08lx found via RSDP %#08lx\n",
- user_to_phys ( rsdt, 0 ),
- user_to_phys ( start, offset ) );
+ virt_to_phys ( rsdt ),
+ ( virt_to_phys ( start ) + offset ) );
return rsdt;
}
- return UNULL;
+ return NULL;
}
/**
* Locate ACPI root system description table
*
- * @ret rsdt ACPI root system description table, or UNULL
+ * @ret rsdt ACPI root system description table, or NULL
*/
-static userptr_t rsdp_find_rsdt ( void ) {
- static userptr_t rsdt;
+static const struct acpi_rsdt * rsdp_find_rsdt ( void ) {
+ static const struct acpi_rsdt *rsdt;
+ const void *ebda;
uint16_t ebda_seg;
- userptr_t ebda;
size_t ebda_len;
/* Return existing RSDT if already found */
@@ -106,7 +108,7 @@ static userptr_t rsdp_find_rsdt ( void ) {
/* Search EBDA */
get_real ( ebda_seg, BDA_SEG, BDA_EBDA );
if ( ebda_seg < RSDP_EBDA_END_SEG ) {
- ebda = real_to_user ( ebda_seg, 0 );
+ ebda = real_to_virt ( ebda_seg, 0 );
ebda_len = ( ( RSDP_EBDA_END_SEG - ebda_seg ) * 16 );
rsdt = rsdp_find_rsdt_range ( ebda, ebda_len );
if ( rsdt )
@@ -114,12 +116,12 @@ static userptr_t rsdp_find_rsdt ( void ) {
}
/* Search fixed BIOS area */
- rsdt = rsdp_find_rsdt_range ( phys_to_user ( RSDP_BIOS_START ),
+ rsdt = rsdp_find_rsdt_range ( phys_to_virt ( RSDP_BIOS_START ),
RSDP_BIOS_LEN );
if ( rsdt )
return rsdt;
- return UNULL;
+ return NULL;
}
PROVIDE_ACPI ( rsdp, acpi_find_rsdt, rsdp_find_rsdt );