11.11Sdyoung/* $NetBSD: opms_jazzio.c,v 1.11 2011/07/01 19:25:42 dyoung Exp $ */
21.1Ssoda
31.1Ssoda/*
41.1Ssoda * Copyright (c) 1995, 1996 Carnegie-Mellon University.
51.1Ssoda * All rights reserved.
61.1Ssoda *
71.1Ssoda * Author: Chris G. Demetriou
81.10Stsutsui *
91.1Ssoda * Permission to use, copy, modify and distribute this software and
101.1Ssoda * its documentation is hereby granted, provided that both the copyright
111.1Ssoda * notice and this permission notice appear in all copies of the
121.1Ssoda * software, derivative works or modified versions, and any portions
131.1Ssoda * thereof, and that both notices appear in supporting documentation.
141.10Stsutsui *
151.10Stsutsui * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
161.10Stsutsui * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
171.1Ssoda * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
181.10Stsutsui *
191.1Ssoda * Carnegie Mellon requests users of this software to return to
201.1Ssoda *
211.1Ssoda *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
221.1Ssoda *  School of Computer Science
231.1Ssoda *  Carnegie Mellon University
241.1Ssoda *  Pittsburgh PA 15213-3890
251.1Ssoda *
261.1Ssoda * any improvements or extensions that they make and grant Carnegie the
271.1Ssoda * rights to redistribute these changes.
281.1Ssoda */
291.4Slukem
301.4Slukem#include <sys/cdefs.h>
311.11Sdyoung__KERNEL_RCSID(0, "$NetBSD: opms_jazzio.c,v 1.11 2011/07/01 19:25:42 dyoung Exp $");
321.1Ssoda
331.1Ssoda#include <sys/param.h>
341.1Ssoda#include <sys/systm.h>
351.1Ssoda#include <sys/device.h>
361.1Ssoda#include <sys/tty.h>
371.1Ssoda
381.1Ssoda#include <machine/autoconf.h>
391.11Sdyoung#include <sys/bus.h>
401.1Ssoda
411.1Ssoda#include <arc/dev/pcconsvar.h>
421.1Ssoda#include <arc/dev/opmsvar.h>
431.1Ssoda#include <arc/jazz/jazziovar.h>
441.1Ssoda#include <arc/jazz/pccons_jazziovar.h>
451.1Ssoda
461.7Stsutsuistatic int	opms_jazzio_match(device_t, cfdata_t, void *);
471.7Stsutsuistatic void	opms_jazzio_attach(device_t, device_t, void *);
481.1Ssoda
491.7StsutsuiCFATTACH_DECL_NEW(opms_jazzio, sizeof(struct opms_softc),
501.3Sthorpej    opms_jazzio_match, opms_jazzio_attach, NULL, NULL);
511.1Ssoda
521.7Stsutsuistatic int
531.7Stsutsuiopms_jazzio_match(device_t parent, cfdata_t cf, void *aux)
541.1Ssoda{
551.1Ssoda	struct jazzio_attach_args *ja = aux;
561.1Ssoda
571.1Ssoda	if (strcmp(ja->ja_name, "pms") != 0)
581.5Stsutsui		return 0;
591.1Ssoda
601.1Ssoda	if (!opms_common_match(ja->ja_bust, &pccons_jazzio_conf))
611.5Stsutsui		return 0;
621.1Ssoda
631.5Stsutsui	return 1;
641.1Ssoda}
651.1Ssoda
661.7Stsutsuistatic void
671.7Stsutsuiopms_jazzio_attach(device_t parent, device_t self, void *aux)
681.1Ssoda{
691.7Stsutsui	struct opms_softc *sc = device_private(self);
701.1Ssoda	struct jazzio_attach_args *ja = aux;
711.1Ssoda
721.7Stsutsui	sc->sc_dev = self;
731.7Stsutsui
741.8Stsutsui	aprint_normal("\n");
751.1Ssoda
761.9Stsutsui	jazzio_intr_establish(ja->ja_intr, opmsintr, sc);
771.1Ssoda	opms_common_attach(sc, ja->ja_bust, &pccons_jazzio_conf);
781.1Ssoda}
79