/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* 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.
*/
/*
* PNPBIOS attachment for the PC Keyboard Controller driver.
*
* This is a little wonky. The keyboard controller actually
* has 2 PNPBIOS nodes: one for the controller and the keyboard
* interrupt, and one for the aux port (mouse) interrupt.
*
* For this reason, we actually attach *two* instances of this
* driver. After both of them have been found, then we attach
* sub-devices.
*/
if (pnpbios_getirqnum(aa->pbt, aa->resc, 0, &psc->sc_irq,
&psc->sc_ist) != 0) {
aprint_error_dev(self, "unable to get IRQ number or type\n");
return;
}
psc->sc_ic = aa->ic;
if (!first)
first = psc;
if (!first->sc_pckbc.id) {
if (pnpbios_getiobase(aa->pbt, aa->resc, 0, &iot, &iobase))
return;
if (pckbc_is_console(iot, iobase)) {
t = &pckbc_consdata;
ioh_d = t->t_ioh_d;
ioh_c = t->t_ioh_c;
pckbc_console_attached = 1;
/* t->t_cmdbyte was initialized by cnattach */
} else {
if (pnpbios_io_map(aa->pbt, aa->resc, 0,
&iot, &ioh_d) ||
pnpbios_io_map(aa->pbt, aa->resc, 1,
&iot, &ioh_c))
panic("pckbc_pnpbios_attach: couldn't map");