ofw_bus_if.m revision 139749
138032Speter#-
238032Speter# Copyright (c) 2001, 2003 by Thomas Moestl <tmm@FreeBSD.org>
3261363Sgshapiro# Copyright (c) 2004 by Marius Strobl <marius@FreeBSD.org>
464562Sgshapiro# All rights reserved.
538032Speter#
638032Speter# Redistribution and use in source and binary forms, with or without
738032Speter# modification, are permitted provided that the following conditions
838032Speter# are met:
938032Speter# 1. Redistributions of source code must retain the above copyright
1038032Speter#    notice, this list of conditions and the following disclaimer.
1138032Speter# 2. Redistributions in binary form must reproduce the above copyright
1238032Speter#    notice, this list of conditions and the following disclaimer in the
1338032Speter#    documentation and/or other materials provided with the distribution.
1438032Speter#
1538032Speter# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1638032Speter# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1738032Speter# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18266692Sgshapiro# IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
1938032Speter# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2038032Speter# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2164562Sgshapiro# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2238032Speter# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2338032Speter# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
24# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25#
26# $FreeBSD: head/sys/dev/ofw/ofw_bus_if.m 139749 2005-01-06 01:43:34Z imp $
27
28#include <sys/bus.h>
29#include <machine/bus.h>
30
31#include <dev/ofw/openfirm.h>
32
33INTERFACE ofw_bus;
34
35CODE {
36	static ofw_bus_get_compat_t ofw_bus_default_get_compat;
37	static ofw_bus_get_model_t ofw_bus_default_get_model;
38	static ofw_bus_get_name_t ofw_bus_default_get_name;
39	static ofw_bus_get_node_t ofw_bus_default_get_node;
40	static ofw_bus_get_type_t ofw_bus_default_get_type;
41
42	static const char *
43	ofw_bus_default_get_compat(device_t bus, device_t dev)
44	{
45
46		return (NULL);
47	}
48
49	static const char *
50	ofw_bus_default_get_model(device_t bus, device_t dev)
51	{
52
53		return (NULL);
54	}
55
56	static const char *
57	ofw_bus_default_get_name(device_t bus, device_t dev)
58	{
59
60		return (NULL);
61	}
62
63	static phandle_t
64	ofw_bus_default_get_node(device_t bus, device_t dev)
65	{
66
67		return (0);
68	}
69
70	static const char *
71	ofw_bus_default_get_type(device_t bus, device_t dev)
72	{
73
74		return (NULL);
75	}
76};
77
78# Get the alternate firmware name for the device dev on the bus. The default
79# method will return NULL, which means the device doesn't have such a property.
80METHOD const char * get_compat {
81	device_t bus;
82	device_t dev;
83} DEFAULT ofw_bus_default_get_compat;
84
85# Get the firmware model name for the device dev on the bus. The default method
86# will return NULL, which means the device doesn't have such a property.
87METHOD const char * get_model {
88	device_t bus;
89	device_t dev;
90} DEFAULT ofw_bus_default_get_model;
91
92# Get the firmware name for the device dev on the bus. The default method will
93# return NULL, which means the device doesn't have such a property.
94METHOD const char * get_name {
95	device_t bus;
96	device_t dev;
97} DEFAULT ofw_bus_default_get_name;
98
99# Get the firmware node for the device dev on the bus. The default method will
100# return 0, which signals that there is no such node.
101METHOD phandle_t get_node {
102	device_t bus;
103	device_t dev;
104} DEFAULT ofw_bus_default_get_node;
105
106# Get the firmware device type for the device dev on the bus. The default
107# method will return NULL, which means the device doesn't have such a property.
108METHOD const char * get_type {
109	device_t bus;
110	device_t dev;
111} DEFAULT ofw_bus_default_get_type;
112