1b2dc47b4SNicolas Souchu /*- 2*718cf2ccSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*718cf2ccSPedro F. Giffuni * 4b2dc47b4SNicolas Souchu * Copyright (c) 1998 Nicolas Souchu 5b2dc47b4SNicolas Souchu * All rights reserved. 6b2dc47b4SNicolas Souchu * 7b2dc47b4SNicolas Souchu * Redistribution and use in source and binary forms, with or without 8b2dc47b4SNicolas Souchu * modification, are permitted provided that the following conditions 9b2dc47b4SNicolas Souchu * are met: 10b2dc47b4SNicolas Souchu * 1. Redistributions of source code must retain the above copyright 11b2dc47b4SNicolas Souchu * notice, this list of conditions and the following disclaimer. 12b2dc47b4SNicolas Souchu * 2. Redistributions in binary form must reproduce the above copyright 13b2dc47b4SNicolas Souchu * notice, this list of conditions and the following disclaimer in the 14b2dc47b4SNicolas Souchu * documentation and/or other materials provided with the distribution. 15b2dc47b4SNicolas Souchu * 16b2dc47b4SNicolas Souchu * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17b2dc47b4SNicolas Souchu * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18b2dc47b4SNicolas Souchu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19b2dc47b4SNicolas Souchu * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20b2dc47b4SNicolas Souchu * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21b2dc47b4SNicolas Souchu * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22b2dc47b4SNicolas Souchu * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23b2dc47b4SNicolas Souchu * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24b2dc47b4SNicolas Souchu * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25b2dc47b4SNicolas Souchu * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26b2dc47b4SNicolas Souchu * SUCH DAMAGE. 27b2dc47b4SNicolas Souchu * 28c3aac50fSPeter Wemm * $FreeBSD$ 29b2dc47b4SNicolas Souchu * 30b2dc47b4SNicolas Souchu */ 31b2dc47b4SNicolas Souchu #ifndef __SMB_H 32b2dc47b4SNicolas Souchu #define __SMB_H 33b2dc47b4SNicolas Souchu 34b2dc47b4SNicolas Souchu #include <sys/ioccom.h> 35b2dc47b4SNicolas Souchu 36b2dc47b4SNicolas Souchu struct smbcmd { 37202379afSMichael Gmelin u_char cmd; 38202379afSMichael Gmelin u_char reserved; 39202379afSMichael Gmelin u_short op; 40b2dc47b4SNicolas Souchu union { 41b2dc47b4SNicolas Souchu char byte; 42202379afSMichael Gmelin char buf[2]; 43b2dc47b4SNicolas Souchu short word; 44202379afSMichael Gmelin } wdata; 45202379afSMichael Gmelin union { 46202379afSMichael Gmelin char byte; 47202379afSMichael Gmelin char buf[2]; 48202379afSMichael Gmelin short word; 49202379afSMichael Gmelin } rdata; 50202379afSMichael Gmelin int slave; 51202379afSMichael Gmelin char *wbuf; /* use wdata if NULL */ 52202379afSMichael Gmelin int wcount; 53202379afSMichael Gmelin char *rbuf; /* use rdata if NULL */ 54202379afSMichael Gmelin int rcount; 55b2dc47b4SNicolas Souchu }; 56b2dc47b4SNicolas Souchu 57add37e1eSJoerg Wunsch /* 58add37e1eSJoerg Wunsch * SMBus spec 2.0 says block transfers may be at most 32 bytes. 59add37e1eSJoerg Wunsch */ 6019a8946bSAndriy Gapon #define SMB_MAXBLOCKSIZE 32 61add37e1eSJoerg Wunsch 62bf896bd0SNicolas Souchu #define SMB_QUICK_WRITE _IOW('i', 1, struct smbcmd) 63bf896bd0SNicolas Souchu #define SMB_QUICK_READ _IOW('i', 2, struct smbcmd) 64b2dc47b4SNicolas Souchu #define SMB_SENDB _IOW('i', 3, struct smbcmd) 65add37e1eSJoerg Wunsch #define SMB_RECVB _IOWR('i', 4, struct smbcmd) 66b2dc47b4SNicolas Souchu #define SMB_WRITEB _IOW('i', 5, struct smbcmd) 67b2dc47b4SNicolas Souchu #define SMB_WRITEW _IOW('i', 6, struct smbcmd) 68f43618f5SAndriy Gapon #define SMB_READB _IOWR('i', 7, struct smbcmd) 69f43618f5SAndriy Gapon #define SMB_READW _IOWR('i', 8, struct smbcmd) 70f43618f5SAndriy Gapon #define SMB_PCALL _IOWR('i', 9, struct smbcmd) 71b2dc47b4SNicolas Souchu #define SMB_BWRITE _IOW('i', 10, struct smbcmd) 727048a99cSJohn Baldwin #define SMB_BREAD _IOWR('i', 11, struct smbcmd) 7319a8946bSAndriy Gapon #define SMB_OLD_TRANS _IOWR('i', 12, struct smbcmd) 74b2dc47b4SNicolas Souchu 75b2dc47b4SNicolas Souchu #endif 76