199767f8919635c4928607450d9e0abb932109ceToomas Soome/*-
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 2011 Hudson River Trading LLC
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Written by: John H. Baldwin <jhb@FreeBSD.org>
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * are met:
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
199767f8919635c4928607450d9e0abb932109ceToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * $FreeBSD$
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _EDD_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _EDD_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* Supported interfaces for "Check Extensions Present". */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EDD_INTERFACE_FIXED_DISK 0x01
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EDD_INTERFACE_EJECT 0x02
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EDD_INTERFACE_EDD 0x04
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct edd_packet {
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t len;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t count;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t off;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t seg;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint64_t lba;
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct edd_packet_v3 {
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t len;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t count;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t off;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t seg;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint64_t lba;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint64_t phys_addr;
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct edd_params {
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t len;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t flags;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t cylinders;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t heads;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t sectors_per_track;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint64_t sectors;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t sector_size;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t edd_params_seg;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t edd_params_off;
199767f8919635c4928607450d9e0abb932109ceToomas Soome} __packed;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct edd_device_path_v3 {
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t key;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint8_t len;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint8_t reserved[3];
199767f8919635c4928607450d9e0abb932109ceToomas Soome char host_bus[4];
199767f8919635c4928607450d9e0abb932109ceToomas Soome char interface[8];
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint64_t interface_path;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint64_t device_path;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint8_t reserved2[1];
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint8_t checksum;
199767f8919635c4928607450d9e0abb932109ceToomas Soome} __packed;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct edd_params_v3 {
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct edd_params params;
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct edd_device_path_v3 device_path;
199767f8919635c4928607450d9e0abb932109ceToomas Soome} __packed;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct edd_device_path_v4 {
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint16_t key;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint8_t len;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint8_t reserved[3];
199767f8919635c4928607450d9e0abb932109ceToomas Soome char host_bus[4];
199767f8919635c4928607450d9e0abb932109ceToomas Soome char interface[8];
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint64_t interface_path;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint64_t device_path[2];
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint8_t reserved2[1];
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint8_t checksum;
199767f8919635c4928607450d9e0abb932109ceToomas Soome} __packed;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct edd_params_v4 {
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct edd_params params;
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct edd_device_path_v4 device_path;
199767f8919635c4928607450d9e0abb932109ceToomas Soome} __packed;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EDD_FLAGS_DMA_BOUNDARY_HANDLING 0x0001
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EDD_FLAGS_REMOVABLE_MEDIA 0x0002
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EDD_FLAGS_WRITE_VERIFY 0x0004
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EDD_FLAGS_MEDIA_CHANGE_NOTIFICATION 0x0008
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EDD_FLAGS_LOCKABLE_MEDIA 0x0010
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EDD_FLAGS_NO_MEDIA_PRESENT 0x0020
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EDD_DEVICE_PATH_KEY 0xbedd
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_EDD_H_ */