1 /* $OpenBSD: gecko.c,v 1.1 2008/04/27 14:39:51 kettenis Exp $ */
4 * Copyright (c) 2007 Mark Kettenis
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #include <sys/param.h>
20 #include <sys/device.h>
21 #include <sys/kernel.h>
22 #include <sys/systm.h>
24 #include <machine/autoconf.h>
25 #include <machine/bus.h>
26 #include <machine/cpu.h>
27 #include <machine/iomod.h>
28 #include <machine/pdc.h>
30 #include <hp700/dev/cpudevs.h>
35 bus_space_tag_t sc_iot
;
36 bus_space_handle_t sc_ioh
;
39 int gecko_match(device_t
, cfdata_t
, void *);
40 void gecko_attach(device_t
, device_t
, void *);
41 static void gecko_callback(device_t
, struct confargs
*);
43 CFATTACH_DECL_NEW(gecko
, sizeof(struct gecko_softc
), gecko_match
,
44 gecko_attach
, NULL
, NULL
);
47 gecko_match(device_t parent
, cfdata_t match
, void *aux
)
49 struct confargs
*ca
= aux
;
51 if (ca
->ca_type
.iodc_type
!= HPPA_TYPE_BCPORT
||
52 ca
->ca_type
.iodc_sv_model
!= HPPA_BCPORT_PORT
)
55 if (ca
->ca_type
.iodc_model
== 0x50 &&
56 ca
->ca_type
.iodc_revision
== 0x00)
63 gecko_attach(device_t parent
, device_t self
, void *aux
)
65 struct gecko_softc
*sc
= device_private(self
);
66 struct confargs
*ca
= aux
, nca
;
67 volatile struct iomod
*regs
;
70 sc
->sc_iot
= ca
->ca_iot
;
71 if (bus_space_map(sc
->sc_iot
, ca
->ca_hpa
, IOMOD_HPASIZE
, 0,
73 aprint_error(": can't map IO space\n");
76 regs
= bus_space_vaddr(ca
->ca_iot
, sc
->sc_ioh
);
78 aprint_verbose(": %x-%x", regs
->io_io_low
, regs
->io_io_high
);
83 nca
.ca_hpabase
= regs
->io_io_low
;
84 nca
.ca_nmodules
= MAXMODBUS
;
86 pdc_scanbus(self
, &nca
, gecko_callback
);
90 gecko_callback(device_t self
, struct confargs
*ca
)
93 config_found_sm_loc(self
, "gedoens", NULL
, ca
, mbprint
, mbsubmatch
);