17e0c71f57a604d26908610a59288adf383506bbvboxsync/* $Id$ */
17e0c71f57a604d26908610a59288adf383506bbvboxsync/** @file
17e0c71f57a604d26908610a59288adf383506bbvboxsync * VBox storage devices: ATAPI passthrough helpers (common code for DevATA and DevAHCI).
17e0c71f57a604d26908610a59288adf383506bbvboxsync */
17e0c71f57a604d26908610a59288adf383506bbvboxsync
17e0c71f57a604d26908610a59288adf383506bbvboxsync/*
17e0c71f57a604d26908610a59288adf383506bbvboxsync * Copyright (C) 2012 Oracle Corporation
17e0c71f57a604d26908610a59288adf383506bbvboxsync *
17e0c71f57a604d26908610a59288adf383506bbvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
17e0c71f57a604d26908610a59288adf383506bbvboxsync * available from http://www.virtualbox.org. This file is free software;
17e0c71f57a604d26908610a59288adf383506bbvboxsync * you can redistribute it and/or modify it under the terms of the GNU
17e0c71f57a604d26908610a59288adf383506bbvboxsync * General Public License (GPL) as published by the Free Software
17e0c71f57a604d26908610a59288adf383506bbvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
17e0c71f57a604d26908610a59288adf383506bbvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17e0c71f57a604d26908610a59288adf383506bbvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17e0c71f57a604d26908610a59288adf383506bbvboxsync */
17e0c71f57a604d26908610a59288adf383506bbvboxsync#ifndef __ATAPIPassthrough_h
17e0c71f57a604d26908610a59288adf383506bbvboxsync#define __ATAPIPassthrough_h
17e0c71f57a604d26908610a59288adf383506bbvboxsync
17e0c71f57a604d26908610a59288adf383506bbvboxsync#include <VBox/cdefs.h>
17e0c71f57a604d26908610a59288adf383506bbvboxsync
17e0c71f57a604d26908610a59288adf383506bbvboxsyncRT_C_DECLS_BEGIN
17e0c71f57a604d26908610a59288adf383506bbvboxsync
17e0c71f57a604d26908610a59288adf383506bbvboxsync/**
17e0c71f57a604d26908610a59288adf383506bbvboxsync * Opaque media track list.
17e0c71f57a604d26908610a59288adf383506bbvboxsync */
17e0c71f57a604d26908610a59288adf383506bbvboxsynctypedef struct TRACKLIST *PTRACKLIST;
17e0c71f57a604d26908610a59288adf383506bbvboxsync
17e0c71f57a604d26908610a59288adf383506bbvboxsync/**
17e0c71f57a604d26908610a59288adf383506bbvboxsync * Creates an empty track list handle.
17e0c71f57a604d26908610a59288adf383506bbvboxsync *
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @returns VBox status code.
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @param ppTrackList Where to store the track list handle on success.
17e0c71f57a604d26908610a59288adf383506bbvboxsync */
17e0c71f57a604d26908610a59288adf383506bbvboxsyncDECLHIDDEN(int) ATAPIPassthroughTrackListCreateEmpty(PTRACKLIST *ppTrackList);
17e0c71f57a604d26908610a59288adf383506bbvboxsync
17e0c71f57a604d26908610a59288adf383506bbvboxsync/**
17e0c71f57a604d26908610a59288adf383506bbvboxsync * Destroys the allocated task list handle.
17e0c71f57a604d26908610a59288adf383506bbvboxsync *
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @returns nothing.
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @param pTrackList The track list handle to destroy.
17e0c71f57a604d26908610a59288adf383506bbvboxsync */
17e0c71f57a604d26908610a59288adf383506bbvboxsyncDECLHIDDEN(void) ATAPIPassthroughTrackListDestroy(PTRACKLIST pTrackList);
17e0c71f57a604d26908610a59288adf383506bbvboxsync
17e0c71f57a604d26908610a59288adf383506bbvboxsync/**
17e0c71f57a604d26908610a59288adf383506bbvboxsync * Clears all tracks from the given task list.
17e0c71f57a604d26908610a59288adf383506bbvboxsync *
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @returns nothing.
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @param pTrackList The track list to clear.
17e0c71f57a604d26908610a59288adf383506bbvboxsync */
17e0c71f57a604d26908610a59288adf383506bbvboxsyncDECLHIDDEN(void) ATAPIPassthroughTrackListClear(PTRACKLIST pTrackList);
17e0c71f57a604d26908610a59288adf383506bbvboxsync
17e0c71f57a604d26908610a59288adf383506bbvboxsync/**
17e0c71f57a604d26908610a59288adf383506bbvboxsync * Updates the track list from the given CDB and data buffer.
17e0c71f57a604d26908610a59288adf383506bbvboxsync *
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @returns VBox status code.
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @param pTrackList The track list to update.
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @param pCDB The CDB buffer.
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @param pvBuf The data buffer.
17e0c71f57a604d26908610a59288adf383506bbvboxsync */
17e0c71f57a604d26908610a59288adf383506bbvboxsyncDECLHIDDEN(int) ATAPIPassthroughTrackListUpdate(PTRACKLIST pTrackList, const uint8_t *pCDB, const void *pvBuf);
17e0c71f57a604d26908610a59288adf383506bbvboxsync
17e0c71f57a604d26908610a59288adf383506bbvboxsync/**
17e0c71f57a604d26908610a59288adf383506bbvboxsync * Return the sector size from the track matching the LBA in the given track list.
17e0c71f57a604d26908610a59288adf383506bbvboxsync *
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @returns Sector size.
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @param pTrackList The track list to use.
17e0c71f57a604d26908610a59288adf383506bbvboxsync * @param iAtapiLba The start LBA to get the sector size for.
17e0c71f57a604d26908610a59288adf383506bbvboxsync */
17e0c71f57a604d26908610a59288adf383506bbvboxsyncDECLHIDDEN(uint32_t) ATAPIPassthroughTrackListGetSectorSizeFromLba(PTRACKLIST pTrackList, uint32_t iAtapiLba);
17e0c71f57a604d26908610a59288adf383506bbvboxsync
17e0c71f57a604d26908610a59288adf383506bbvboxsyncRT_C_DECLS_END
17e0c71f57a604d26908610a59288adf383506bbvboxsync
17e0c71f57a604d26908610a59288adf383506bbvboxsync#endif /* __ATAPIPassthrough_h */
17e0c71f57a604d26908610a59288adf383506bbvboxsync