Add a new MI attribute, pckbc_machdep_cnattach, and change pckbc_cnattach()

to only call pckbc_machdep_cnattach() if this is present.  This allows
pckbc_machdep_cnattach() to be omitted entirely on most ports, where it only
returns ENXIO anyway.

The devices with this attribute at the moment are pc(4) on i386 and bebox, and
pckbc on sparc, where pckbc_machdep_cnattach() mysteriously returns 0 rather
than ENXIO.
This commit is contained in:
bjh21 2004-02-14 14:33:28 +00:00
parent c1e3dd3d1f
commit 5aca86918f
10 changed files with 27 additions and 109 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.280 2004/02/13 11:36:09 wiz Exp $ */
/* $NetBSD: machdep.c,v 1.281 2004/02/14 14:33:28 bjh21 Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -75,7 +75,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.280 2004/02/13 11:36:09 wiz Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.281 2004/02/14 14:33:28 bjh21 Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -819,27 +819,6 @@ consinit()
#endif
}
#include "pckbc.h"
#include "pckbd.h"
#if (NPCKBC > 0) && (NPCKBD == 0)
#include <dev/ic/pckbcvar.h>
/*
* This is called by the pbkbc driver if no pckbd is configured.
* On the i386, it is used to glue in the old, deprecated console
* code. On the Alpha, it does nothing.
*/
int
pckbc_machdep_cnattach(kbctag, kbcslot)
pckbc_tag_t kbctag;
pckbc_slot_t kbcslot;
{
return (ENXIO);
}
#endif /* NPCKBC > 0 && NPCKBD == 0 */
void
cpu_startup()
{

View File

@ -1,4 +1,4 @@
# $NetBSD: files.bebox,v 1.40 2003/10/24 18:21:52 matt Exp $
# $NetBSD: files.bebox,v 1.41 2004/02/14 14:33:28 bjh21 Exp $
#
# First try for bebox specific configuration info
#
@ -90,7 +90,7 @@ define pckbcport { [irq = -1], [port = -1] }
# PC console support a la "pccons"
device pc: tty, pckbcport
attach pc at isa
device pcconskbd
device pcconskbd: pckbc_machdep_cnattach
attach pcconskbd at pckbc
file arch/bebox/isa/pccons.c pc | pcconskbd needs-flag

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.14 2004/02/09 19:37:43 bjh21 Exp $ */
/* $NetBSD: machdep.c,v 1.15 2004/02/14 14:33:28 bjh21 Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.14 2004/02/09 19:37:43 bjh21 Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.15 2004/02/14 14:33:28 bjh21 Exp $");
#include "opt_marvell.h"
#include "opt_ev64260.h"
@ -91,13 +91,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.14 2004/02/09 19:37:43 bjh21 Exp $");
void isa_intr_init(void);
#endif
#include "pckbc.h"
#if (NPCKBC > 0)
#include <dev/isa/isareg.h>
#include <dev/ic/i8042reg.h>
#include <dev/ic/pckbcvar.h>
#endif
#include "com.h"
#if (NCOM > 0)
#include <dev/ic/comreg.h>
@ -362,19 +355,6 @@ consinit(void)
#endif
}
#if (NPCKBC > 0) && (NPCKBD == 0)
/*
* glue code to support old console code with the
* mi keyboard controller driver
*/
int
pckbc_machdep_cnattach(pckbc_tag_t kbctag, pckbc_slot_t kbcslot)
{
return (ENXIO);
}
#endif
/*
* Stray interrupts.
*/

View File

@ -1,4 +1,4 @@
# $NetBSD: files.i386,v 1.247 2004/01/20 19:58:00 jdolecek Exp $
# $NetBSD: files.i386,v 1.248 2004/02/14 14:33:28 bjh21 Exp $
#
# new style config file for i386 architecture
#
@ -223,7 +223,7 @@ file arch/i386/isa/npx_isa.c npx_isa
# PC console support a la "pccons"
device pc: tty
attach pc at isa
device pcconskbd
device pcconskbd: pckbc_machdep_cnattach
attach pcconskbd at pckbc
file arch/i386/isa/pccons.c pc | pcconskbd needs-flag

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.30 2004/02/09 19:37:43 bjh21 Exp $ */
/* $NetBSD: machdep.c,v 1.31 2004/02/14 14:33:29 bjh21 Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.30 2004/02/09 19:37:43 bjh21 Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.31 2004/02/14 14:33:29 bjh21 Exp $");
#include "opt_compat_netbsd.h"
#include "opt_ddb.h"
@ -95,13 +95,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.30 2004/02/09 19:37:43 bjh21 Exp $");
void isa_intr_init(void);
#endif
#include "pckbc.h"
#if (NPCKBC > 0)
#include <dev/isa/isareg.h>
#include <dev/ic/i8042reg.h>
#include <dev/ic/pckbcvar.h>
#endif
#include "com.h"
#if (NCOM > 0)
#include <sys/termios.h>
@ -301,19 +294,6 @@ consinit(void)
/* Of course, this is moot if there is no console... */
}
#if (NPCKBC > 0) && (NPCKBD == 0)
/*
* glue code to support old console code with the
* mi keyboard controller driver
*/
int
pckbc_machdep_cnattach(pckbc_tag_t kbctag, pckbc_slot_t kbcslot)
{
return (ENXIO);
}
#endif
/*
* Stray interrupts.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: pckbc_mace.c,v 1.2 2004/01/19 10:28:28 sekiya Exp $ */
/* $NetBSD: pckbc_mace.c,v 1.3 2004/02/14 14:33:29 bjh21 Exp $ */
/*
* Copyright (c) 2003 Christopher SEKIYA
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pckbc_mace.c,v 1.2 2004/01/19 10:28:28 sekiya Exp $");
__KERNEL_RCSID(0, "$NetBSD: pckbc_mace.c,v 1.3 2004/02/14 14:33:29 bjh21 Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -118,21 +118,6 @@ pckbc_mace_attach(parent, self, aux)
pckbc_attach(sc);
}
/* XXX */
/*
* glue code to support old console code with the
* mi keyboard controller driver
*/
int
pckbc_machdep_cnattach(kbctag, kbcslot)
pckbc_tag_t kbctag;
pckbc_slot_t kbcslot;
{
return (ENXIO);
}
void
pckbc_mace_intr_establish(sc, slot)
struct pckbc_softc *sc;

