/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2024 Arm Ltd4* Copyright (c) 2022 The FreeBSD Foundation5*6* Portions of this software were developed by Andrew Turner under sponsorship7* from the FreeBSD Foundation.8*9* Redistribution and use in source and binary forms, with or without10* modification, are permitted provided that the following conditions11* are met:12* 1. Redistributions of source code must retain the above copyright13* notice, this list of conditions and the following disclaimer.14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17*18* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND19* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE20* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE21* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE22* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL23* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS24* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)25* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT26* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY27* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF28* SUCH DAMAGE.29*/3031#include <sys/param.h>32#include <sys/bus.h>33#include <sys/kernel.h>34#include <sys/lock.h>35#include <sys/module.h>36#include <sys/mutex.h>3738#include <dev/ofw/ofw_bus.h>39#include <dev/ofw/ofw_bus_subr.h>40#include <dev/ofw/openfirm.h>4142#include <arm64/spe/arm_spe_dev.h>4344static device_probe_t arm_spe_fdt_probe;4546static struct ofw_compat_data compat_data[] = {47{"arm,statistical-profiling-extension-v1", true},48{NULL, false},49};5051static device_method_t arm_spe_fdt_methods[] = {52/* Device interface */53DEVMETHOD(device_probe, arm_spe_fdt_probe),5455DEVMETHOD_END,56};5758DEFINE_CLASS_1(spe, arm_spe_fdt_driver, arm_spe_fdt_methods,59sizeof(struct arm_spe_softc), arm_spe_driver);6061DRIVER_MODULE(spe, simplebus, arm_spe_fdt_driver, 0, 0);6263static int64arm_spe_fdt_probe(device_t dev)65{66if (!ofw_bus_status_okay(dev))67return (ENXIO);6869if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data)70return (ENXIO);7172device_set_desc(dev, "ARM Statistical Profiling Extension");73return (BUS_PROBE_DEFAULT);74}757677