/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Charles M. Hannum.
*
* 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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.
*/
/*-
* Copyright (c) 1991 The Regents of the University of California.
* 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
*
* @(#)com.c 7.5 (Berkeley) 5/16/91
*/
/*
* This driver attaches serial port boards and internal modems.
*/
static int ibm_modem_getcfg(struct mca_attach_args *, int *, int *);
static int neocom1_getcfg(struct mca_attach_args *, int *, int *);
static int ibm_mpcom_getcfg(struct mca_attach_args *, int *, int *);
/*
* com_cleanup: shutdown hook for buggy BIOSs that don't
* recognize the UART without a disabled FIFO.
* XXX is this necessary on MCA ? --- jdolecek
*/
if (!pmf_device_register1(self, com_suspend, com_resume, com_cleanup))
aprint_error_dev(self, "could not establish shutdown hook\n");
}
/*
* Get config for IBM Internal Modem (ID 0xEDFF). This beast doesn't
* seem to support even AT commands, it's good as example for adding
* other stuff though.
*/
static int
ibm_modem_getcfg(struct mca_attach_args *ma, int *iobasep, int *irqp)
{
int pos2;
int snum;
/*
* Get configuration for NeoTecH Single RS-232 Async. Adapter, SM110.
*/
static int
neocom1_getcfg(struct mca_attach_args *ma, int *iobasep, int *irqp)
{
int pos2, pos3, pos4;
static const int neotech_irq[] = { 12, 9, 4, 3 };
/*
* Get configuration for IBM Multi-Protocol Communications Adapter.
* We only support SERIAL mode, bail out if set to SDLC or BISYNC.
*/
static int
ibm_mpcom_getcfg(struct mca_attach_args *ma, int *iobasep, int *irqp)
{
int snum, pos2;
pos2 = mca_conf_read(ma->ma_mc, ma->ma_slot, 2);
/*
* For SERIAL mode, bit 4 has to be 0.
*
* POS register 2: (adf pos0)
* 7 6 5 4 3 2 1 0
* 0 \__/ \__ enable: 0=adapter disabled, 1=adapter enabled
* \_____ Serial Configuration: XX=SERIAL_XX
*/
if (pos2 & 0x10) {
aprint_error(": not set to SERIAL mode, ignored\n");
return (1);
}