VirtualBox

source: vbox/trunk/src/VBox/Devices/Storage/ATAPIPassthrough.h@ 76565

Last change on this file since 76565 was 76565, checked in by vboxsync, 6 years ago

Devices: Use VBOX_INCLUDED_SRC_ as header guard prefix with scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: ATAPIPassthrough.h 76565 2019-01-01 04:23:20Z vboxsync $ */
2/** @file
3 * VBox storage devices: ATAPI passthrough helpers (common code for DevATA and DevAHCI).
4 */
5
6/*
7 * Copyright (C) 2012-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef VBOX_INCLUDED_SRC_Storage_ATAPIPassthrough_h
19#define VBOX_INCLUDED_SRC_Storage_ATAPIPassthrough_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <VBox/cdefs.h>
25#include <VBox/vmm/pdmifs.h>
26#include <VBox/vmm/pdmstorageifs.h>
27
28RT_C_DECLS_BEGIN
29
30/**
31 * Opaque media track list.
32 */
33typedef struct TRACKLIST *PTRACKLIST;
34
35/**
36 * Creates an empty track list handle.
37 *
38 * @returns VBox status code.
39 * @param ppTrackList Where to store the track list handle on success.
40 */
41DECLHIDDEN(int) ATAPIPassthroughTrackListCreateEmpty(PTRACKLIST *ppTrackList);
42
43/**
44 * Destroys the allocated task list handle.
45 *
46 * @returns nothing.
47 * @param pTrackList The track list handle to destroy.
48 */
49DECLHIDDEN(void) ATAPIPassthroughTrackListDestroy(PTRACKLIST pTrackList);
50
51/**
52 * Clears all tracks from the given task list.
53 *
54 * @returns nothing.
55 * @param pTrackList The track list to clear.
56 */
57DECLHIDDEN(void) ATAPIPassthroughTrackListClear(PTRACKLIST pTrackList);
58
59/**
60 * Updates the track list from the given CDB and data buffer.
61 *
62 * @returns VBox status code.
63 * @param pTrackList The track list to update.
64 * @param pCDB The CDB buffer.
65 * @param pvBuf The data buffer.
66 */
67DECLHIDDEN(int) ATAPIPassthroughTrackListUpdate(PTRACKLIST pTrackList, const uint8_t *pCDB, const void *pvBuf);
68
69/**
70 * Return the sector size from the track matching the LBA in the given track list.
71 *
72 * @returns Sector size.
73 * @param pTrackList The track list to use.
74 * @param iAtapiLba The start LBA to get the sector size for.
75 */
76DECLHIDDEN(uint32_t) ATAPIPassthroughTrackListGetSectorSizeFromLba(PTRACKLIST pTrackList, uint32_t iAtapiLba);
77
78/**
79 * Parses the given CDB and returns whether it is safe to pass it through to the host drive.
80 *
81 * @returns Flag whether passing the CDB through to the host drive is safe.
82 * @param pbCdb The CDB to parse.
83 * @param cbCdb Size of the CDB in bytes.
84 * @param cbBuf Size of the guest buffer.
85 * @param pTrackList The track list for the current medium if available (optional).
86 * @param pbSense Pointer to the sense buffer.
87 * @param cbSense Size of the sense buffer.
88 * @param penmTxDir Where to store the transfer direction (guest to host or vice versa).
89 * @param pcbXfer Where to store the transfer size encoded in the CDB.
90 * @param pcbSector Where to store the sector size used for the transfer.
91 * @param pu8ScsiSts Where to store the SCSI status code.
92 */
93DECLHIDDEN(bool) ATAPIPassthroughParseCdb(const uint8_t *pbCdb, size_t cbCdb, size_t cbBuf,
94 PTRACKLIST pTrackList, uint8_t *pbSense, size_t cbSense,
95 PDMMEDIATXDIR *penmTxDir, size_t *pcbXfer,
96 size_t *pcbSector, uint8_t *pu8ScsiSts);
97
98RT_C_DECLS_END
99
100#endif /* !VBOX_INCLUDED_SRC_Storage_ATAPIPassthrough_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette