11.4Sthorpej/* $NetBSD: g1bus.c,v 1.4 2023/12/20 06:36:03 thorpej Exp $ */ 21.1Stsutsui 31.1Stsutsui/*- 41.1Stsutsui * Copyright (c) 2001 Marcus Comstedt 51.1Stsutsui * All rights reserved. 61.1Stsutsui * 71.1Stsutsui * Redistribution and use in source and binary forms, with or without 81.1Stsutsui * modification, are permitted provided that the following conditions 91.1Stsutsui * are met: 101.1Stsutsui * 1. Redistributions of source code must retain the above copyright 111.1Stsutsui * notice, this list of conditions and the following disclaimer. 121.1Stsutsui * 2. Redistributions in binary form must reproduce the above copyright 131.1Stsutsui * notice, this list of conditions and the following disclaimer in the 141.1Stsutsui * documentation and/or other materials provided with the distribution. 151.1Stsutsui * 3. All advertising materials mentioning features or use of this software 161.1Stsutsui * must display the following acknowledgement: 171.1Stsutsui * This product includes software developed by Marcus Comstedt. 181.1Stsutsui * 4. Neither the name of The NetBSD Foundation nor the names of its 191.1Stsutsui * contributors may be used to endorse or promote products derived 201.1Stsutsui * from this software without specific prior written permission. 211.1Stsutsui * 221.1Stsutsui * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 231.1Stsutsui * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 241.1Stsutsui * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 251.1Stsutsui * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 261.1Stsutsui * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 271.1Stsutsui * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 281.1Stsutsui * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 291.1Stsutsui * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 301.1Stsutsui * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 311.1Stsutsui * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 321.1Stsutsui * POSSIBILITY OF SUCH DAMAGE. 331.1Stsutsui */ 341.1Stsutsui 351.1Stsutsui 361.1Stsutsui#include <sys/cdefs.h> 371.4Sthorpej__KERNEL_RCSID(0, "$NetBSD: g1bus.c,v 1.4 2023/12/20 06:36:03 thorpej Exp $"); 381.1Stsutsui 391.1Stsutsui#include <sys/param.h> 401.1Stsutsui#include <sys/systm.h> 411.1Stsutsui#include <sys/kernel.h> 421.1Stsutsui#include <sys/conf.h> 431.1Stsutsui#include <sys/device.h> 441.1Stsutsui#include <sys/proc.h> 451.1Stsutsui 461.1Stsutsui#include <dreamcast/dev/g1/g1busvar.h> 471.1Stsutsui 481.1Stsutsuiint g1busmatch(device_t, cfdata_t, void *); 491.1Stsutsuivoid g1busattach(device_t, device_t, void *); 501.1Stsutsuiint g1busprint(void *, const char *); 511.1Stsutsui 521.1StsutsuiCFATTACH_DECL_NEW(g1bus, sizeof(struct g1bus_softc), 531.1Stsutsui g1busmatch, g1busattach, NULL, NULL); 541.1Stsutsui 551.1Stsutsuiint g1bussearch(device_t, cfdata_t, const int *, void *); 561.1Stsutsui 571.1Stsutsuiint 581.1Stsutsuig1busmatch(device_t parent, cfdata_t cf, void *aux) 591.1Stsutsui{ 601.1Stsutsui 611.1Stsutsui return 1; 621.1Stsutsui} 631.1Stsutsui 641.1Stsutsuivoid 651.1Stsutsuig1busattach(device_t parent, device_t self, void *aux) 661.1Stsutsui{ 671.1Stsutsui struct g1bus_softc *sc = device_private(self); 681.1Stsutsui struct g1bus_attach_args ga; 691.1Stsutsui 701.1Stsutsui sc->sc_dev = self; 711.1Stsutsui printf("\n"); 721.1Stsutsui 731.1Stsutsui g1bus_bus_mem_init(sc); 741.1Stsutsui 751.1Stsutsui ga.ga_memt = &sc->sc_memt; 761.1Stsutsui 771.2Sthorpej config_search(self, &ga, 781.3Sthorpej CFARGS(.search = g1bussearch)); 791.1Stsutsui} 801.1Stsutsui 811.1Stsutsuiint 821.1Stsutsuig1busprint(void *aux, const char *pnp) 831.1Stsutsui{ 841.1Stsutsui 851.1Stsutsui return UNCONF; 861.1Stsutsui} 871.1Stsutsui 881.1Stsutsuiint 891.1Stsutsuig1bussearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux) 901.1Stsutsui{ 911.1Stsutsui 921.2Sthorpej if (config_probe(parent, cf, aux)) 931.3Sthorpej config_attach(parent, cf, aux, g1busprint, CFARGS_NONE); 941.1Stsutsui 951.1Stsutsui return 0; 961.1Stsutsui} 97