mainbus.c revision 1.1
11.1Smacallan/* $NetBSD: mainbus.c,v 1.1 2014/11/22 15:17:02 macallan Exp $ */ 21.1Smacallan 31.1Smacallan/*- 41.1Smacallan * Copyright (c) 2014 Michael Lorenz 51.1Smacallan * All rights reserved. 61.1Smacallan * 71.1Smacallan * Redistribution and use in source and binary forms, with or without 81.1Smacallan * modification, are permitted provided that the following conditions 91.1Smacallan * are met: 101.1Smacallan * 1. Redistributions of source code must retain the above copyright 111.1Smacallan * notice, this list of conditions and the following disclaimer. 121.1Smacallan * 2. Redistributions in binary form must reproduce the above copyright 131.1Smacallan * notice, this list of conditions and the following disclaimer in the 141.1Smacallan * documentation and/or other materials provided with the distribution. 151.1Smacallan * 161.1Smacallan * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 171.1Smacallan * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 181.1Smacallan * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 191.1Smacallan * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 201.1Smacallan * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 211.1Smacallan * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 221.1Smacallan * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 231.1Smacallan * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 241.1Smacallan * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 251.1Smacallan * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 261.1Smacallan * POSSIBILITY OF SUCH DAMAGE. 271.1Smacallan */ 281.1Smacallan 291.1Smacallan#include <sys/cdefs.h> 301.1Smacallan__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.1 2014/11/22 15:17:02 macallan Exp $"); 311.1Smacallan 321.1Smacallan#include <sys/param.h> 331.1Smacallan#include <sys/systm.h> 341.1Smacallan#include <sys/device.h> 351.1Smacallan 361.1Smacallan#include <mips/cache.h> 371.1Smacallan#include <mips/cpuregs.h> 381.1Smacallan 391.1Smacallan#include "locators.h" 401.1Smacallan 411.1Smacallanstatic int mainbus_match(device_t, cfdata_t, void *); 421.1Smacallanstatic void mainbus_attach(device_t, device_t, void *); 431.1Smacallanstatic int mainbus_print(void *, const char *); 441.1Smacallan 451.1SmacallanCFATTACH_DECL_NEW(mainbus, 0, 461.1Smacallan mainbus_match, mainbus_attach, NULL, NULL); 471.1Smacallan 481.1Smacallan/* There can be only one. */ 491.1Smacallanint mainbus_found = 0; 501.1Smacallan 511.1Smacallanstruct mainbusdev { 521.1Smacallan const char *md_name; 531.1Smacallan}; 541.1Smacallan 551.1Smacallanstruct mainbusdev mainbusdevs[] = { 561.1Smacallan { "cpu", }, 571.1Smacallan { "com", }, 581.1Smacallan { NULL, } 591.1Smacallan}; 601.1Smacallan 611.1Smacallanstatic int 621.1Smacallanmainbus_match(device_t parent, cfdata_t match, void *aux) 631.1Smacallan{ 641.1Smacallan 651.1Smacallan if (mainbus_found) 661.1Smacallan return (0); 671.1Smacallan 681.1Smacallan return (1); 691.1Smacallan} 701.1Smacallan 711.1Smacallanstatic void 721.1Smacallanmainbus_attach(device_t parent, device_t self, void *aux) 731.1Smacallan{ 741.1Smacallan const struct mainbusdev *md; 751.1Smacallan 761.1Smacallan mainbus_found = 1; 771.1Smacallan printf("\n"); 781.1Smacallan 791.1Smacallan for (md = mainbusdevs; md->md_name != NULL; md++) { 801.1Smacallan struct mainbusdev ma = *md; 811.1Smacallan config_found_ia(self, "mainbus", &ma, mainbus_print); 821.1Smacallan } 831.1Smacallan} 841.1Smacallan 851.1Smacallanstatic int 861.1Smacallanmainbus_print(void *aux, const char *pnp) 871.1Smacallan{ 881.1Smacallan 891.1Smacallan return (QUIET); 901.1Smacallan} 91