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