/*-
* Copyright (c) 1998 Iain Hibbert
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef MAGMA_DEBUG
#define dprintf(x) printf x
#else
#define dprintf(x)
#endif
/* The mapping of minor device number -> card and port is done as
* follows by default:
*
* +---+---+---+---+---+---+---+---+
* | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
* +---+---+---+---+---+---+---+---+
* | | | | | | | |
* | | | | +---+---+---+---> port number
* | | | |
* | | | +-------------------> unused
* | | |
* | | +-----------------------> unused
* | |
* +---+---------------------------> card number
*
*/
/*
* Supported Card Types
*/
struct magma_board_info {
const char *mb_sbusname; /* sbus_attach_args.sa_name */
const char *mb_name; /* cardname to match against */
const char *mb_realname; /* english card name */
int mb_nser; /* number of serial ports */
int mb_npar; /* number of parallel ports */
int mb_ncd1400; /* number of CD1400 chips */
int mb_svcackr; /* svcackr offset */
int mb_svcackt; /* svcackt offset */
int mb_svcackm; /* svcackm offset */
int mb_cd1400[MAGMA_MAX_CD1400];/* cd1400 chip register offsets */
int mb_ncd1190; /* number of CD1190 chips */
int mb_cd1190[MAGMA_MAX_CD1190];/* cd1190 chip register offsets */
};
/*
* cd1400 chip data
*/
struct cd1400 {
volatile u_char *cd_reg; /* chip registers */
int cd_chiprev; /* chip revision */
int cd_clock; /* clock speed in MHz */
int cd_parmode; /* parallel mode operation */
};
/* software state for each card */
struct magma_softc {
device_t ms_dev; /* required. must be first in softc */
struct evcnt ms_intrcnt; /* statistics */
/* cd1400 chip info */
int ms_ncd1400;
struct cd1400 ms_cd1400[MAGMA_MAX_CD1400];
volatile u_char *ms_svcackr; /* CD1400 service acknowledge receive */
volatile u_char *ms_svcackt; /* CD1400 service acknowledge transmit */
volatile u_char *ms_svcackm; /* CD1400 service acknowledge modem */
/* cd1190 chip info */
int ms_ncd1190;
struct cd1190 ms_cd1190[MAGMA_MAX_CD1190];
struct magma_board_info *ms_board; /* what am I? */