View File

@ -1,4 +1,4 @@
# $NetBSD: files.sparc,v 1.124 2003/11/15 17:52:30 bouyer Exp $
# $NetBSD: files.sparc,v 1.125 2004/02/14 14:33:29 bjh21 Exp $
# @(#)files.sparc 8.1 (Berkeley) 7/19/93
# sparc-specific configuration info
@ -162,8 +162,8 @@ include "dev/ata/files.ata"
file arch/sparc/dev/kd.c # console
attach pckbc at obio with pckbc_obio
attach pckbc at ebus with pckbc_ebus
attach pckbc at obio with pckbc_obio: pckbc_machdep_cnattach
attach pckbc at ebus with pckbc_ebus: pckbc_machdep_cnattach
file arch/sparc/dev/pckbc_js.c pckbc_obio | pckbc_ebus

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.654 2004/02/13 10:05:49 wiz Exp $
# $NetBSD: files,v 1.655 2004/02/14 14:33:29 bjh21 Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@ -658,7 +658,9 @@ file dev/ic/com.c com needs-flag
# PC-like keyboard controller
#
device pckbc { [slot = -1] }
file dev/ic/pckbc.c pckbc needs-flag
define pckbc_machdep_cnattach
file dev/ic/pckbc.c pckbc | pckbc_machdep_cnattach
needs-flag
# Cirrus Logic CD240[01] 4-port Multi-Protocol Communications Controller
#

View File

@ -1,4 +1,4 @@
# $NetBSD: DEVNAMES,v 1.149 2004/02/14 14:10:05 bjh21 Exp $
# $NetBSD: DEVNAMES,v 1.150 2004/02/14 14:33:29 bjh21 Exp $
#
# This file contains all used device names and defined attributes in
# alphabetical order. New devices added to the system somewhere should first
@ -897,6 +897,7 @@ pcic i386
pciide MI
pcivga arc
pckbc MI
pckbc_machdep_cnattach MI Attribute
pckbcport bebox Attribute
pckbcport i386 Attribute
pckbd MI

View File

@ -1,4 +1,4 @@
/* $NetBSD: pckbc.c,v 1.29 2003/12/12 22:35:13 martin Exp $ */
/* $NetBSD: pckbc.c,v 1.30 2004/02/14 14:33:29 bjh21 Exp $ */
/*
* Copyright (c) 1998
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.29 2003/12/12 22:35:13 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.30 2004/02/14 14:33:29 bjh21 Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1140,20 +1140,11 @@ pckbc_cnattach(iot, addr, cmd_offset, slot)
#if (NPCKBD > 0)
res = pckbd_cnattach(&pckbc_consdata, slot);
#else
/*
* XXX This should be replaced with the `notyet' case
* XXX when all of the old PC-style console drivers
* XXX have gone away. When that happens, all of
* XXX the pckbc_machdep_cnattach() should be purged,
* XXX as well.
*/
#ifdef notyet
res = ENXIO;
#else
#elif (NPCKBC_MACHDEP_CNATTACH > 0)
res = pckbc_machdep_cnattach(&pckbc_consdata, slot);
#endif
#endif /* NPCKBD > 0 */
#else
res = ENXIO;
#endif /* NPCKBC_MACHDEP_CNATTACH > 0 */
out:
if (res) {