1139749Simp/*-
266703Sarchie * ichsmb_var.h
366703Sarchie *
466703Sarchie * Copyright (c) 2000 Whistle Communications, Inc.
566703Sarchie * All rights reserved.
666703Sarchie *
766703Sarchie * Subject to the following obligations and disclaimer of warranty, use and
866703Sarchie * redistribution of this software, in source or object code forms, with or
966703Sarchie * without modifications are expressly permitted by Whistle Communications;
1066703Sarchie * provided, however, that:
1166703Sarchie * 1. Any and all reproductions of the source or object code must include the
1266703Sarchie *    copyright notice above and the following disclaimer of warranties; and
1366703Sarchie * 2. No rights are granted, in any manner or form, to use Whistle
1466703Sarchie *    Communications, Inc. trademarks, including the mark "WHISTLE
1566703Sarchie *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
1666703Sarchie *    such appears in the above copyright notice or in the software.
1766703Sarchie *
1866703Sarchie * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
1966703Sarchie * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
2066703Sarchie * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
2166703Sarchie * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
2266703Sarchie * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
2366703Sarchie * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
2466703Sarchie * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
2566703Sarchie * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
2666703Sarchie * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
2766703Sarchie * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
2866703Sarchie * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
2966703Sarchie * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
3066703Sarchie * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
3166703Sarchie * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3266703Sarchie * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3366703Sarchie * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
3466703Sarchie * OF SUCH DAMAGE.
3566703Sarchie *
3666703Sarchie * Author: Archie Cobbs <archie@freebsd.org>
3766703Sarchie *
3866703Sarchie * $FreeBSD: releng/10.2/sys/dev/ichsmb/ichsmb_var.h 179622 2008-06-06 18:29:56Z jhb $
3966703Sarchie */
4066703Sarchie
4166703Sarchie#ifndef _DEV_ICHSMB_ICHSMB_VAR_H
4266703Sarchie#define _DEV_ICHSMB_ICHSMB_VAR_H
4366703Sarchie
4466703Sarchie#include "smbus_if.h"
4566703Sarchie
4666703Sarchie/* Per-device private info */
4766703Sarchiestruct ichsmb_softc {
4866703Sarchie
4966703Sarchie	/* Device/bus stuff */
5066703Sarchie	device_t		dev;		/* this device */
51147253Stakawata	device_t		smb;		/* smb device */
5266703Sarchie	struct resource		*io_res;        /* i/o port resource */
5366703Sarchie	int			io_rid;         /* i/o port bus id */
5466703Sarchie	struct resource		*irq_res;       /* interrupt resource */
5566703Sarchie	int			irq_rid;        /* interrupt bus id */
5666703Sarchie	void			*irq_handle;    /* handle for interrupt code */
5766703Sarchie
5866703Sarchie	/* Device state */
5966703Sarchie	int			ich_cmd;	/* ich command, or -1 */
6066703Sarchie	int			smb_error;	/* result of smb command */
6166703Sarchie	int			block_count;	/* count for block read/write */
6266703Sarchie	int			block_index;	/* index for block read/write */
6366703Sarchie	u_char			block_write;	/* 0=read, 1=write */
6466703Sarchie	u_char			block_data[32];	/* block read/write data */
6569689Sarchie	struct mtx		mutex;		/* device mutex */
6666703Sarchie};
6766703Sarchietypedef struct ichsmb_softc *sc_p;
6866703Sarchie
6966703Sarchie/* SMBus methods */
7066703Sarchieextern smbus_callback_t	ichsmb_callback;
7166703Sarchieextern smbus_quick_t	ichsmb_quick;
7266703Sarchieextern smbus_sendb_t	ichsmb_sendb;
7366703Sarchieextern smbus_recvb_t	ichsmb_recvb;
7466703Sarchieextern smbus_writeb_t	ichsmb_writeb;
7566703Sarchieextern smbus_writew_t	ichsmb_writew;
7666703Sarchieextern smbus_readb_t	ichsmb_readb;
7766703Sarchieextern smbus_readw_t	ichsmb_readw;
7866703Sarchieextern smbus_pcall_t	ichsmb_pcall;
7966703Sarchieextern smbus_bwrite_t	ichsmb_bwrite;
8066703Sarchieextern smbus_bread_t	ichsmb_bread;
8166703Sarchie
8266703Sarchie/* Other functions */
8366703Sarchieextern void	ichsmb_device_intr(void *cookie);
8466703Sarchieextern void	ichsmb_release_resources(sc_p sc);
8566703Sarchieextern int	ichsmb_probe(device_t dev);
8666703Sarchieextern int	ichsmb_attach(device_t dev);
87147253Stakawataextern int	ichsmb_detach(device_t dev);
8866703Sarchie
8966703Sarchie#endif /* _DEV_ICHSMB_ICHSMB_VAR_H */
9066703Sarchie
91