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