10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*796Smathue * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*796Smathue * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _SYS_DADA_IMPL_UDCD_H 280Sstevel@tonic-gate #define _SYS_DADA_IMPL_UDCD_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifdef __cplusplus 330Sstevel@tonic-gate extern "C" { 340Sstevel@tonic-gate #endif 350Sstevel@tonic-gate 360Sstevel@tonic-gate /* 370Sstevel@tonic-gate * definition for user dcd command structure 380Sstevel@tonic-gate */ 390Sstevel@tonic-gate 400Sstevel@tonic-gate struct udcd_cmd { 410Sstevel@tonic-gate uchar_t udcd_error_reg; /* The error register value */ 420Sstevel@tonic-gate uchar_t udcd_status_reg; /* The status register */ 430Sstevel@tonic-gate ushort_t udcd_status; /* The resulting status */ 440Sstevel@tonic-gate ushort_t udcd_timeout; /* Timeout value for completion */ 450Sstevel@tonic-gate int udcd_flags; /* Flags for specifying read,write etc. */ 460Sstevel@tonic-gate uint_t udcd_resid; /* This is the resid */ 470Sstevel@tonic-gate uint_t udcd_buflen; /* Size of the io request */ 480Sstevel@tonic-gate caddr_t udcd_bufaddr; /* Place to take the data or put the data in */ 490Sstevel@tonic-gate struct dcd_cmd *udcd_cmd; /* Command to be sent out */ 500Sstevel@tonic-gate caddr_t udcd_reserved; /* reserved for future use */ 510Sstevel@tonic-gate uint_t version_no; /* Version number for this struct */ 520Sstevel@tonic-gate }; 530Sstevel@tonic-gate 540Sstevel@tonic-gate #if defined(_SYSCALL32) 550Sstevel@tonic-gate struct udcd_cmd32 { 560Sstevel@tonic-gate uchar_t udcd_error_reg; /* The error register value */ 570Sstevel@tonic-gate uchar_t udcd_status_reg; /* The status register */ 580Sstevel@tonic-gate ushort_t udcd_status; /* The resulting status */ 590Sstevel@tonic-gate ushort_t udcd_timeout; /* Timeout value for completion */ 600Sstevel@tonic-gate int udcd_flags; /* Flags for specifying read,write etc. */ 610Sstevel@tonic-gate uint_t udcd_resid; /* This is the resid */ 620Sstevel@tonic-gate uint_t udcd_buflen; /* Size of the io request */ 630Sstevel@tonic-gate caddr32_t udcd_bufaddr; /* Place to take the data or put the data in */ 640Sstevel@tonic-gate caddr32_t udcd_cmd; /* Command to be sent out */ 650Sstevel@tonic-gate caddr32_t udcd_reserved; /* reserved for future use */ 660Sstevel@tonic-gate uint_t version_no; /* Version number for this struct */ 670Sstevel@tonic-gate }; 680Sstevel@tonic-gate 690Sstevel@tonic-gate #define udcd_cmd32toudcd_cmd(u32, ucmd) \ 700Sstevel@tonic-gate ucmd->udcd_error_reg = u32->udcd_error_reg; \ 710Sstevel@tonic-gate ucmd->udcd_status_reg = u32->udcd_status_reg; \ 720Sstevel@tonic-gate ucmd->udcd_status = u32->udcd_status; \ 730Sstevel@tonic-gate ucmd->udcd_timeout = u32->udcd_timeout; \ 740Sstevel@tonic-gate ucmd->udcd_flags = u32->udcd_flags; \ 750Sstevel@tonic-gate ucmd->udcd_resid = u32->udcd_resid; \ 760Sstevel@tonic-gate ucmd->udcd_buflen = u32->udcd_buflen; \ 77*796Smathue ucmd->udcd_bufaddr = (caddr_t)(uintptr_t)u32->udcd_bufaddr; \ 78*796Smathue ucmd->udcd_cmd = (struct dcd_cmd *)(uintptr_t)u32->udcd_cmd; \ 79*796Smathue ucmd->udcd_reserved = (caddr_t)(uintptr_t)u32->udcd_reserved; \ 800Sstevel@tonic-gate ucmd->version_no = u32->version_no; 810Sstevel@tonic-gate 820Sstevel@tonic-gate #define udcd_cmdtoudcd_cmd32(ucmd, u32) \ 830Sstevel@tonic-gate u32->udcd_error_reg = ucmd->udcd_error_reg; \ 840Sstevel@tonic-gate u32->udcd_status_reg = ucmd->udcd_status_reg; \ 850Sstevel@tonic-gate u32->udcd_status = ucmd->udcd_status; \ 860Sstevel@tonic-gate u32->udcd_timeout = ucmd->udcd_timeout; \ 870Sstevel@tonic-gate u32->udcd_flags = ucmd->udcd_flags; \ 880Sstevel@tonic-gate u32->udcd_resid = ucmd->udcd_resid; \ 890Sstevel@tonic-gate u32->udcd_buflen = ucmd->udcd_buflen; \ 90*796Smathue u32->udcd_bufaddr = (caddr32_t)(uintptr_t)ucmd->udcd_bufaddr; \ 91*796Smathue u32->udcd_cmd = (caddr32_t)(uintptr_t)ucmd->udcd_cmd; \ 92*796Smathue u32->udcd_reserved = (caddr32_t)(uintptr_t)ucmd->udcd_reserved; \ 930Sstevel@tonic-gate u32->version_no = ucmd->version_no; 940Sstevel@tonic-gate 950Sstevel@tonic-gate #endif /* _SYSCALL32 */ 960Sstevel@tonic-gate 970Sstevel@tonic-gate 980Sstevel@tonic-gate /* 990Sstevel@tonic-gate * Flags for the Udcd_flags field 1000Sstevel@tonic-gate */ 1010Sstevel@tonic-gate #define UDCD_WRITE 0x00000 /* Send data to device */ 1020Sstevel@tonic-gate #define UDCD_SILENT 0x00001 /* no error messages */ 1030Sstevel@tonic-gate #define UDCD_DIAGNOSE 0x00002 /* Fail of any error occurs */ 1040Sstevel@tonic-gate #define UDCD_ISOLATE 0x00004 /* isolate from normal command */ 1050Sstevel@tonic-gate #define UDCD_READ 0x00008 /* Read data from device */ 1060Sstevel@tonic-gate #define UDCD_NOINTR 0x00040 /* No interrupts */ 1070Sstevel@tonic-gate #define UDCD_RESET 0x04000 /* Reset the target */ 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate /* 1110Sstevel@tonic-gate * User ATA io control command 1120Sstevel@tonic-gate */ 1130Sstevel@tonic-gate #define UDCDIOC (0x05 << 8) 1140Sstevel@tonic-gate #define UDCDCMD (UDCDIOC|201) /* User dcd command */ 1150Sstevel@tonic-gate 1160Sstevel@tonic-gate #ifdef __cplusplus 1170Sstevel@tonic-gate } 1180Sstevel@tonic-gate #endif 1190Sstevel@tonic-gate 1200Sstevel@tonic-gate #endif /* _SYS_DADA_IMPL_UDCD_H */ 121