mirror of
https://github.com/ipxe/ipxe
synced 2026-01-29 12:29:13 +03:00
[uaccess] Remove user_to_phys() and phys_to_user()
Remove the intermediate concept of a user pointer from physical address conversions, leaving virt_to_phys() and phys_to_virt() as the directly implemented functions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -48,7 +48,7 @@ static userptr_t efi_find_rsdt ( void ) {
|
||||
|
||||
/* Locate RSDT via ACPI configuration table, if available */
|
||||
if ( rsdp )
|
||||
return phys_to_user ( rsdp->RsdtAddress );
|
||||
return phys_to_virt ( rsdp->RsdtAddress );
|
||||
|
||||
return UNULL;
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ static int efifb_init ( struct console_configuration *config ) {
|
||||
mode, efifb.pixel.width, efifb.pixel.height, bpp, efifb.start );
|
||||
|
||||
/* Initialise frame buffer console */
|
||||
if ( ( rc = fbcon_init ( &efifb.fbcon, phys_to_user ( efifb.start ),
|
||||
if ( ( rc = fbcon_init ( &efifb.fbcon, phys_to_virt ( efifb.start ),
|
||||
&efifb.pixel, &efifb.map, &efifb.font,
|
||||
config ) ) != 0 )
|
||||
goto err_fbcon_init;
|
||||
|
||||
@@ -48,27 +48,27 @@ static int efi_find_smbios ( struct smbios *smbios ) {
|
||||
|
||||
/* Use 64-bit table if present */
|
||||
if ( smbios3_entry && ( smbios3_entry->signature == SMBIOS3_SIGNATURE ) ) {
|
||||
smbios->address = phys_to_user ( smbios3_entry->smbios_address );
|
||||
smbios->address = phys_to_virt ( smbios3_entry->smbios_address );
|
||||
smbios->len = smbios3_entry->smbios_len;
|
||||
smbios->count = 0;
|
||||
smbios->version =
|
||||
SMBIOS_VERSION ( smbios3_entry->major, smbios3_entry->minor );
|
||||
DBG ( "Found 64-bit SMBIOS v%d.%d entry point at %p (%lx+%zx)\n",
|
||||
smbios3_entry->major, smbios3_entry->minor, smbios3_entry,
|
||||
user_to_phys ( smbios->address, 0 ), smbios->len );
|
||||
virt_to_phys ( smbios->address ), smbios->len );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Otherwise, use 32-bit table if present */
|
||||
if ( smbios_entry && ( smbios_entry->signature == SMBIOS_SIGNATURE ) ) {
|
||||
smbios->address = phys_to_user ( smbios_entry->smbios_address );
|
||||
smbios->address = phys_to_virt ( smbios_entry->smbios_address );
|
||||
smbios->len = smbios_entry->smbios_len;
|
||||
smbios->count = smbios_entry->smbios_count;
|
||||
smbios->version =
|
||||
SMBIOS_VERSION ( smbios_entry->major, smbios_entry->minor );
|
||||
DBG ( "Found 32-bit SMBIOS v%d.%d entry point at %p (%lx+%zx)\n",
|
||||
smbios_entry->major, smbios_entry->minor, smbios_entry,
|
||||
user_to_phys ( smbios->address, 0 ), smbios->len );
|
||||
virt_to_phys ( smbios->address ), smbios->len );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ static userptr_t efi_urealloc ( userptr_t old_ptr, size_t new_size ) {
|
||||
return UNULL;
|
||||
}
|
||||
assert ( phys_addr != 0 );
|
||||
new_ptr = phys_to_user ( phys_addr + EFI_PAGE_SIZE );
|
||||
new_ptr = phys_to_virt ( phys_addr + EFI_PAGE_SIZE );
|
||||
copy_to_user ( new_ptr, -EFI_PAGE_SIZE,
|
||||
&new_size, sizeof ( new_size ) );
|
||||
DBG ( "EFI allocated %d pages at %llx\n",
|
||||
@@ -90,7 +90,7 @@ static userptr_t efi_urealloc ( userptr_t old_ptr, size_t new_size ) {
|
||||
memcpy ( new_ptr, old_ptr,
|
||||
( (old_size < new_size) ? old_size : new_size ) );
|
||||
old_pages = ( EFI_SIZE_TO_PAGES ( old_size ) + 1 );
|
||||
phys_addr = user_to_phys ( old_ptr, -EFI_PAGE_SIZE );
|
||||
phys_addr = virt_to_phys ( old_ptr - EFI_PAGE_SIZE );
|
||||
if ( ( efirc = bs->FreePages ( phys_addr, old_pages ) ) != 0 ){
|
||||
rc = -EEFI ( efirc );
|
||||
DBG ( "EFI could not free %d pages at %llx: %s\n",
|
||||
|
||||
@@ -277,7 +277,7 @@ int vmbus_establish_gpadl ( struct vmbus_device *vmdev, userptr_t data,
|
||||
size_t len ) {
|
||||
struct hv_hypervisor *hv = vmdev->hv;
|
||||
struct vmbus *vmbus = hv->vmbus;
|
||||
physaddr_t addr = user_to_phys ( data, 0 );
|
||||
physaddr_t addr = virt_to_phys ( data );
|
||||
unsigned int pfn_count = hv_pfn_count ( addr, len );
|
||||
struct {
|
||||
struct vmbus_gpadl_header gpadlhdr;
|
||||
|
||||
@@ -27,6 +27,7 @@ FILE_LICENCE(GPL2_OR_LATER);
|
||||
*
|
||||
*/
|
||||
|
||||
PROVIDE_UACCESS_INLINE(linux, user_to_phys);
|
||||
PROVIDE_UACCESS_INLINE(linux, phys_to_virt);
|
||||
PROVIDE_UACCESS_INLINE(linux, virt_to_phys);
|
||||
PROVIDE_UACCESS_INLINE(linux, virt_to_user);
|
||||
PROVIDE_UACCESS_INLINE(linux, memchr_user);
|
||||
|
||||
@@ -86,14 +86,14 @@ int find_smbios_entry ( userptr_t start, size_t len,
|
||||
if ( ( sum = smbios_checksum ( start, offset,
|
||||
entry->len ) ) != 0 ) {
|
||||
DBG ( "SMBIOS at %08lx has bad checksum %02x\n",
|
||||
user_to_phys ( start, offset ), sum );
|
||||
virt_to_phys ( start + offset ), sum );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Fill result structure */
|
||||
DBG ( "Found SMBIOS v%d.%d entry point at %08lx\n",
|
||||
entry->major, entry->minor,
|
||||
user_to_phys ( start, offset ) );
|
||||
virt_to_phys ( start + offset ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -126,14 +126,14 @@ int find_smbios3_entry ( userptr_t start, size_t len,
|
||||
if ( ( sum = smbios_checksum ( start, offset,
|
||||
entry->len ) ) != 0 ) {
|
||||
DBG ( "SMBIOS3 at %08lx has bad checksum %02x\n",
|
||||
user_to_phys ( start, offset ), sum );
|
||||
virt_to_phys ( start + offset ), sum );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Fill result structure */
|
||||
DBG ( "Found SMBIOS3 v%d.%d entry point at %08lx\n",
|
||||
entry->major, entry->minor,
|
||||
user_to_phys ( start, offset ) );
|
||||
virt_to_phys ( start + offset ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user