diff options
Diffstat (limited to 'src/drivers/block')
| -rw-r--r-- | src/drivers/block/ata.c | 31 | ||||
| -rw-r--r-- | src/drivers/block/ibft.c | 1 | ||||
| -rw-r--r-- | src/drivers/block/scsi.c | 17 | ||||
| -rw-r--r-- | src/drivers/block/srp.c | 4 |
4 files changed, 28 insertions, 25 deletions
diff --git a/src/drivers/block/ata.c b/src/drivers/block/ata.c index b1c6855a0..ee2acdebb 100644 --- a/src/drivers/block/ata.c +++ b/src/drivers/block/ata.c @@ -22,6 +22,7 @@ */ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); +FILE_SECBOOT ( PERMITTED ); #include <stddef.h> #include <stdlib.h> @@ -147,8 +148,8 @@ struct ata_command_type { * @ret data_in Data-in buffer * @ret data_in_len Data-in buffer length */ - void ( * data_in ) ( struct ata_command *atacmd, userptr_t buffer, - size_t len, userptr_t *data_in, + void ( * data_in ) ( struct ata_command *atacmd, void *buffer, + size_t len, void **data_in, size_t *data_in_len ); /** * Calculate data-out buffer @@ -160,8 +161,8 @@ struct ata_command_type { * @ret data_out Data-out buffer * @ret data_out_len Data-out buffer length */ - void ( * data_out ) ( struct ata_command *atacmd, userptr_t buffer, - size_t len, userptr_t *data_out, + void ( * data_out ) ( struct ata_command *atacmd, void *buffer, + size_t len, void **data_out, size_t *data_out_len ); /** * Handle ATA command completion @@ -285,8 +286,8 @@ static void atacmd_done ( struct ata_command *atacmd, int rc ) { * @ret data_len Data buffer length */ static void atacmd_data_buffer ( struct ata_command *atacmd __unused, - userptr_t buffer, size_t len, - userptr_t *data, size_t *data_len ) { + void *buffer, size_t len, + void **data, size_t *data_len ) { *data = buffer; *data_len = len; } @@ -301,8 +302,8 @@ static void atacmd_data_buffer ( struct ata_command *atacmd __unused, * @ret data_len Data buffer length */ static void atacmd_data_none ( struct ata_command *atacmd __unused, - userptr_t buffer __unused, size_t len __unused, - userptr_t *data __unused, + void *buffer __unused, size_t len __unused, + void **data __unused, size_t *data_len __unused ) { /* Nothing to do */ } @@ -317,9 +318,9 @@ static void atacmd_data_none ( struct ata_command *atacmd __unused, * @ret data_len Data buffer length */ static void atacmd_data_priv ( struct ata_command *atacmd, - userptr_t buffer __unused, size_t len __unused, - userptr_t *data, size_t *data_len ) { - *data = virt_to_user ( atacmd_priv ( atacmd ) ); + void *buffer __unused, size_t len __unused, + void **data, size_t *data_len ) { + *data = atacmd_priv ( atacmd ); *data_len = atacmd->type->priv_len; } @@ -455,7 +456,7 @@ static int atadev_command ( struct ata_device *atadev, struct interface *block, struct ata_command_type *type, uint64_t lba, unsigned int count, - userptr_t buffer, size_t len ) { + void *buffer, size_t len ) { struct ata_command *atacmd; struct ata_cmd command; int tag; @@ -543,7 +544,7 @@ static int atadev_command ( struct ata_device *atadev, static int atadev_read ( struct ata_device *atadev, struct interface *block, uint64_t lba, unsigned int count, - userptr_t buffer, size_t len ) { + void *buffer, size_t len ) { return atadev_command ( atadev, block, &atacmd_read, lba, count, buffer, len ); } @@ -562,7 +563,7 @@ static int atadev_read ( struct ata_device *atadev, static int atadev_write ( struct ata_device *atadev, struct interface *block, uint64_t lba, unsigned int count, - userptr_t buffer, size_t len ) { + void *buffer, size_t len ) { return atadev_command ( atadev, block, &atacmd_write, lba, count, buffer, len ); } @@ -581,7 +582,7 @@ static int atadev_read_capacity ( struct ata_device *atadev, assert ( atacmd_identify.priv_len == sizeof ( *identity ) ); assert ( atacmd_identify.priv_len == ATA_SECTOR_SIZE ); return atadev_command ( atadev, block, &atacmd_identify, - 0, 1, UNULL, ATA_SECTOR_SIZE ); + 0, 1, NULL, ATA_SECTOR_SIZE ); } /** diff --git a/src/drivers/block/ibft.c b/src/drivers/block/ibft.c index ca5fad9ff..6120b37dd 100644 --- a/src/drivers/block/ibft.c +++ b/src/drivers/block/ibft.c @@ -26,6 +26,7 @@ */ FILE_LICENCE ( BSD2 ); +FILE_SECBOOT ( PERMITTED ); #include <stdint.h> #include <stdlib.h> diff --git a/src/drivers/block/scsi.c b/src/drivers/block/scsi.c index ff415f5c6..67bf48201 100644 --- a/src/drivers/block/scsi.c +++ b/src/drivers/block/scsi.c @@ -22,6 +22,7 @@ */ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); +FILE_SECBOOT ( PERMITTED ); #include <stddef.h> #include <stdlib.h> @@ -279,7 +280,7 @@ struct scsi_command { /** Number of blocks */ unsigned int count; /** Data buffer */ - userptr_t buffer; + void *buffer; /** Length of data buffer */ size_t len; /** Command tag */ @@ -591,12 +592,12 @@ static void scsicmd_read_capacity_cmd ( struct scsi_command *scsicmd, readcap16->service_action = SCSI_SERVICE_ACTION_READ_CAPACITY_16; readcap16->len = cpu_to_be32 ( sizeof ( *capacity16 ) ); - command->data_in = virt_to_user ( capacity16 ); + command->data_in = capacity16; command->data_in_len = sizeof ( *capacity16 ); } else { /* Use READ CAPACITY (10) */ readcap10->opcode = SCSI_OPCODE_READ_CAPACITY_10; - command->data_in = virt_to_user ( capacity10 ); + command->data_in = capacity10; command->data_in_len = sizeof ( *capacity10 ); } } @@ -721,7 +722,7 @@ static int scsidev_command ( struct scsi_device *scsidev, struct interface *block, struct scsi_command_type *type, uint64_t lba, unsigned int count, - userptr_t buffer, size_t len ) { + void *buffer, size_t len ) { struct scsi_command *scsicmd; int rc; @@ -773,7 +774,7 @@ static int scsidev_command ( struct scsi_device *scsidev, static int scsidev_read ( struct scsi_device *scsidev, struct interface *block, uint64_t lba, unsigned int count, - userptr_t buffer, size_t len ) { + void *buffer, size_t len ) { return scsidev_command ( scsidev, block, &scsicmd_read, lba, count, buffer, len ); } @@ -792,7 +793,7 @@ static int scsidev_read ( struct scsi_device *scsidev, static int scsidev_write ( struct scsi_device *scsidev, struct interface *block, uint64_t lba, unsigned int count, - userptr_t buffer, size_t len ) { + void *buffer, size_t len ) { return scsidev_command ( scsidev, block, &scsicmd_write, lba, count, buffer, len ); } @@ -807,7 +808,7 @@ static int scsidev_write ( struct scsi_device *scsidev, static int scsidev_read_capacity ( struct scsi_device *scsidev, struct interface *block ) { return scsidev_command ( scsidev, block, &scsicmd_read_capacity, - 0, 0, UNULL, 0 ); + 0, 0, NULL, 0 ); } /** @@ -820,7 +821,7 @@ static int scsidev_read_capacity ( struct scsi_device *scsidev, static int scsidev_test_unit_ready ( struct scsi_device *scsidev, struct interface *block ) { return scsidev_command ( scsidev, block, &scsicmd_test_unit_ready, - 0, 0, UNULL, 0 ); + 0, 0, NULL, 0 ); } /** diff --git a/src/drivers/block/srp.c b/src/drivers/block/srp.c index ab4812519..c12f230f7 100644 --- a/src/drivers/block/srp.c +++ b/src/drivers/block/srp.c @@ -428,7 +428,7 @@ static int srp_cmd ( struct srp_device *srpdev, cmd->data_buffer_formats |= SRP_CMD_DO_FMT_DIRECT; data_out = iob_put ( iobuf, sizeof ( *data_out ) ); data_out->address = - cpu_to_be64 ( user_to_phys ( command->data_out, 0 ) ); + cpu_to_be64 ( virt_to_phys ( command->data_out ) ); data_out->handle = ntohl ( srpdev->memory_handle ); data_out->len = ntohl ( command->data_out_len ); } @@ -438,7 +438,7 @@ static int srp_cmd ( struct srp_device *srpdev, cmd->data_buffer_formats |= SRP_CMD_DI_FMT_DIRECT; data_in = iob_put ( iobuf, sizeof ( *data_in ) ); data_in->address = - cpu_to_be64 ( user_to_phys ( command->data_in, 0 ) ); + cpu_to_be64 ( virt_to_phys ( command->data_in ) ); data_in->handle = ntohl ( srpdev->memory_handle ); data_in->len = ntohl ( command->data_in_len ); } |
