[81412] | 1 | /* $Id: scsi.h 100984 2023-08-28 11:09:40Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
| 3 | * PC BIOS - SCSI definitions.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2019-2023 Oracle and/or its affiliates.
|
---|
[81412] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
| 25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
[81412] | 26 | */
|
---|
| 27 |
|
---|
| 28 | #ifndef VBOX_INCLUDED_SRC_PC_BIOS_scsi_h
|
---|
| 29 | #define VBOX_INCLUDED_SRC_PC_BIOS_scsi_h
|
---|
| 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
| 33 |
|
---|
| 34 | /* Command opcodes. */
|
---|
| 35 | #define SCSI_SERVICE_ACT 0x9e
|
---|
| 36 | #define SCSI_INQUIRY 0x12
|
---|
| 37 | #define SCSI_READ_CAP_10 0x25
|
---|
| 38 | #define SCSI_READ_10 0x28
|
---|
| 39 | #define SCSI_WRITE_10 0x2a
|
---|
| 40 | #define SCSI_READ_CAP_16 0x10 /* Not an opcode by itself, sub-action for the "Service Action" */
|
---|
| 41 | #define SCSI_READ_16 0x88
|
---|
| 42 | #define SCSI_WRITE_16 0x8a
|
---|
| 43 |
|
---|
[82162] | 44 | #pragma pack(1)
|
---|
| 45 |
|
---|
| 46 | /* READ_10/WRITE_10 CDB layout. */
|
---|
| 47 | typedef struct {
|
---|
| 48 | uint16_t command; /* Command. */
|
---|
| 49 | uint32_t lba; /* LBA, MSB first! */
|
---|
| 50 | uint8_t pad1; /* Unused. */
|
---|
| 51 | uint16_t nsect; /* Sector count, MSB first! */
|
---|
| 52 | uint8_t pad2; /* Unused. */
|
---|
| 53 | } cdb_rw10;
|
---|
| 54 |
|
---|
| 55 | /* READ_16/WRITE_16 CDB layout. */
|
---|
| 56 | typedef struct {
|
---|
| 57 | uint16_t command; /* Command. */
|
---|
| 58 | uint64_t lba; /* LBA, MSB first! */
|
---|
| 59 | uint32_t nsect32; /* Sector count, MSB first! */
|
---|
| 60 | uint8_t pad1; /* Unused. */
|
---|
| 61 | uint8_t pad2; /* Unused. */
|
---|
| 62 | } cdb_rw16;
|
---|
| 63 |
|
---|
| 64 | #pragma pack()
|
---|
| 65 |
|
---|
| 66 | ct_assert(sizeof(cdb_rw10) == 10);
|
---|
| 67 | ct_assert(sizeof(cdb_rw16) == 16);
|
---|
| 68 |
|
---|
[89364] | 69 | extern int lsilogic_scsi_init(void __far *pvHba, uint8_t u8Bus, uint8_t u8DevFn);
|
---|
[89168] | 70 | extern int lsilogic_scsi_cmd_data_out(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB,
|
---|
| 71 | uint8_t cbCDB, uint8_t __far *buffer, uint32_t length);
|
---|
| 72 | extern int lsilogic_scsi_cmd_data_in(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB,
|
---|
[89364] | 73 | uint8_t cbCDB, uint8_t __far *buffer, uint32_t length);
|
---|
[89168] | 74 |
|
---|
[89364] | 75 | extern int buslogic_scsi_init(void __far *pvHba, uint8_t u8Bus, uint8_t u8DevFn);
|
---|
[89168] | 76 | extern int buslogic_scsi_cmd_data_out(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB,
|
---|
| 77 | uint8_t cbCDB, uint8_t __far *buffer, uint32_t length);
|
---|
| 78 | extern int buslogic_scsi_cmd_data_in(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB,
|
---|
[89364] | 79 | uint8_t cbCDB, uint8_t __far *buffer, uint32_t length);
|
---|
[89168] | 80 |
|
---|
[100984] | 81 | extern uint16_t btaha_scsi_detect();
|
---|
| 82 | extern int btaha_scsi_init(void __far *pvHba, uint8_t u8Bus, uint8_t u8DevFn);
|
---|
| 83 |
|
---|
[89364] | 84 | extern int virtio_scsi_init(void __far *pvHba, uint8_t u8Bus, uint8_t u8DevFn);
|
---|
[89168] | 85 | extern int virtio_scsi_cmd_data_out(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB,
|
---|
| 86 | uint8_t cbCDB, uint8_t __far *buffer, uint32_t length);
|
---|
| 87 | extern int virtio_scsi_cmd_data_in(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB,
|
---|
[89364] | 88 | uint8_t cbCDB, uint8_t __far *buffer, uint32_t length);
|
---|
[89168] | 89 |
|
---|
[81412] | 90 | #endif /* !VBOX_INCLUDED_SRC_PC_BIOS_scsi_h */
|
---|
| 91 |
|
---|