diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2015-07-07 11:24:27 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2015-07-14 14:40:08 -0400 |
commit | 0e5c7709288944336a6a16beb851d5df5667a77b (patch) | |
tree | 13df303e8e0dec86e1ee5c40a2a1378715310af4 /src/hw/ahci.c | |
parent | 91f892314dbcf6c83658a0bd5d16118f5cc1db7e (diff) | |
download | seabios-0e5c7709288944336a6a16beb851d5df5667a77b.tar.gz |
ahci: Handle AHCI ATAPI drives directly via 'struct disk_op_s' requests
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/hw/ahci.c')
-rw-r--r-- | src/hw/ahci.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/hw/ahci.c b/src/hw/ahci.c index ad813cec..726fe25e 100644 --- a/src/hw/ahci.c +++ b/src/hw/ahci.c @@ -213,7 +213,7 @@ static int ahci_command(struct ahci_port_s *port_gf, int iswrite, int isatapi, #define CDROM_CDB_SIZE 12 -int ahci_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize) +int ahci_atapi_process_op(struct disk_op_s *op) { if (! CONFIG_AHCI) return 0; @@ -221,15 +221,14 @@ int ahci_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize) struct ahci_port_s *port_gf = container_of( op->drive_gf, struct ahci_port_s, drive); struct ahci_cmd_s *cmd = port_gf->cmd; - u8 *atapi = cdbcmd; - int i, rc; + if (op->command == CMD_WRITE || op->command == CMD_FORMAT) + return DISK_RET_EWRITEPROTECT; + int blocksize = scsi_fill_cmd(op, cmd->atapi, CDROM_CDB_SIZE); + if (blocksize < 0) + return default_process_op(op); sata_prep_atapi(&cmd->fis, blocksize); - for (i = 0; i < CDROM_CDB_SIZE; i++) { - cmd->atapi[i] = atapi[i]; - } - rc = ahci_command(port_gf, 0, 1, op->buf_fl, - op->count * blocksize); + int rc = ahci_command(port_gf, 0, 1, op->buf_fl, op->count * blocksize); if (rc < 0) return DISK_RET_EBADTRACK; return DISK_RET_SUCCESS; |