mainbus.c revision 1.10
11.10Sthorpej/* $NetBSD: mainbus.c,v 1.10 2021/04/24 23:36:37 thorpej Exp $ */ 21.1Such 31.2Such/*- 41.2Such * Copyright (c) 2002 The NetBSD Foundation, Inc. 51.2Such * All rights reserved. 61.1Such * 71.1Such * Redistribution and use in source and binary forms, with or without 81.1Such * modification, are permitted provided that the following conditions 91.1Such * are met: 101.1Such * 1. Redistributions of source code must retain the above copyright 111.1Such * notice, this list of conditions and the following disclaimer. 121.1Such * 2. Redistributions in binary form must reproduce the above copyright 131.1Such * notice, this list of conditions and the following disclaimer in the 141.1Such * documentation and/or other materials provided with the distribution. 151.1Such * 161.2Such * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 171.2Such * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 181.2Such * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 191.2Such * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 201.2Such * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 211.2Such * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 221.2Such * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 231.2Such * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 241.2Such * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 251.2Such * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 261.2Such * POSSIBILITY OF SUCH DAMAGE. 271.1Such */ 281.5Slukem 291.5Slukem#include <sys/cdefs.h> 301.10Sthorpej__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.10 2021/04/24 23:36:37 thorpej Exp $"); 311.1Such 321.1Such#include <sys/param.h> 331.1Such#include <sys/systm.h> 341.1Such#include <sys/device.h> 351.8Snonaka 361.2Such#include <machine/autoconf.h> 371.1Such 381.9Schsstatic int mainbus_match(device_t, cfdata_t, void *); 391.9Schsstatic void mainbus_attach(device_t, device_t, void *); 401.1Such 411.9SchsCFATTACH_DECL_NEW(mainbus, 0, 421.4Sthorpej mainbus_match, mainbus_attach, NULL, NULL); 431.1Such 441.8Snonakastatic int mainbus_search(device_t, cfdata_t, const int *, void *); 451.8Snonakastatic int mainbus_print(void *, const char *); 461.8Snonaka 471.8Snonakastatic int 481.8Snonakamainbus_match(device_t parent, cfdata_t cf, void *aux) 491.1Such{ 501.1Such 511.2Such return (1); 521.1Such} 531.1Such 541.8Snonakastatic void 551.8Snonakamainbus_attach(device_t parent, device_t self, void *aux) 561.8Snonaka{ 571.8Snonaka struct mainbus_attach_args maa; 581.8Snonaka 591.8Snonaka aprint_naive("\n"); 601.8Snonaka aprint_normal("\n"); 611.8Snonaka 621.8Snonaka /* CPU */ 631.8Snonaka memset(&maa, 0, sizeof(maa)); 641.8Snonaka maa.ma_name = "cpu"; 651.10Sthorpej config_found(self, &maa, mainbus_print, CFARG_EOL); 661.8Snonaka 671.8Snonaka /* Devices */ 681.10Sthorpej config_search(self, NULL, 691.10Sthorpej CFARG_SEARCH, mainbus_search, 701.10Sthorpej CFARG_EOL); 711.8Snonaka} 721.8Snonaka 731.8Snonakastatic int 741.8Snonakamainbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) 751.1Such{ 761.8Snonaka struct mainbus_attach_args maa; 771.8Snonaka 781.8Snonaka if (strcmp(cf->cf_name, "cpu") == 0) 791.8Snonaka return 0; 801.8Snonaka 811.8Snonaka maa.ma_name = cf->cf_name; 821.1Such 831.10Sthorpej if (config_probe(parent, cf, &maa)) 841.10Sthorpej config_attach(parent, cf, &maa, mainbus_print, CFARG_EOL); 851.1Such 861.8Snonaka return 0; 871.1Such} 881.1Such 891.8Snonakastatic int 901.2Suchmainbus_print(void *aux, const char *pnp) 911.1Such{ 921.1Such 931.2Such return (pnp ? QUIET : UNCONF); 941.1Such} 95