Path: blob/main/sys/dev/bhnd/bhndb/bhndb_bus_if.m
108734 views
#-1# Copyright (c) 2015-2016 Landon Fuller <[email protected]>2# All rights reserved.3#4# Redistribution and use in source and binary forms, with or without5# modification, are permitted provided that the following conditions6# are met:7# 1. Redistributions of source code must retain the above copyright8# notice, this list of conditions and the following disclaimer.9# 2. Redistributions in binary form must reproduce the above copyright10# notice, this list of conditions and the following disclaimer in the11# documentation and/or other materials provided with the distribution.12#13# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR14# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES15# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.16# IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,17# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES18# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR19# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER20# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,21# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE22# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.23#2425#include <sys/types.h>26#include <sys/bus.h>2728#29# Parent bus interface required by attached bhndb bridge devices.30#3132INTERFACE bhndb_bus;3334HEADER {35struct bhnd_core_info;36struct bhndb_hwcfg;37struct bhndb_hw;38};3940CODE {41#include <sys/systm.h>4243static const struct bhnd_chipid *44bhndb_null_get_chipid(device_t dev, device_t child)45{46return (NULL);47}4849static const struct bhndb_hwcfg *50bhndb_null_get_generic_hwcfg(device_t dev, device_t child)51{52panic("bhndb_get_generic_hwcfg unimplemented");53}5455static const struct bhndb_hw *56bhndb_null_get_hardware_table(device_t dev, device_t child)57{58panic("bhndb_get_hardware_table unimplemented");59}6061static const struct bhndb_hw_priority *62bhndb_null_get_hardware_prio(device_t dev, device_t child)63{64panic("bhndb_get_hardware_prio unimplemented");65}6667static bool68bhndb_null_is_core_disabled(device_t dev, device_t child,69struct bhnd_core_info *core)70{71return (true);72}73}7475/**76* Return a generic hardware configuration to be used by77* the bhndb bridge device to enumerate attached devices.78*79* @param dev The parent device.80* @param child The attached bhndb device.81*82* @retval bhndb_hwcfg The configuration to use for bus enumeration.83*/84METHOD const struct bhndb_hwcfg * get_generic_hwcfg {85device_t dev;86device_t child;87} DEFAULT bhndb_null_get_generic_hwcfg;8889/**90* Provide chip identification information to be used by a @p child during91* device enumeration.92*93* May return NULL if the device includes a ChipCommon core.94*95* @param dev The parent device.96* @param child The attached bhndb device.97*/98METHOD const struct bhnd_chipid * get_chipid {99device_t dev;100device_t child;101} DEFAULT bhndb_null_get_chipid;102103/**104* Return the hardware specification table to be used when identifying the105* bridge's full hardware configuration.106*107* @param dev The parent device.108* @param child The attached bhndb device.109*/110METHOD const struct bhndb_hw * get_hardware_table {111device_t dev;112device_t child;113} DEFAULT bhndb_null_get_hardware_table;114115/**116* Return the hardware priority table to be used when allocating bridge117* resources.118*119* @param dev The parent device.120* @param child The attached bhndb device.121*/122METHOD const struct bhndb_hw_priority * get_hardware_prio {123device_t dev;124device_t child;125} DEFAULT bhndb_null_get_hardware_prio;126127/**128* Return true if the hardware required by @p core is unpopulated or129* otherwise unusable.130*131* In some cases, the core's pins may be left floating, or the hardware132* may otherwise be non-functional; this method allows the parent device133* to explicitly specify whether @p core should be disabled.134*135* @param dev The parent device.136* @param child The attached bhndb device.137* @param core A core discovered on @p child.138*/139METHOD bool is_core_disabled {140device_t dev;141device_t child;142struct bhnd_core_info *core;143} DEFAULT bhndb_null_is_core_disabled;144145146