xref: /openbsd-src/sys/arch/hppa/dev/phantomas.c (revision 78d5ff0ec949396ff3bbc97f51b741a17179ba18)
1*78d5ff0eSmpi /*	$OpenBSD: phantomas.c,v 1.6 2022/03/13 08:04:38 mpi Exp $	*/
2fa7c453aSmickey 
3fa7c453aSmickey /*
4fa7c453aSmickey  * Copyright (c) 2002 Michael Shalayeff
5fa7c453aSmickey  * All rights reserved.
6fa7c453aSmickey  *
7fa7c453aSmickey  * Redistribution and use in source and binary forms, with or without
8fa7c453aSmickey  * modification, are permitted provided that the following conditions
9fa7c453aSmickey  * are met:
10fa7c453aSmickey  * 1. Redistributions of source code must retain the above copyright
11fa7c453aSmickey  *    notice, this list of conditions and the following disclaimer.
12fa7c453aSmickey  * 2. Redistributions in binary form must reproduce the above copyright
13fa7c453aSmickey  *    notice, this list of conditions and the following disclaimer in the
14fa7c453aSmickey  *    documentation and/or other materials provided with the distribution.
15fa7c453aSmickey  *
16fa7c453aSmickey  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17fa7c453aSmickey  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18fa7c453aSmickey  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19fa7c453aSmickey  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
20fa7c453aSmickey  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21fa7c453aSmickey  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22fa7c453aSmickey  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23fa7c453aSmickey  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24fa7c453aSmickey  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
25fa7c453aSmickey  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26fa7c453aSmickey  * THE POSSIBILITY OF SUCH DAMAGE.
27fa7c453aSmickey  */
28fa7c453aSmickey 
29fa7c453aSmickey #include <sys/param.h>
30fa7c453aSmickey #include <sys/systm.h>
31fa7c453aSmickey #include <sys/device.h>
32fa7c453aSmickey 
33fa7c453aSmickey #include <machine/pdc.h>
34fa7c453aSmickey #include <machine/iomod.h>
35fa7c453aSmickey #include <machine/autoconf.h>
36fa7c453aSmickey 
37fa7c453aSmickey #include <hppa/dev/cpudevs.h>
38fa7c453aSmickey 
39fa7c453aSmickey struct cfdriver phantomas_cd = {
40fa7c453aSmickey 	NULL, "phantomas", DV_DULL
41fa7c453aSmickey };
42fa7c453aSmickey 
43fa7c453aSmickey struct phantomas_softc {
44fa7c453aSmickey 	struct device sc_dev;
45fa7c453aSmickey 
46fa7c453aSmickey };
47fa7c453aSmickey 
48fa7c453aSmickey int	phantomasmatch(struct device *, void *, void *);
49fa7c453aSmickey void	phantomasattach(struct device *, struct device *, void *);
50fa7c453aSmickey 
51*78d5ff0eSmpi const struct cfattach phantomas_ca = {
52fa7c453aSmickey 	sizeof(struct phantomas_softc), phantomasmatch, phantomasattach
53fa7c453aSmickey };
54fa7c453aSmickey 
55fa7c453aSmickey int
phantomasmatch(struct device * parent,void * cfdata,void * aux)56fa7c453aSmickey phantomasmatch(struct device *parent, void *cfdata, void *aux)
57fa7c453aSmickey {
58fa7c453aSmickey 	struct confargs *ca = aux;
59fa7c453aSmickey 
60fa7c453aSmickey 	if (ca->ca_type.iodc_type != HPPA_TYPE_BCPORT ||
61fa7c453aSmickey 	    ca->ca_type.iodc_sv_model != HPPA_BCPORT_PHANTOM)
62fa7c453aSmickey 		return (0);
63fa7c453aSmickey 
64fa7c453aSmickey 	return (1);
65fa7c453aSmickey }
66fa7c453aSmickey 
67fa7c453aSmickey void
phantomasattach(struct device * parent,struct device * self,void * aux)68fa7c453aSmickey phantomasattach(struct device *parent, struct device *self, void *aux)
69fa7c453aSmickey {
70fa7c453aSmickey 	struct confargs *ca = aux, nca;
71fa7c453aSmickey 
72fa7c453aSmickey 	printf("\n");
73fa7c453aSmickey 
74fa7c453aSmickey 	nca = *ca;
756d6f4087Smickey 	nca.ca_hpamask = HPPA_IOBEGIN;
76c7260238Sjsing 	pdc_scanbus(self, &nca, MAXMODBUS, 0, 0);
77fa7c453aSmickey }
78