17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 23*360e6f5eSmathue * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*360e6f5eSmathue * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_DADA_IMPL_UDCD_H 287c478bd9Sstevel@tonic-gate #define _SYS_DADA_IMPL_UDCD_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* 377c478bd9Sstevel@tonic-gate * definition for user dcd command structure 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate struct udcd_cmd { 417c478bd9Sstevel@tonic-gate uchar_t udcd_error_reg; /* The error register value */ 427c478bd9Sstevel@tonic-gate uchar_t udcd_status_reg; /* The status register */ 437c478bd9Sstevel@tonic-gate ushort_t udcd_status; /* The resulting status */ 447c478bd9Sstevel@tonic-gate ushort_t udcd_timeout; /* Timeout value for completion */ 457c478bd9Sstevel@tonic-gate int udcd_flags; /* Flags for specifying read,write etc. */ 467c478bd9Sstevel@tonic-gate uint_t udcd_resid; /* This is the resid */ 477c478bd9Sstevel@tonic-gate uint_t udcd_buflen; /* Size of the io request */ 487c478bd9Sstevel@tonic-gate caddr_t udcd_bufaddr; /* Place to take the data or put the data in */ 497c478bd9Sstevel@tonic-gate struct dcd_cmd *udcd_cmd; /* Command to be sent out */ 507c478bd9Sstevel@tonic-gate caddr_t udcd_reserved; /* reserved for future use */ 517c478bd9Sstevel@tonic-gate uint_t version_no; /* Version number for this struct */ 527c478bd9Sstevel@tonic-gate }; 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 557c478bd9Sstevel@tonic-gate struct udcd_cmd32 { 567c478bd9Sstevel@tonic-gate uchar_t udcd_error_reg; /* The error register value */ 577c478bd9Sstevel@tonic-gate uchar_t udcd_status_reg; /* The status register */ 587c478bd9Sstevel@tonic-gate ushort_t udcd_status; /* The resulting status */ 597c478bd9Sstevel@tonic-gate ushort_t udcd_timeout; /* Timeout value for completion */ 607c478bd9Sstevel@tonic-gate int udcd_flags; /* Flags for specifying read,write etc. */ 617c478bd9Sstevel@tonic-gate uint_t udcd_resid; /* This is the resid */ 627c478bd9Sstevel@tonic-gate uint_t udcd_buflen; /* Size of the io request */ 637c478bd9Sstevel@tonic-gate caddr32_t udcd_bufaddr; /* Place to take the data or put the data in */ 647c478bd9Sstevel@tonic-gate caddr32_t udcd_cmd; /* Command to be sent out */ 657c478bd9Sstevel@tonic-gate caddr32_t udcd_reserved; /* reserved for future use */ 667c478bd9Sstevel@tonic-gate uint_t version_no; /* Version number for this struct */ 677c478bd9Sstevel@tonic-gate }; 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate #define udcd_cmd32toudcd_cmd(u32, ucmd) \ 707c478bd9Sstevel@tonic-gate ucmd->udcd_error_reg = u32->udcd_error_reg; \ 717c478bd9Sstevel@tonic-gate ucmd->udcd_status_reg = u32->udcd_status_reg; \ 727c478bd9Sstevel@tonic-gate ucmd->udcd_status = u32->udcd_status; \ 737c478bd9Sstevel@tonic-gate ucmd->udcd_timeout = u32->udcd_timeout; \ 747c478bd9Sstevel@tonic-gate ucmd->udcd_flags = u32->udcd_flags; \ 757c478bd9Sstevel@tonic-gate ucmd->udcd_resid = u32->udcd_resid; \ 767c478bd9Sstevel@tonic-gate ucmd->udcd_buflen = u32->udcd_buflen; \ 77*360e6f5eSmathue ucmd->udcd_bufaddr = (caddr_t)(uintptr_t)u32->udcd_bufaddr; \ 78*360e6f5eSmathue ucmd->udcd_cmd = (struct dcd_cmd *)(uintptr_t)u32->udcd_cmd; \ 79*360e6f5eSmathue ucmd->udcd_reserved = (caddr_t)(uintptr_t)u32->udcd_reserved; \ 807c478bd9Sstevel@tonic-gate ucmd->version_no = u32->version_no; 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate #define udcd_cmdtoudcd_cmd32(ucmd, u32) \ 837c478bd9Sstevel@tonic-gate u32->udcd_error_reg = ucmd->udcd_error_reg; \ 847c478bd9Sstevel@tonic-gate u32->udcd_status_reg = ucmd->udcd_status_reg; \ 857c478bd9Sstevel@tonic-gate u32->udcd_status = ucmd->udcd_status; \ 867c478bd9Sstevel@tonic-gate u32->udcd_timeout = ucmd->udcd_timeout; \ 877c478bd9Sstevel@tonic-gate u32->udcd_flags = ucmd->udcd_flags; \ 887c478bd9Sstevel@tonic-gate u32->udcd_resid = ucmd->udcd_resid; \ 897c478bd9Sstevel@tonic-gate u32->udcd_buflen = ucmd->udcd_buflen; \ 90*360e6f5eSmathue u32->udcd_bufaddr = (caddr32_t)(uintptr_t)ucmd->udcd_bufaddr; \ 91*360e6f5eSmathue u32->udcd_cmd = (caddr32_t)(uintptr_t)ucmd->udcd_cmd; \ 92*360e6f5eSmathue u32->udcd_reserved = (caddr32_t)(uintptr_t)ucmd->udcd_reserved; \ 937c478bd9Sstevel@tonic-gate u32->version_no = ucmd->version_no; 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate /* 997c478bd9Sstevel@tonic-gate * Flags for the Udcd_flags field 1007c478bd9Sstevel@tonic-gate */ 1017c478bd9Sstevel@tonic-gate #define UDCD_WRITE 0x00000 /* Send data to device */ 1027c478bd9Sstevel@tonic-gate #define UDCD_SILENT 0x00001 /* no error messages */ 1037c478bd9Sstevel@tonic-gate #define UDCD_DIAGNOSE 0x00002 /* Fail of any error occurs */ 1047c478bd9Sstevel@tonic-gate #define UDCD_ISOLATE 0x00004 /* isolate from normal command */ 1057c478bd9Sstevel@tonic-gate #define UDCD_READ 0x00008 /* Read data from device */ 1067c478bd9Sstevel@tonic-gate #define UDCD_NOINTR 0x00040 /* No interrupts */ 1077c478bd9Sstevel@tonic-gate #define UDCD_RESET 0x04000 /* Reset the target */ 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate /* 1117c478bd9Sstevel@tonic-gate * User ATA io control command 1127c478bd9Sstevel@tonic-gate */ 1137c478bd9Sstevel@tonic-gate #define UDCDIOC (0x05 << 8) 1147c478bd9Sstevel@tonic-gate #define UDCDCMD (UDCDIOC|201) /* User dcd command */ 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1177c478bd9Sstevel@tonic-gate } 1187c478bd9Sstevel@tonic-gate #endif 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate #endif /* _SYS_DADA_IMPL_UDCD_H */ 121