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