newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf
Now that the upper layers all go through a layer to tie into these information functions that translates an sbuf into char * and len. The current interface suffers issues of what to do in cases of truncation, etc. Instead, migrate all these functions to using struct sbuf and these issues go away. The caller is also in charge of any memory allocation and/or expansion that's needed during this process. Create a bus_generic_child_{pnpinfo,location} and make it default. It just returns success. This is for those busses that have no information for these items. Migrate the now-empty routines to using this as appropriate. Document these new interfaces with man pages, and oversight from before. Reviewed by: jhb, bcr Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29937
This commit is contained in:
parent
a7f6c6fd94
commit
ddfc9c4c59
61
share/man/man9/BUS_CHILD_LOCATION.9
Normal file
61
share/man/man9/BUS_CHILD_LOCATION.9
Normal file
@ -0,0 +1,61 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2021 Netflix, Inc.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 22, 2021
|
||||
.Dt BUS_CHILD_LOCATION 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm BUS_CHILD_LOCATION
|
||||
.Nd "obtain the location of a child on the bus."
|
||||
.Sh SYNOPSIS
|
||||
.In sys/param.h
|
||||
.In sys/bus.h
|
||||
.In sys/sbuf.h
|
||||
.Ft void
|
||||
.Fn BUS_CHILD_LOCATION "device_t dev" "device_t child" "struct sbuf *sb"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn BUS_CHILD_LOCATION
|
||||
method returns the location of the
|
||||
.Dv child
|
||||
device.
|
||||
This location is a series of key=value pairs.
|
||||
The string must be formatted as a space-separated list of key=value pairs.
|
||||
Names may only contain alphanumeric characters, underscores ('_') and hyphens ('-').
|
||||
Values can contain any non-whitespace characters.
|
||||
Values containing whitespace can be quoted with double quotes ('"').
|
||||
Double quotes and backslashes in quoted values can be escaped with backslashes ('\').
|
||||
.Pp
|
||||
The location is defined as a series of characteristics of the
|
||||
.Dv child
|
||||
device that can be used to locate that device independent of what drivers are
|
||||
attached.
|
||||
Typically, these are slot numbers, bus addresses, or some topology formation.
|
||||
Where possible, buses are encouraged to provide locations that are stable from
|
||||
boot to boot and when other devices are added or removed.
|
||||
A location is not dependent on the kind of device at that location.
|
||||
.Sh SEE ALSO
|
||||
.Xr bus 9 ,
|
||||
.Xr device 9
|
65
share/man/man9/BUS_CHILD_PNPINFO.9
Normal file
65
share/man/man9/BUS_CHILD_PNPINFO.9
Normal file
@ -0,0 +1,65 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2021 Netflix, Inc.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 22, 2021
|
||||
.Dt BUS_CHILD_PNPINFO 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm BUS_CHILD_PNPINFO
|
||||
.Nd "obtain the plug and play information from a device"
|
||||
.Sh SYNOPSIS
|
||||
.In sys/param.h
|
||||
.In sys/bus.h
|
||||
.In sys/sbuf.h
|
||||
.Ft void
|
||||
.Fn BUS_CHILD_PNPINFO "device_t dev" "device_t child" "struct sbuf *sb"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn BUS_CHILD_LOCATION
|
||||
method returns the identifying information about the
|
||||
.Dv child
|
||||
device.
|
||||
This information is called the plug and play (pnp) details by some buses.
|
||||
This information is a series of key=value pairs.
|
||||
The string must be formatted as a space-separated list of key=value pairs.
|
||||
Names may only contain alphanumeric characters, underscores ('_') and hyphens ('-').
|
||||
Values can contain any non-whitespace characters.
|
||||
Values containing whitespace can be quoted with double quotes ('"').
|
||||
Double quotes and backslashes in quoted values can be escaped with backslashes ('\').
|
||||
.Pp
|
||||
The pnpinfo is defined as a series of characteristics of the
|
||||
.Dv child
|
||||
device that are independent of which drivers are attached, but
|
||||
are used to allow drivers to claim a device.
|
||||
Typically, plug and play information encodes who made the device, what the model
|
||||
number is, and some generic details about the device.
|
||||
By convention, only the generic information about the device that's used by
|
||||
drivers on that bus to decide on accepting the device is reported.
|
||||
Other configuration information (such as the cache burst size) needed for the
|
||||
operation of the device, but that doesn't distinguish it broadly from other
|
||||
devices is not reported.
|
||||
.Sh SEE ALSO
|
||||
.Xr bus 9 ,
|
||||
.Xr device 9
|
@ -34,6 +34,8 @@ MAN= accept_filter.9 \
|
||||
bus_child_present.9 \
|
||||
BUS_CHILD_DELETED.9 \
|
||||
BUS_CHILD_DETACHED.9 \
|
||||
BUS_CHILD_LOCATION.9 \
|
||||
BUS_CHILD_PNPINFO.9 \
|
||||
BUS_CONFIG_INTR.9 \
|
||||
bus_delayed_attach_children.9 \
|
||||
BUS_DESCRIBE_INTR.9 \
|
||||
|
@ -413,7 +413,7 @@ static device_method_t ahci_ata_methods[] = {
|
||||
DEVMETHOD(bus_release_resource, ahci_release_resource),
|
||||
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr,ahci_teardown_intr),
|
||||
DEVMETHOD(bus_child_location_str, ahci_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ahci_child_location),
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
|
@ -347,7 +347,7 @@ static device_method_t imx6_ahci_ata_methods[] = {
|
||||
DEVMETHOD(bus_release_resource, ahci_release_resource),
|
||||
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, ahci_teardown_intr),
|
||||
DEVMETHOD(bus_child_location_str, ahci_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ahci_child_location),
|
||||
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
@ -773,7 +773,7 @@ static device_method_t tegra_ahci_methods[] = {
|
||||
DEVMETHOD(bus_release_resource, ahci_release_resource),
|
||||
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, ahci_teardown_intr),
|
||||
DEVMETHOD(bus_child_location_str, ahci_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ahci_child_location),
|
||||
DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag),
|
||||
|
||||
DEVMETHOD_END
|
||||
|
@ -177,10 +177,10 @@ static int acpi_supported_sleep_state_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
static int acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
static int acpi_debug_objects_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
static int acpi_pm_func(u_long cmd, void *arg, ...);
|
||||
static int acpi_child_location_str_method(device_t acdev, device_t child,
|
||||
char *buf, size_t buflen);
|
||||
static int acpi_child_pnpinfo_str_method(device_t acdev, device_t child,
|
||||
char *buf, size_t buflen);
|
||||
static int acpi_child_location_method(device_t acdev, device_t child,
|
||||
struct sbuf *sb);
|
||||
static int acpi_child_pnpinfo_method(device_t acdev, device_t child,
|
||||
struct sbuf *sb);
|
||||
static void acpi_enable_pcie(void);
|
||||
static void acpi_hint_device_unit(device_t acdev, device_t child,
|
||||
const char *name, int *unitp);
|
||||
@ -210,8 +210,8 @@ static device_method_t acpi_methods[] = {
|
||||
DEVMETHOD(bus_adjust_resource, acpi_adjust_resource),
|
||||
DEVMETHOD(bus_release_resource, acpi_release_resource),
|
||||
DEVMETHOD(bus_delete_resource, acpi_delete_resource),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, acpi_child_pnpinfo_str_method),
|
||||
DEVMETHOD(bus_child_location_str, acpi_child_location_str_method),
|
||||
DEVMETHOD(bus_child_pnpinfo, acpi_child_pnpinfo_method),
|
||||
DEVMETHOD(bus_child_location, acpi_child_location_method),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
@ -865,37 +865,32 @@ acpi_driver_added(device_t dev, driver_t *driver)
|
||||
|
||||
/* Location hint for devctl(8) */
|
||||
static int
|
||||
acpi_child_location_str_method(device_t cbdev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
acpi_child_location_method(device_t cbdev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct acpi_device *dinfo = device_get_ivars(child);
|
||||
char buf2[32];
|
||||
int pxm;
|
||||
|
||||
if (dinfo->ad_handle) {
|
||||
snprintf(buf, buflen, "handle=%s", acpi_name(dinfo->ad_handle));
|
||||
sbuf_printf(sb, "handle=%s", acpi_name(dinfo->ad_handle));
|
||||
if (ACPI_SUCCESS(acpi_GetInteger(dinfo->ad_handle, "_PXM", &pxm))) {
|
||||
snprintf(buf2, 32, " _PXM=%d", pxm);
|
||||
strlcat(buf, buf2, buflen);
|
||||
sbuf_printf(sb, " _PXM=%d", pxm);
|
||||
}
|
||||
} else {
|
||||
snprintf(buf, buflen, "");
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* PnP information for devctl(8) */
|
||||
int
|
||||
acpi_pnpinfo_str(ACPI_HANDLE handle, char *buf, size_t buflen)
|
||||
acpi_pnpinfo(ACPI_HANDLE handle, struct sbuf *sb)
|
||||
{
|
||||
ACPI_DEVICE_INFO *adinfo;
|
||||
|
||||
if (ACPI_FAILURE(AcpiGetObjectInfo(handle, &adinfo))) {
|
||||
snprintf(buf, buflen, "unknown");
|
||||
sbuf_printf(sb, "unknown");
|
||||
return (0);
|
||||
}
|
||||
|
||||
snprintf(buf, buflen, "_HID=%s _UID=%lu _CID=%s",
|
||||
sbuf_printf(sb, "_HID=%s _UID=%lu _CID=%s",
|
||||
(adinfo->Valid & ACPI_VALID_HID) ?
|
||||
adinfo->HardwareId.String : "none",
|
||||
(adinfo->Valid & ACPI_VALID_UID) ?
|
||||
@ -909,12 +904,11 @@ acpi_pnpinfo_str(ACPI_HANDLE handle, char *buf, size_t buflen)
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
acpi_child_pnpinfo_method(device_t cbdev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct acpi_device *dinfo = device_get_ivars(child);
|
||||
|
||||
return (acpi_pnpinfo_str(dinfo->ad_handle, buf, buflen));
|
||||
return (acpi_pnpinfo(dinfo->ad_handle, sb));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/taskqueue.h>
|
||||
#include <sys/tree.h>
|
||||
|
||||
@ -78,8 +79,8 @@ CTASSERT(ACPI_STATE_D3 == PCI_POWERSTATE_D3);
|
||||
static struct pci_devinfo *acpi_pci_alloc_devinfo(device_t dev);
|
||||
static int acpi_pci_attach(device_t dev);
|
||||
static void acpi_pci_child_deleted(device_t dev, device_t child);
|
||||
static int acpi_pci_child_location_str_method(device_t cbdev,
|
||||
device_t child, char *buf, size_t buflen);
|
||||
static int acpi_pci_child_location_method(device_t cbdev,
|
||||
device_t child, struct sbuf *sb);
|
||||
static int acpi_pci_detach(device_t dev);
|
||||
static int acpi_pci_probe(device_t dev);
|
||||
static int acpi_pci_read_ivar(device_t dev, device_t child, int which,
|
||||
@ -103,7 +104,7 @@ static device_method_t acpi_pci_methods[] = {
|
||||
DEVMETHOD(bus_read_ivar, acpi_pci_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, acpi_pci_write_ivar),
|
||||
DEVMETHOD(bus_child_deleted, acpi_pci_child_deleted),
|
||||
DEVMETHOD(bus_child_location_str, acpi_pci_child_location_str_method),
|
||||
DEVMETHOD(bus_child_location, acpi_pci_child_location_method),
|
||||
DEVMETHOD(bus_get_cpus, acpi_get_cpus),
|
||||
DEVMETHOD(bus_get_dma_tag, acpi_pci_get_dma_tag),
|
||||
DEVMETHOD(bus_get_domain, acpi_get_domain),
|
||||
@ -179,22 +180,17 @@ acpi_pci_child_deleted(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_pci_child_location_str_method(device_t cbdev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
acpi_pci_child_location_method(device_t cbdev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct acpi_pci_devinfo *dinfo = device_get_ivars(child);
|
||||
int pxm;
|
||||
char buf2[32];
|
||||
|
||||
pci_child_location_str_method(cbdev, child, buf, buflen);
|
||||
pci_child_location_method(cbdev, child, sb);
|
||||
|
||||
if (dinfo->ap_handle) {
|
||||
strlcat(buf, " handle=", buflen);
|
||||
strlcat(buf, acpi_name(dinfo->ap_handle), buflen);
|
||||
|
||||
sbuf_printf(sb, " handle=%s", acpi_name(dinfo->ap_handle));
|
||||
if (ACPI_SUCCESS(acpi_GetInteger(dinfo->ap_handle, "_PXM", &pxm))) {
|
||||
snprintf(buf2, 32, " _PXM=%d", pxm);
|
||||
strlcat(buf, buf2, buflen);
|
||||
sbuf_printf(sb, " _PXM=%d", pxm);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
|
@ -236,8 +236,8 @@ extern int acpi_quirks;
|
||||
* is compatible with ids parameter of ACPI_ID_PROBE bus method.
|
||||
*
|
||||
* XXX: While ACPI_ID_PROBE matches against _HID and all _CIDs, current
|
||||
* acpi_pnpinfo_str() exports only _HID and first _CID. That means second
|
||||
* and further _CIDs should be added to both acpi_pnpinfo_str() and
|
||||
* acpi_pnpinfo() exports only _HID and first _CID. That means second
|
||||
* and further _CIDs should be added to both acpi_pnpinfo() and
|
||||
* ACPICOMPAT_PNP_INFO if device matching against them is required.
|
||||
*/
|
||||
#define ACPICOMPAT_PNP_INFO(t, busname) \
|
||||
@ -490,7 +490,7 @@ int acpi_wakeup_machdep(struct acpi_softc *sc, int state,
|
||||
int sleep_result, int intr_enabled);
|
||||
int acpi_table_quirks(int *quirks);
|
||||
int acpi_machdep_quirks(int *quirks);
|
||||
int acpi_pnpinfo_str(ACPI_HANDLE handle, char *buf, size_t buflen);
|
||||
int acpi_pnpinfo(ACPI_HANDLE handle, struct sbuf *sb);
|
||||
|
||||
uint32_t hpet_get_uid(device_t dev);
|
||||
|
||||
|
@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <machine/stdarg.h>
|
||||
#include <machine/resource.h>
|
||||
@ -697,14 +698,13 @@ ahci_print_child(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
int
|
||||
ahci_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
ahci_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
intptr_t ivars;
|
||||
|
||||
ivars = (intptr_t)device_get_ivars(child);
|
||||
if ((ivars & AHCI_EM_UNIT) == 0)
|
||||
snprintf(buf, buflen, "channel=%d", (int)ivars & AHCI_UNIT);
|
||||
sbuf_printf(sb, "channel=%d", (int)ivars & AHCI_UNIT);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -663,8 +663,7 @@ int ahci_setup_intr(device_t dev, device_t child, struct resource *irq,
|
||||
void *argument, void **cookiep);
|
||||
int ahci_teardown_intr(device_t dev, device_t child, struct resource *irq,
|
||||
void *cookie);
|
||||
int ahci_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen);
|
||||
int ahci_child_location(device_t dev, device_t child, struct sbuf *sb);
|
||||
bus_dma_tag_t ahci_get_dma_tag(device_t dev, device_t child);
|
||||
int ahci_ctlr_reset(device_t dev);
|
||||
int ahci_ctlr_setup(device_t dev);
|
||||
|
@ -406,7 +406,7 @@ static const device_method_t ahci_fsl_fdt_methods[] = {
|
||||
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, ahci_teardown_intr),
|
||||
DEVMETHOD(bus_print_child, ahci_print_child),
|
||||
DEVMETHOD(bus_child_location_str, ahci_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ahci_child_location),
|
||||
DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag),
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
@ -182,7 +182,7 @@ static device_method_t ahci_fdt_methods[] = {
|
||||
DEVMETHOD(bus_release_resource, ahci_release_resource),
|
||||
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr,ahci_teardown_intr),
|
||||
DEVMETHOD(bus_child_location_str, ahci_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ahci_child_location),
|
||||
DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag),
|
||||
DEVMETHOD_END
|
||||
};
|
||||
@ -206,7 +206,7 @@ static device_method_t ahci_acpi_methods[] = {
|
||||
DEVMETHOD(bus_release_resource, ahci_release_resource),
|
||||
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr,ahci_teardown_intr),
|
||||
DEVMETHOD(bus_child_location_str, ahci_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ahci_child_location),
|
||||
DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag),
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
@ -140,7 +140,7 @@ static device_method_t ahci_methods[] = {
|
||||
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, ahci_teardown_intr),
|
||||
DEVMETHOD(bus_print_child, ahci_print_child),
|
||||
DEVMETHOD(bus_child_location_str, ahci_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ahci_child_location),
|
||||
DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag),
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
@ -740,7 +740,7 @@ static device_method_t ahci_methods[] = {
|
||||
DEVMETHOD(bus_release_resource, ahci_release_resource),
|
||||
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr,ahci_teardown_intr),
|
||||
DEVMETHOD(bus_child_location_str, ahci_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ahci_child_location),
|
||||
DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag),
|
||||
DEVMETHOD_END
|
||||
};
|
||||
@ -764,7 +764,7 @@ static device_method_t ahci_ata_methods[] = {
|
||||
DEVMETHOD(bus_release_resource, ahci_release_resource),
|
||||
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr,ahci_teardown_intr),
|
||||
DEVMETHOD(bus_child_location_str, ahci_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ahci_child_location),
|
||||
DEVMETHOD_END
|
||||
};
|
||||
static driver_t ahci_ata_driver = {
|
||||
|
@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sema.h>
|
||||
#include <sys/taskqueue.h>
|
||||
#include <vm/uma.h>
|
||||
@ -558,11 +559,10 @@ ata_pci_print_child(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
int
|
||||
ata_pci_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
ata_pci_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
|
||||
snprintf(buf, buflen, "channel=%d",
|
||||
sbuf_printf(sb, "channel=%d",
|
||||
(int)(intptr_t)device_get_ivars(child));
|
||||
return (0);
|
||||
}
|
||||
@ -595,7 +595,7 @@ static device_method_t ata_pci_methods[] = {
|
||||
DEVMETHOD(pci_read_config, ata_pci_read_config),
|
||||
DEVMETHOD(pci_write_config, ata_pci_write_config),
|
||||
DEVMETHOD(bus_print_child, ata_pci_print_child),
|
||||
DEVMETHOD(bus_child_location_str, ata_pci_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ata_pci_child_location),
|
||||
DEVMETHOD(bus_get_dma_tag, ata_pci_get_dma_tag),
|
||||
|
||||
DEVMETHOD_END
|
||||
|
@ -535,8 +535,7 @@ uint32_t ata_pci_read_config(device_t dev, device_t child, int reg, int width);
|
||||
void ata_pci_write_config(device_t dev, device_t child, int reg,
|
||||
uint32_t val, int width);
|
||||
int ata_pci_print_child(device_t dev, device_t child);
|
||||
int ata_pci_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen);
|
||||
int ata_pci_child_location(device_t dev, device_t child, struct sbuf *sb);
|
||||
struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags);
|
||||
int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r);
|
||||
int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep);
|
||||
@ -586,7 +585,7 @@ static device_method_t __CONCAT(dname,_methods)[] = { \
|
||||
DEVMETHOD(pci_read_config, ata_pci_read_config), \
|
||||
DEVMETHOD(pci_write_config, ata_pci_write_config), \
|
||||
DEVMETHOD(bus_print_child, ata_pci_print_child), \
|
||||
DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), \
|
||||
DEVMETHOD(bus_child_location, ata_pci_child_location), \
|
||||
DEVMETHOD_END \
|
||||
}; \
|
||||
static driver_t __CONCAT(dname,_driver) = { \
|
||||
|
@ -227,7 +227,7 @@ static device_method_t imx_ata_methods[] = {
|
||||
DEVMETHOD(pci_read_config, ata_pci_read_config),
|
||||
DEVMETHOD(pci_write_config, ata_pci_write_config),
|
||||
DEVMETHOD(bus_print_child, ata_pci_print_child),
|
||||
DEVMETHOD(bus_child_location_str, ata_pci_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ata_pci_child_location),
|
||||
DEVMETHOD_END
|
||||
};
|
||||
static driver_t imx_ata_driver = {
|
||||
|
@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
@ -899,48 +900,32 @@ bhnd_generic_probe_nomatch(device_t dev, device_t child)
|
||||
bhnd_get_core_index(child));
|
||||
}
|
||||
|
||||
/**
|
||||
* Default implementation of BUS_CHILD_PNPINFO_STR().
|
||||
*/
|
||||
static int
|
||||
bhnd_child_pnpinfo_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
bhnd_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
if (device_get_parent(child) != dev) {
|
||||
return (BUS_CHILD_PNPINFO_STR(device_get_parent(dev), child,
|
||||
buf, buflen));
|
||||
}
|
||||
if (device_get_parent(child) != dev)
|
||||
return (BUS_CHILD_PNPINFO(device_get_parent(dev), child, sb));
|
||||
|
||||
snprintf(buf, buflen, "vendor=0x%hx device=0x%hx rev=0x%hhx",
|
||||
sbuf_printf(sb, "vendor=0x%hx device=0x%hx rev=0x%hhx",
|
||||
bhnd_get_vendor(child), bhnd_get_device(child),
|
||||
bhnd_get_hwrev(child));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default implementation of BUS_CHILD_LOCATION_STR().
|
||||
*/
|
||||
static int
|
||||
bhnd_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
bhnd_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
bhnd_addr_t addr;
|
||||
bhnd_size_t size;
|
||||
|
||||
if (device_get_parent(child) != dev) {
|
||||
return (BUS_CHILD_LOCATION_STR(device_get_parent(dev), child,
|
||||
buf, buflen));
|
||||
}
|
||||
if (device_get_parent(child) != dev)
|
||||
return (BUS_CHILD_LOCATION(device_get_parent(dev), child, sb));
|
||||
|
||||
if (bhnd_get_region_addr(child, BHND_PORT_DEVICE, 0, 0, &addr, &size)) {
|
||||
/* No device default port/region */
|
||||
if (buflen > 0)
|
||||
*buf = '\0';
|
||||
if (bhnd_get_region_addr(child, BHND_PORT_DEVICE, 0, 0, &addr, &size))
|
||||
return (0);
|
||||
}
|
||||
|
||||
snprintf(buf, buflen, "port0.0=0x%llx", (unsigned long long) addr);
|
||||
sbuf_printf(sb, "port0.0=0x%llx", (unsigned long long) addr);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1104,8 +1089,8 @@ static device_method_t bhnd_methods[] = {
|
||||
DEVMETHOD(bus_child_deleted, bhnd_generic_child_deleted),
|
||||
DEVMETHOD(bus_probe_nomatch, bhnd_generic_probe_nomatch),
|
||||
DEVMETHOD(bus_print_child, bhnd_generic_print_child),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, bhnd_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location_str, bhnd_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, bhnd_child_pnpinfo),
|
||||
DEVMETHOD(bus_child_location, bhnd_child_location),
|
||||
|
||||
DEVMETHOD(bus_suspend_child, bhnd_generic_suspend_child),
|
||||
DEVMETHOD(bus_resume_child, bhnd_generic_resume_child),
|
||||
|
@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
@ -168,22 +169,13 @@ bhndb_print_child(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
bhndb_child_pnpinfo_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
{
|
||||
*buf = '\0';
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
bhndb_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
bhndb_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct bhndb_softc *sc;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
snprintf(buf, buflen, "base=0x%llx",
|
||||
sbuf_printf(sb, "base=0x%llx",
|
||||
(unsigned long long) sc->chipid.enum_addr);
|
||||
return (0);
|
||||
}
|
||||
@ -2215,8 +2207,7 @@ static device_method_t bhndb_methods[] = {
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_probe_nomatch, bhndb_probe_nomatch),
|
||||
DEVMETHOD(bus_print_child, bhndb_print_child),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, bhndb_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location_str, bhndb_child_location_str),
|
||||
DEVMETHOD(bus_child_location, bhndb_child_location),
|
||||
DEVMETHOD(bus_add_child, bhndb_add_child),
|
||||
DEVMETHOD(bus_child_deleted, bhndb_child_deleted),
|
||||
|
||||
|
@ -596,28 +596,6 @@ chipc_print_child(device_t dev, device_t child)
|
||||
return (retval);
|
||||
}
|
||||
|
||||
static int
|
||||
chipc_child_pnpinfo_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
{
|
||||
if (buflen == 0)
|
||||
return (EOVERFLOW);
|
||||
|
||||
*buf = '\0';
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
chipc_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
{
|
||||
if (buflen == 0)
|
||||
return (EOVERFLOW);
|
||||
|
||||
*buf = '\0';
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static device_t
|
||||
chipc_add_child(device_t dev, u_int order, const char *name, int unit)
|
||||
{
|
||||
@ -1412,8 +1390,6 @@ static device_method_t chipc_methods[] = {
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_probe_nomatch, chipc_probe_nomatch),
|
||||
DEVMETHOD(bus_print_child, chipc_print_child),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, chipc_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location_str, chipc_child_location_str),
|
||||
|
||||
DEVMETHOD(bus_add_child, chipc_add_child),
|
||||
DEVMETHOD(bus_child_deleted, chipc_child_deleted),
|
||||
|
@ -97,7 +97,7 @@ __FBSDID("$FreeBSD$");
|
||||
static int t4_probe(device_t);
|
||||
static int t4_attach(device_t);
|
||||
static int t4_detach(device_t);
|
||||
static int t4_child_location_str(device_t, device_t, char *, size_t);
|
||||
static int t4_child_location(device_t, device_t, struct sbuf *);
|
||||
static int t4_ready(device_t);
|
||||
static int t4_read_port_device(device_t, int, device_t *);
|
||||
static int t4_suspend(device_t);
|
||||
@ -111,7 +111,7 @@ static device_method_t t4_methods[] = {
|
||||
DEVMETHOD(device_suspend, t4_suspend),
|
||||
DEVMETHOD(device_resume, t4_resume),
|
||||
|
||||
DEVMETHOD(bus_child_location_str, t4_child_location_str),
|
||||
DEVMETHOD(bus_child_location, t4_child_location),
|
||||
DEVMETHOD(bus_reset_prepare, t4_reset_prepare),
|
||||
DEVMETHOD(bus_reset_post, t4_reset_post),
|
||||
|
||||
@ -176,7 +176,7 @@ static device_method_t t5_methods[] = {
|
||||
DEVMETHOD(device_suspend, t4_suspend),
|
||||
DEVMETHOD(device_resume, t4_resume),
|
||||
|
||||
DEVMETHOD(bus_child_location_str, t4_child_location_str),
|
||||
DEVMETHOD(bus_child_location, t4_child_location),
|
||||
DEVMETHOD(bus_reset_prepare, t4_reset_prepare),
|
||||
DEVMETHOD(bus_reset_post, t4_reset_post),
|
||||
|
||||
@ -215,7 +215,7 @@ static device_method_t t6_methods[] = {
|
||||
DEVMETHOD(device_suspend, t4_suspend),
|
||||
DEVMETHOD(device_resume, t4_resume),
|
||||
|
||||
DEVMETHOD(bus_child_location_str, t4_child_location_str),
|
||||
DEVMETHOD(bus_child_location, t4_child_location),
|
||||
DEVMETHOD(bus_reset_prepare, t4_reset_prepare),
|
||||
DEVMETHOD(bus_reset_post, t4_reset_post),
|
||||
|
||||
@ -1572,18 +1572,17 @@ t4_attach(device_t dev)
|
||||
}
|
||||
|
||||
static int
|
||||
t4_child_location_str(device_t bus, device_t dev, char *buf, size_t buflen)
|
||||
t4_child_location(device_t bus, device_t dev, struct sbuf *sb)
|
||||
{
|
||||
struct adapter *sc;
|
||||
struct port_info *pi;
|
||||
int i;
|
||||
|
||||
sc = device_get_softc(bus);
|
||||
buf[0] = '\0';
|
||||
for_each_port(sc, i) {
|
||||
pi = sc->port[i];
|
||||
if (pi != NULL && pi->dev == dev) {
|
||||
snprintf(buf, buflen, "port=%d", pi->port_id);
|
||||
sbuf_printf(sb, "port=%d", pi->port_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ static device_method_t simplebus_methods[] = {
|
||||
DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
|
||||
DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource),
|
||||
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
|
||||
DEVMETHOD(bus_get_resource_list, simplebus_get_resource_list),
|
||||
|
||||
/* ofw_bus interface */
|
||||
|
@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sbuf.h>
|
||||
|
||||
#include <dev/gpio/gpiobusvar.h>
|
||||
|
||||
@ -51,7 +52,7 @@ __FBSDID("$FreeBSD$");
|
||||
#define dprintf(x, arg...)
|
||||
#endif
|
||||
|
||||
static void gpiobus_print_pins(struct gpiobus_ivar *, char *, size_t);
|
||||
static void gpiobus_print_pins(struct gpiobus_ivar *, struct sbuf *);
|
||||
static int gpiobus_parse_pins(struct gpiobus_softc *, device_t, int);
|
||||
static int gpiobus_probe(device_t);
|
||||
static int gpiobus_attach(device_t);
|
||||
@ -60,8 +61,7 @@ static int gpiobus_suspend(device_t);
|
||||
static int gpiobus_resume(device_t);
|
||||
static void gpiobus_probe_nomatch(device_t, device_t);
|
||||
static int gpiobus_print_child(device_t, device_t);
|
||||
static int gpiobus_child_location_str(device_t, device_t, char *, size_t);
|
||||
static int gpiobus_child_pnpinfo_str(device_t, device_t, char *, size_t);
|
||||
static int gpiobus_child_location(device_t, device_t, struct sbuf *);
|
||||
static device_t gpiobus_add_child(device_t, u_int, const char *, int);
|
||||
static void gpiobus_hinted_child(device_t, const char *, int);
|
||||
|
||||
@ -265,9 +265,8 @@ gpio_pin_setflags(gpio_pin_t pin, uint32_t flags)
|
||||
}
|
||||
|
||||
static void
|
||||
gpiobus_print_pins(struct gpiobus_ivar *devi, char *buf, size_t buflen)
|
||||
gpiobus_print_pins(struct gpiobus_ivar *devi, struct sbuf *sb)
|
||||
{
|
||||
char tmp[128];
|
||||
int i, range_start, range_stop, need_coma;
|
||||
|
||||
if (devi->npins == 0)
|
||||
@ -278,16 +277,11 @@ gpiobus_print_pins(struct gpiobus_ivar *devi, char *buf, size_t buflen)
|
||||
for (i = 1; i < devi->npins; i++) {
|
||||
if (devi->pins[i] != (range_stop + 1)) {
|
||||
if (need_coma)
|
||||
strlcat(buf, ",", buflen);
|
||||
memset(tmp, 0, sizeof(tmp));
|
||||
sbuf_cat(sb, ",");
|
||||
if (range_start != range_stop)
|
||||
snprintf(tmp, sizeof(tmp) - 1, "%d-%d",
|
||||
range_start, range_stop);
|
||||
sbuf_printf(sb, "%d-%d", range_start, range_stop);
|
||||
else
|
||||
snprintf(tmp, sizeof(tmp) - 1, "%d",
|
||||
range_start);
|
||||
strlcat(buf, tmp, buflen);
|
||||
|
||||
sbuf_printf(sb, "%d", range_start);
|
||||
range_start = range_stop = devi->pins[i];
|
||||
need_coma = 1;
|
||||
}
|
||||
@ -296,15 +290,11 @@ gpiobus_print_pins(struct gpiobus_ivar *devi, char *buf, size_t buflen)
|
||||
}
|
||||
|
||||
if (need_coma)
|
||||
strlcat(buf, ",", buflen);
|
||||
memset(tmp, 0, sizeof(tmp));
|
||||
sbuf_cat(sb, ",");
|
||||
if (range_start != range_stop)
|
||||
snprintf(tmp, sizeof(tmp) - 1, "%d-%d",
|
||||
range_start, range_stop);
|
||||
sbuf_printf(sb, "%d-%d", range_start, range_stop);
|
||||
else
|
||||
snprintf(tmp, sizeof(tmp) - 1, "%d",
|
||||
range_start);
|
||||
strlcat(buf, tmp, buflen);
|
||||
sbuf_printf(sb, "%d", range_start);
|
||||
}
|
||||
|
||||
device_t
|
||||
@ -643,15 +633,15 @@ static void
|
||||
gpiobus_probe_nomatch(device_t dev, device_t child)
|
||||
{
|
||||
char pins[128];
|
||||
struct sbuf sb;
|
||||
struct gpiobus_ivar *devi;
|
||||
|
||||
devi = GPIOBUS_IVAR(child);
|
||||
memset(pins, 0, sizeof(pins));
|
||||
gpiobus_print_pins(devi, pins, sizeof(pins));
|
||||
if (devi->npins > 1)
|
||||
device_printf(dev, "<unknown device> at pins %s", pins);
|
||||
else
|
||||
device_printf(dev, "<unknown device> at pin %s", pins);
|
||||
sbuf_new(&sb, pins, sizeof(pins), SBUF_FIXEDLEN);
|
||||
gpiobus_print_pins(devi, &sb);
|
||||
sbuf_finish(&sb);
|
||||
device_printf(dev, "<unknown device> at pin%s %s",
|
||||
devi->npins > 1 ? "s" : "", sbuf_data(&sb));
|
||||
resource_list_print_type(&devi->rl, "irq", SYS_RES_IRQ, "%jd");
|
||||
printf("\n");
|
||||
}
|
||||
@ -660,19 +650,21 @@ static int
|
||||
gpiobus_print_child(device_t dev, device_t child)
|
||||
{
|
||||
char pins[128];
|
||||
struct sbuf sb;
|
||||
int retval = 0;
|
||||
struct gpiobus_ivar *devi;
|
||||
|
||||
devi = GPIOBUS_IVAR(child);
|
||||
memset(pins, 0, sizeof(pins));
|
||||
retval += bus_print_child_header(dev, child);
|
||||
if (devi->npins > 0) {
|
||||
if (devi->npins > 1)
|
||||
retval += printf(" at pins ");
|
||||
else
|
||||
retval += printf(" at pin ");
|
||||
gpiobus_print_pins(devi, pins, sizeof(pins));
|
||||
retval += printf("%s", pins);
|
||||
sbuf_new(&sb, pins, sizeof(pins), SBUF_FIXEDLEN);
|
||||
gpiobus_print_pins(devi, &sb);
|
||||
sbuf_finish(&sb);
|
||||
retval += printf("%s", sbuf_data(&sb));
|
||||
}
|
||||
resource_list_print_type(&devi->rl, "irq", SYS_RES_IRQ, "%jd");
|
||||
retval += bus_print_child_footer(dev, child);
|
||||
@ -681,30 +673,17 @@ gpiobus_print_child(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
gpiobus_child_location_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
gpiobus_child_location(device_t bus, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct gpiobus_ivar *devi;
|
||||
|
||||
devi = GPIOBUS_IVAR(child);
|
||||
if (devi->npins > 1)
|
||||
strlcpy(buf, "pins=", buflen);
|
||||
else
|
||||
strlcpy(buf, "pin=", buflen);
|
||||
gpiobus_print_pins(devi, buf, buflen);
|
||||
sbuf_printf(sb, "pins=");
|
||||
gpiobus_print_pins(devi, sb);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
gpiobus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
{
|
||||
|
||||
*buf = '\0';
|
||||
return (0);
|
||||
}
|
||||
|
||||
static device_t
|
||||
gpiobus_add_child(device_t dev, u_int order, const char *name, int unit)
|
||||
{
|
||||
@ -1108,8 +1087,7 @@ static device_method_t gpiobus_methods[] = {
|
||||
DEVMETHOD(bus_rescan, gpiobus_rescan),
|
||||
DEVMETHOD(bus_probe_nomatch, gpiobus_probe_nomatch),
|
||||
DEVMETHOD(bus_print_child, gpiobus_print_child),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, gpiobus_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location_str, gpiobus_child_location_str),
|
||||
DEVMETHOD(bus_child_location, gpiobus_child_location),
|
||||
DEVMETHOD(bus_hinted_child, gpiobus_hinted_child),
|
||||
DEVMETHOD(bus_read_ivar, gpiobus_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, gpiobus_write_ivar),
|
||||
|
@ -493,7 +493,7 @@ static device_method_t ofw_gpiobus_methods[] = {
|
||||
DEVMETHOD(device_attach, ofw_gpiobus_attach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
|
||||
DEVMETHOD(bus_add_child, ofw_gpiobus_add_child),
|
||||
|
||||
/* ofw_bus interface */
|
||||
|
@ -40,8 +40,9 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sx.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#define HID_DEBUG_VAR hid_debug
|
||||
#include <dev/hid/hid.h>
|
||||
@ -476,24 +477,22 @@ hidbus_write_ivar(device_t bus, device_t child, int which, uintptr_t value)
|
||||
|
||||
/* Location hint for devctl(8) */
|
||||
static int
|
||||
hidbus_child_location_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
hidbus_child_location(device_t bus, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct hidbus_ivars *tlc = device_get_ivars(child);
|
||||
|
||||
snprintf(buf, buflen, "index=%hhu", tlc->index);
|
||||
sbuf_printf(sb, "index=%hhu", tlc->index);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* PnP information for devctl(8) */
|
||||
static int
|
||||
hidbus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
hidbus_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct hidbus_ivars *tlc = device_get_ivars(child);
|
||||
struct hid_device_info *devinfo = device_get_ivars(bus);
|
||||
|
||||
snprintf(buf, buflen, "page=0x%04x usage=0x%04x bus=0x%02hx "
|
||||
sbuf_printf(sb, "page=0x%04x usage=0x%04x bus=0x%02hx "
|
||||
"vendor=0x%04hx product=0x%04hx version=0x%04hx%s%s",
|
||||
HID_GET_USAGE_PAGE(tlc->usage), HID_GET_USAGE(tlc->usage),
|
||||
devinfo->idBus, devinfo->idVendor, devinfo->idProduct,
|
||||
@ -882,8 +881,8 @@ static device_method_t hidbus_methods[] = {
|
||||
DEVMETHOD(bus_child_deleted, hidbus_child_deleted),
|
||||
DEVMETHOD(bus_read_ivar, hidbus_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, hidbus_write_ivar),
|
||||
DEVMETHOD(bus_child_pnpinfo_str,hidbus_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location_str,hidbus_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, hidbus_child_pnpinfo),
|
||||
DEVMETHOD(bus_child_location, hidbus_child_location),
|
||||
|
||||
/* hid interface */
|
||||
DEVMETHOD(hid_get_rdesc, hid_get_rdesc),
|
||||
|
@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/smp.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/systm.h>
|
||||
@ -84,8 +85,7 @@ static int vmbus_attach(device_t);
|
||||
static int vmbus_detach(device_t);
|
||||
static int vmbus_read_ivar(device_t, device_t, int,
|
||||
uintptr_t *);
|
||||
static int vmbus_child_pnpinfo_str(device_t, device_t,
|
||||
char *, size_t);
|
||||
static int vmbus_child_pnpinfo(device_t, device_t, struct sbuf *);
|
||||
static struct resource *vmbus_alloc_resource(device_t dev,
|
||||
device_t child, int type, int *rid,
|
||||
rman_res_t start, rman_res_t end,
|
||||
@ -175,7 +175,7 @@ static device_method_t vmbus_methods[] = {
|
||||
DEVMETHOD(bus_add_child, bus_generic_add_child),
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_read_ivar, vmbus_read_ivar),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, vmbus_child_pnpinfo),
|
||||
DEVMETHOD(bus_alloc_resource, vmbus_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
@ -1044,7 +1044,7 @@ vmbus_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
|
||||
}
|
||||
|
||||
static int
|
||||
vmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf, size_t buflen)
|
||||
vmbus_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
const struct vmbus_channel *chan;
|
||||
char guidbuf[HYPERV_GUID_STRLEN];
|
||||
@ -1055,13 +1055,11 @@ vmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf, size_t buflen)
|
||||
return (0);
|
||||
}
|
||||
|
||||
strlcat(buf, "classid=", buflen);
|
||||
hyperv_guid2str(&chan->ch_guid_type, guidbuf, sizeof(guidbuf));
|
||||
strlcat(buf, guidbuf, buflen);
|
||||
sbuf_printf(sb, "classid=%s", guidbuf);
|
||||
|
||||
strlcat(buf, " deviceid=", buflen);
|
||||
hyperv_guid2str(&chan->ch_guid_inst, guidbuf, sizeof(guidbuf));
|
||||
strlcat(buf, guidbuf, buflen);
|
||||
sbuf_printf(sb, " deviceid=%s", guidbuf);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/sbuf.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
|
||||
@ -709,54 +710,39 @@ acpi_iicbus_write_ivar(device_t bus, device_t child, int which, uintptr_t val)
|
||||
|
||||
/* Location hint for devctl(8). Concatenate IIC and ACPI hints. */
|
||||
static int
|
||||
acpi_iicbus_child_location_str(device_t bus, device_t child,
|
||||
char *buf, size_t buflen)
|
||||
acpi_iicbus_child_location(device_t bus, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct acpi_iicbus_ivars *devi = device_get_ivars(child);
|
||||
int error;
|
||||
|
||||
/* read IIC location hint string into the buffer. */
|
||||
error = iicbus_child_location_str(bus, child, buf, buflen);
|
||||
error = iicbus_child_location(bus, child, sb);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
/* Place ACPI string right after IIC one's terminating NUL. */
|
||||
if (devi->handle != NULL &&
|
||||
((buf[0] != '\0' && strlcat(buf, " ", buflen) >= buflen) ||
|
||||
strlcat(buf, "handle=", buflen) >= buflen ||
|
||||
strlcat(buf, acpi_name(devi->handle), buflen) >= buflen))
|
||||
return (EOVERFLOW);
|
||||
if (devi->handle != NULL)
|
||||
sbuf_printf(sb, " handle=%s", acpi_name(devi->handle));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* PnP information for devctl(8). Concatenate IIC and ACPI info strings. */
|
||||
static int
|
||||
acpi_iicbus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
acpi_iicbus_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct acpi_iicbus_ivars *devi = device_get_ivars(child);
|
||||
size_t acpi_offset;
|
||||
int error;
|
||||
|
||||
/* read IIC PnP string into the buffer. */
|
||||
error = iicbus_child_pnpinfo_str(bus, child, buf, buflen);
|
||||
error = iicbus_child_pnpinfo(bus, child, sb);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
if (devi->handle == NULL)
|
||||
return (0);
|
||||
|
||||
/* Place ACPI string right after IIC one's terminating NUL. */
|
||||
acpi_offset = strlen(buf);
|
||||
if (acpi_offset != 0)
|
||||
acpi_offset++;
|
||||
error = acpi_pnpinfo_str(devi->handle, buf + acpi_offset,
|
||||
buflen - acpi_offset);
|
||||
|
||||
/* Coalesce both strings if they are not empty. */
|
||||
if (acpi_offset > 0 && acpi_offset < buflen && buf[acpi_offset] != 0)
|
||||
buf[acpi_offset - 1] = ' ';
|
||||
error = acpi_pnpinfo(devi->handle, sb);
|
||||
|
||||
return (error);
|
||||
}
|
||||
@ -776,8 +762,8 @@ static device_method_t acpi_iicbus_methods[] = {
|
||||
DEVMETHOD(bus_child_deleted, acpi_iicbus_child_deleted),
|
||||
DEVMETHOD(bus_read_ivar, acpi_iicbus_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, acpi_iicbus_write_ivar),
|
||||
DEVMETHOD(bus_child_location_str,acpi_iicbus_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo_str,acpi_iicbus_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location, acpi_iicbus_child_location),
|
||||
DEVMETHOD(bus_child_pnpinfo, acpi_iicbus_child_pnpinfo),
|
||||
|
||||
DEVMETHOD_END,
|
||||
};
|
||||
|
@ -36,13 +36,14 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <dev/iicbus/iiconf.h>
|
||||
#include <dev/iicbus/iicbus.h>
|
||||
@ -176,20 +177,17 @@ iicbus_probe_nomatch(device_t bus, device_t child)
|
||||
}
|
||||
|
||||
int
|
||||
iicbus_child_location_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
iicbus_child_location(device_t bus, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct iicbus_ivar *devi = IICBUS_IVAR(child);
|
||||
|
||||
snprintf(buf, buflen, "addr=%#x", devi->addr);
|
||||
sbuf_printf(sb, "addr=%#x", devi->addr);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
iicbus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
iicbus_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb)
|
||||
{
|
||||
*buf = '\0';
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -368,8 +366,8 @@ static device_method_t iicbus_methods[] = {
|
||||
DEVMETHOD(bus_probe_nomatch, iicbus_probe_nomatch),
|
||||
DEVMETHOD(bus_read_ivar, iicbus_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, iicbus_write_ivar),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, iicbus_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location_str, iicbus_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, iicbus_child_pnpinfo),
|
||||
DEVMETHOD(bus_child_location, iicbus_child_location),
|
||||
DEVMETHOD(bus_hinted_child, iicbus_hinted_child),
|
||||
|
||||
/* iicbus interface */
|
||||
|
@ -95,10 +95,8 @@ int iicbus_read_ivar(device_t bus, device_t child, int which,
|
||||
uintptr_t *result);
|
||||
int iicbus_write_ivar(device_t bus, device_t child, int which,
|
||||
uintptr_t value);
|
||||
int iicbus_child_location_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen);
|
||||
int iicbus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen);
|
||||
int iicbus_child_location(device_t bus, device_t child, struct sbuf *sb);
|
||||
int iicbus_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb);
|
||||
|
||||
extern driver_t iicbus_driver;
|
||||
extern devclass_t iicbus_devclass;
|
||||
|
@ -57,7 +57,7 @@ static device_method_t ofw_iicbus_methods[] = {
|
||||
DEVMETHOD(device_attach, ofw_iicbus_attach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
|
||||
DEVMETHOD(bus_add_child, ofw_iicbus_add_child),
|
||||
|
||||
/* ofw_bus interface */
|
||||
|
@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/sbuf.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
@ -61,8 +62,8 @@ MODULE_VERSION(miibus, 1);
|
||||
|
||||
static device_attach_t miibus_attach;
|
||||
static bus_child_detached_t miibus_child_detached;
|
||||
static bus_child_location_str_t miibus_child_location_str;
|
||||
static bus_child_pnpinfo_str_t miibus_child_pnpinfo_str;
|
||||
static bus_child_location_t miibus_child_location;
|
||||
static bus_child_pnpinfo_t miibus_child_pnpinfo;
|
||||
static device_detach_t miibus_detach;
|
||||
static bus_hinted_child_t miibus_hinted_child;
|
||||
static bus_print_child_t miibus_print_child;
|
||||
@ -87,8 +88,8 @@ static device_method_t miibus_methods[] = {
|
||||
DEVMETHOD(bus_print_child, miibus_print_child),
|
||||
DEVMETHOD(bus_read_ivar, miibus_read_ivar),
|
||||
DEVMETHOD(bus_child_detached, miibus_child_detached),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, miibus_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location_str, miibus_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, miibus_child_pnpinfo),
|
||||
DEVMETHOD(bus_child_location, miibus_child_location),
|
||||
DEVMETHOD(bus_hinted_child, miibus_hinted_child),
|
||||
|
||||
/* MII interface */
|
||||
@ -219,26 +220,24 @@ miibus_read_ivar(device_t dev, device_t child __unused, int which,
|
||||
}
|
||||
|
||||
static int
|
||||
miibus_child_pnpinfo_str(device_t dev __unused, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
miibus_child_pnpinfo(device_t dev __unused, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct mii_attach_args *ma;
|
||||
|
||||
ma = device_get_ivars(child);
|
||||
snprintf(buf, buflen, "oui=0x%x model=0x%x rev=0x%x",
|
||||
sbuf_printf(sb, "oui=0x%x model=0x%x rev=0x%x",
|
||||
MII_OUI(ma->mii_id1, ma->mii_id2),
|
||||
MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2));
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
miibus_child_location_str(device_t dev __unused, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
miibus_child_location(device_t dev __unused, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct mii_attach_args *ma;
|
||||
|
||||
ma = device_get_ivars(child);
|
||||
snprintf(buf, buflen, "phyno=%d", ma->mii_phyno);
|
||||
sbuf_printf(sb, "phyno=%d", ma->mii_phyno);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
@ -143,8 +144,7 @@ SYSCTL_INT(_hw_mmc, OID_AUTO, debug, CTLFLAG_RWTUN, &mmc_debug, 0,
|
||||
/* bus entry points */
|
||||
static int mmc_acquire_bus(device_t busdev, device_t dev);
|
||||
static int mmc_attach(device_t dev);
|
||||
static int mmc_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen);
|
||||
static int mmc_child_location(device_t dev, device_t child, struct sbuf *sb);
|
||||
static int mmc_detach(device_t dev);
|
||||
static int mmc_probe(device_t dev);
|
||||
static int mmc_read_ivar(device_t bus, device_t child, int which,
|
||||
@ -2541,11 +2541,10 @@ mmc_delayed_attach(void *xsc)
|
||||
}
|
||||
|
||||
static int
|
||||
mmc_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
mmc_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
|
||||
snprintf(buf, buflen, "rca=0x%04x", mmc_get_rca(child));
|
||||
sbuf_printf(sb, "rca=0x%04x", mmc_get_rca(child));
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -2560,7 +2559,7 @@ static device_method_t mmc_methods[] = {
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_read_ivar, mmc_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, mmc_write_ivar),
|
||||
DEVMETHOD(bus_child_location_str, mmc_child_location_str),
|
||||
DEVMETHOD(bus_child_location, mmc_child_location),
|
||||
|
||||
/* MMC Bus interface */
|
||||
DEVMETHOD(mmcbus_retune_pause, mmc_retune_pause),
|
||||
|
@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <vm/uma.h>
|
||||
#include <machine/stdarg.h>
|
||||
#include <machine/resource.h>
|
||||
@ -483,11 +484,10 @@ mvs_print_child(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
mvs_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
mvs_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
|
||||
snprintf(buf, buflen, "channel=%d",
|
||||
sbuf_printf(sb, "channel=%d",
|
||||
(int)(intptr_t)device_get_ivars(child));
|
||||
return (0);
|
||||
}
|
||||
@ -510,7 +510,7 @@ static device_method_t mvs_methods[] = {
|
||||
DEVMETHOD(bus_release_resource, mvs_release_resource),
|
||||
DEVMETHOD(bus_setup_intr, mvs_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr,mvs_teardown_intr),
|
||||
DEVMETHOD(bus_child_location_str, mvs_child_location_str),
|
||||
DEVMETHOD(bus_child_location, mvs_child_location),
|
||||
DEVMETHOD(bus_get_dma_tag, mvs_get_dma_tag),
|
||||
DEVMETHOD(mvs_edma, mvs_edma),
|
||||
{ 0, 0 }
|
||||
|
@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <machine/resource.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <arm/mv/mvreg.h>
|
||||
#include <arm/mv/mvvar.h>
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
@ -429,12 +430,10 @@ mvs_print_child(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
mvs_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
mvs_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
|
||||
snprintf(buf, buflen, "channel=%d",
|
||||
(int)(intptr_t)device_get_ivars(child));
|
||||
sbuf_printf(sb, "channel=%d", (int)(intptr_t)device_get_ivars(child));
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -456,7 +455,7 @@ static device_method_t mvs_methods[] = {
|
||||
DEVMETHOD(bus_release_resource, mvs_release_resource),
|
||||
DEVMETHOD(bus_setup_intr, mvs_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr,mvs_teardown_intr),
|
||||
DEVMETHOD(bus_child_location_str, mvs_child_location_str),
|
||||
DEVMETHOD(bus_child_location, mvs_child_location),
|
||||
DEVMETHOD(bus_get_dma_tag, mvs_get_dma_tag),
|
||||
DEVMETHOD(mvs_edma, mvs_edma),
|
||||
{ 0, 0 }
|
||||
|
@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/rmlock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include "ntb.h"
|
||||
@ -168,12 +169,11 @@ ntb_unregister_device(device_t dev)
|
||||
}
|
||||
|
||||
int
|
||||
ntb_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
ntb_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct ntb_child *nc = device_get_ivars(child);
|
||||
|
||||
snprintf(buf, buflen, "function=%d", nc->function);
|
||||
sbuf_printf(sb, "function=%d", nc->function);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,7 @@ SYSCTL_DECL(_hw_ntb);
|
||||
|
||||
int ntb_register_device(device_t ntb);
|
||||
int ntb_unregister_device(device_t ntb);
|
||||
int ntb_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen);
|
||||
int ntb_child_location(device_t dev, device_t child, struct sbuf *sb);
|
||||
int ntb_print_child(device_t dev, device_t child);
|
||||
bus_dma_tag_t ntb_get_dma_tag(device_t bus, device_t child);
|
||||
|
||||
|
@ -1274,7 +1274,7 @@ static device_method_t ntb_amd_methods[] = {
|
||||
DEVMETHOD(device_detach, amd_ntb_detach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_child_location_str, ntb_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ntb_child_location),
|
||||
DEVMETHOD(bus_print_child, ntb_print_child),
|
||||
DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag),
|
||||
|
||||
|
@ -3476,7 +3476,7 @@ static device_method_t ntb_intel_methods[] = {
|
||||
DEVMETHOD(device_attach, intel_ntb_attach),
|
||||
DEVMETHOD(device_detach, intel_ntb_detach),
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_child_location_str, ntb_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ntb_child_location),
|
||||
DEVMETHOD(bus_print_child, ntb_print_child),
|
||||
DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag),
|
||||
/* NTB interface */
|
||||
|
@ -1053,7 +1053,7 @@ static device_method_t ntb_plx_methods[] = {
|
||||
DEVMETHOD(device_attach, ntb_plx_attach),
|
||||
DEVMETHOD(device_detach, ntb_plx_detach),
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_child_location_str, ntb_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ntb_child_location),
|
||||
DEVMETHOD(bus_print_child, ntb_print_child),
|
||||
DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag),
|
||||
/* NTB interface */
|
||||
|
@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/taskqueue.h>
|
||||
|
||||
@ -576,12 +577,11 @@ ntb_transport_print_child(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
ntb_transport_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
ntb_transport_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct ntb_transport_child *nc = device_get_ivars(child);
|
||||
|
||||
snprintf(buf, buflen, "consumer=%d", nc->consumer);
|
||||
sbuf_printf(sb, "consumer=%d", nc->consumer);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1684,7 +1684,7 @@ static device_method_t ntb_transport_methods[] = {
|
||||
DEVMETHOD(device_attach, ntb_transport_attach),
|
||||
DEVMETHOD(device_detach, ntb_transport_detach),
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_child_location_str, ntb_transport_child_location_str),
|
||||
DEVMETHOD(bus_child_location, ntb_transport_child_location),
|
||||
DEVMETHOD(bus_print_child, ntb_transport_print_child),
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/uuid.h>
|
||||
|
||||
#include <contrib/dev/acpica/include/acpi.h>
|
||||
@ -245,20 +246,14 @@ nvdimm_root_write_ivar(device_t dev, device_t child, int index,
|
||||
}
|
||||
|
||||
static int
|
||||
nvdimm_root_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
nvdimm_root_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
ACPI_HANDLE handle;
|
||||
int res;
|
||||
|
||||
handle = nvdimm_root_get_acpi_handle(child);
|
||||
if (handle != NULL)
|
||||
res = snprintf(buf, buflen, "handle=%s", acpi_name(handle));
|
||||
else
|
||||
res = snprintf(buf, buflen, "");
|
||||
sbuf_printf(sb, "handle=%s", acpi_name(handle));
|
||||
|
||||
if (res >= buflen)
|
||||
return (EOVERFLOW);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -269,7 +264,7 @@ static device_method_t nvdimm_acpi_methods[] = {
|
||||
DEVMETHOD(bus_add_child, bus_generic_add_child),
|
||||
DEVMETHOD(bus_read_ivar, nvdimm_root_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, nvdimm_root_write_ivar),
|
||||
DEVMETHOD(bus_child_location_str, nvdimm_root_child_location_str),
|
||||
DEVMETHOD(bus_child_location, nvdimm_root_child_location),
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
|
@ -83,7 +83,7 @@ ofw_bus_get_node_t ofw_bus_gen_get_node;
|
||||
ofw_bus_get_type_t ofw_bus_gen_get_type;
|
||||
|
||||
/* Helper method to report interesting OF properties in pnpinfo */
|
||||
bus_child_pnpinfo_str_t ofw_bus_gen_child_pnpinfo_str;
|
||||
bus_child_pnpinfo_t ofw_bus_gen_child_pnpinfo;
|
||||
|
||||
/* Routines for processing firmware interrupt maps */
|
||||
void ofw_bus_setup_iinfo(phandle_t, struct ofw_bus_iinfo *, int);
|
||||
|
@ -67,7 +67,7 @@ static device_method_t ofw_cpulist_methods[] = {
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_add_child, bus_generic_add_child),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
|
||||
|
||||
/* ofw_bus interface */
|
||||
DEVMETHOD(ofw_bus_get_devinfo, ofw_cpulist_get_devinfo),
|
||||
|
@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <dev/ow/ow.h>
|
||||
@ -589,27 +590,13 @@ ow_detach(device_t ndev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Not sure this is really needed. I'm having trouble figuring out what
|
||||
* location means in the context of the one wire bus.
|
||||
*/
|
||||
static int
|
||||
ow_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
{
|
||||
|
||||
*buf = '\0';
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
ow_child_pnpinfo_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
ow_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct ow_devinfo *di;
|
||||
|
||||
di = device_get_ivars(child);
|
||||
snprintf(buf, buflen, "romid=%8D", &di->romid, ":");
|
||||
sbuf_printf(sb, "romid=%8D", &di->romid, ":");
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -721,8 +708,7 @@ static device_method_t ow_methods[] = {
|
||||
DEVMETHOD(device_detach, ow_detach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ow_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location_str, ow_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ow_child_pnpinfo),
|
||||
DEVMETHOD(bus_read_ivar, ow_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, ow_write_ivar),
|
||||
DEVMETHOD(bus_print_child, ow_print_child),
|
||||
|
@ -1022,34 +1022,28 @@ pccard_probe_nomatch(device_t bus, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
pccard_child_location_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
pccard_child_location(device_t bus, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct pccard_ivar *devi = PCCARD_IVAR(child);
|
||||
struct pccard_function *pf = devi->pf;
|
||||
|
||||
snprintf(buf, buflen, "function=%d", pf->number);
|
||||
sbuf_printf(sb, "function=%d", pf->number);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
pccard_child_pnpinfo_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
pccard_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct pccard_ivar *devi = PCCARD_IVAR(child);
|
||||
struct pccard_function *pf = devi->pf;
|
||||
struct pccard_softc *sc = PCCARD_SOFTC(bus);
|
||||
struct sbuf sb;
|
||||
|
||||
sbuf_new(&sb, buf, buflen, SBUF_FIXEDLEN | SBUF_INCLUDENUL);
|
||||
sbuf_printf(&sb, "manufacturer=0x%04x product=0x%04x "
|
||||
sbuf_printf(sb, "manufacturer=0x%04x product=0x%04x "
|
||||
"cisvendor=\"", sc->card.manufacturer, sc->card.product);
|
||||
devctl_safe_quote_sb(&sb, sc->card.cis1_info[0]);
|
||||
sbuf_printf(&sb, "\" cisproduct=\"");
|
||||
devctl_safe_quote_sb(&sb, sc->card.cis1_info[1]);
|
||||
sbuf_printf(&sb, "\" function_type=%d", pf->function);
|
||||
sbuf_finish(&sb);
|
||||
sbuf_delete(&sb);
|
||||
devctl_safe_quote_sb(sb, sc->card.cis1_info[0]);
|
||||
sbuf_printf(sb, "\" cisproduct=\"");
|
||||
devctl_safe_quote_sb(sb, sc->card.cis1_info[1]);
|
||||
sbuf_printf(sb, "\" function_type=%d", pf->function);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -1455,8 +1449,8 @@ static device_method_t pccard_methods[] = {
|
||||
DEVMETHOD(bus_delete_resource, pccard_delete_resource),
|
||||
DEVMETHOD(bus_probe_nomatch, pccard_probe_nomatch),
|
||||
DEVMETHOD(bus_read_ivar, pccard_read_ivar),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, pccard_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location_str, pccard_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, pccard_child_pnpinfo),
|
||||
DEVMETHOD(bus_child_location, pccard_child_location),
|
||||
|
||||
/* Card Interface */
|
||||
DEVMETHOD(card_set_res_flags, pccard_set_res_flags),
|
||||
|
@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/taskqueue.h>
|
||||
@ -174,8 +175,8 @@ static device_method_t pci_methods[] = {
|
||||
DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource),
|
||||
DEVMETHOD(bus_child_deleted, pci_child_deleted),
|
||||
DEVMETHOD(bus_child_detached, pci_child_detached),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method),
|
||||
DEVMETHOD(bus_child_location_str, pci_child_location_str_method),
|
||||
DEVMETHOD(bus_child_pnpinfo, pci_child_pnpinfo_method),
|
||||
DEVMETHOD(bus_child_location, pci_child_location_method),
|
||||
DEVMETHOD(bus_hint_device_unit, pci_hint_device_unit),
|
||||
DEVMETHOD(bus_remap_intr, pci_remap_intr_method),
|
||||
DEVMETHOD(bus_suspend_child, pci_suspend_child),
|
||||
@ -5847,26 +5848,24 @@ pci_write_config_method(device_t dev, device_t child, int reg,
|
||||
}
|
||||
|
||||
int
|
||||
pci_child_location_str_method(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
pci_child_location_method(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
|
||||
snprintf(buf, buflen, "slot=%d function=%d dbsf=pci%d:%d:%d:%d",
|
||||
sbuf_printf(sb, "slot=%d function=%d dbsf=pci%d:%d:%d:%d",
|
||||
pci_get_slot(child), pci_get_function(child), pci_get_domain(child),
|
||||
pci_get_bus(child), pci_get_slot(child), pci_get_function(child));
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
pci_child_pnpinfo_str_method(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
pci_child_pnpinfo_method(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct pci_devinfo *dinfo;
|
||||
pcicfgregs *cfg;
|
||||
|
||||
dinfo = device_get_ivars(child);
|
||||
cfg = &dinfo->cfg;
|
||||
snprintf(buf, buflen, "vendor=0x%04x device=0x%04x subvendor=0x%04x "
|
||||
sbuf_printf(sb, "vendor=0x%04x device=0x%04x subvendor=0x%04x "
|
||||
"subdevice=0x%04x class=0x%02x%02x%02x", cfg->vendor, cfg->device,
|
||||
cfg->subvendor, cfg->subdevice, cfg->baseclass, cfg->subclass,
|
||||
cfg->progif);
|
||||
|
@ -134,10 +134,10 @@ void pci_print_verbose(struct pci_devinfo *dinfo);
|
||||
int pci_freecfg(struct pci_devinfo *dinfo);
|
||||
void pci_child_deleted(device_t dev, device_t child);
|
||||
void pci_child_detached(device_t dev, device_t child);
|
||||
int pci_child_location_str_method(device_t cbdev, device_t child,
|
||||
char *buf, size_t buflen);
|
||||
int pci_child_pnpinfo_str_method(device_t cbdev, device_t child,
|
||||
char *buf, size_t buflen);
|
||||
int pci_child_location_method(device_t cbdev, device_t child,
|
||||
struct sbuf *sb);
|
||||
int pci_child_pnpinfo_method(device_t cbdev, device_t child,
|
||||
struct sbuf *sb);
|
||||
int pci_assign_interrupt_method(device_t dev, device_t child);
|
||||
int pci_resume(device_t dev);
|
||||
int pci_resume_child(device_t dev, device_t child);
|
||||
|
@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/conf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
@ -748,23 +749,21 @@ puc_bus_print_child(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
int
|
||||
puc_bus_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
puc_bus_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct puc_port *port;
|
||||
|
||||
port = device_get_ivars(child);
|
||||
snprintf(buf, buflen, "port=%d", port->p_nr);
|
||||
sbuf_printf(sb, "port=%d", port->p_nr);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
puc_bus_child_pnpinfo_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
puc_bus_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct puc_port *port;
|
||||
|
||||
port = device_get_ivars(child);
|
||||
snprintf(buf, buflen, "type=%d", port->p_type);
|
||||
sbuf_printf(sb, "type=%d", port->p_type);
|
||||
return (0);
|
||||
}
|
||||
|
@ -85,8 +85,8 @@ int puc_bfe_attach(device_t);
|
||||
int puc_bfe_detach(device_t);
|
||||
int puc_bfe_probe(device_t, const struct puc_cfg *);
|
||||
|
||||
int puc_bus_child_location_str(device_t, device_t, char *, size_t);
|
||||
int puc_bus_child_pnpinfo_str(device_t, device_t, char *, size_t);
|
||||
int puc_bus_child_location(device_t, device_t, struct sbuf *sb);
|
||||
int puc_bus_child_pnpinfo(device_t, device_t, struct sbuf *sb);
|
||||
struct resource *puc_bus_alloc_resource(device_t, device_t, int, int *,
|
||||
rman_res_t, rman_res_t, rman_res_t, u_int);
|
||||
int puc_bus_get_resource(device_t, device_t, int, int, rman_res_t *, rman_res_t *);
|
||||
|
@ -185,8 +185,8 @@ static device_method_t puc_pci_methods[] = {
|
||||
DEVMETHOD(bus_setup_intr, puc_bus_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, puc_bus_teardown_intr),
|
||||
DEVMETHOD(bus_print_child, puc_bus_print_child),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, puc_bus_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location_str, puc_bus_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, puc_bus_child_pnpinfo),
|
||||
DEVMETHOD(bus_child_location, puc_bus_child_location),
|
||||
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
@ -198,7 +198,7 @@ static device_method_t ofw_pwmbus_methods[] = {
|
||||
DEVMETHOD(device_attach, ofw_pwmbus_attach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
|
||||
DEVMETHOD(bus_add_child, ofw_pwmbus_add_child),
|
||||
DEVMETHOD(bus_child_deleted, ofw_pwmbus_child_deleted),
|
||||
|
||||
|
@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sbuf.h>
|
||||
|
||||
#include <dev/pwm/pwmbus.h>
|
||||
|
||||
@ -68,25 +69,17 @@ pwmbus_add_child(device_t dev, u_int order, const char *name, int unit)
|
||||
}
|
||||
|
||||
static int
|
||||
pwmbus_child_location_str(device_t dev, device_t child, char *buf, size_t blen)
|
||||
pwmbus_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct pwmbus_ivars *ivars;
|
||||
|
||||
ivars = device_get_ivars(child);
|
||||
snprintf(buf, blen, "hwdev=%s channel=%u",
|
||||
sbuf_printf(sb, "hwdev=%s channel=%u",
|
||||
device_get_nameunit(device_get_parent(dev)), ivars->pi_channel);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
pwmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
{
|
||||
*buf = '\0';
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
pwmbus_hinted_child(device_t dev, const char *dname, int dunit)
|
||||
{
|
||||
@ -261,8 +254,7 @@ static device_method_t pwmbus_methods[] = {
|
||||
|
||||
/* bus_if */
|
||||
DEVMETHOD(bus_add_child, pwmbus_add_child),
|
||||
DEVMETHOD(bus_child_location_str, pwmbus_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, pwmbus_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location, pwmbus_child_location),
|
||||
DEVMETHOD(bus_hinted_child, pwmbus_hinted_child),
|
||||
DEVMETHOD(bus_print_child, pwmbus_print_child),
|
||||
DEVMETHOD(bus_probe_nomatch, pwmbus_probe_nomatch),
|
||||
|
@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sema.h>
|
||||
#include <sys/taskqueue.h>
|
||||
#include <vm/uma.h>
|
||||
@ -407,11 +408,10 @@ siis_print_child(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
siis_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
siis_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
|
||||
snprintf(buf, buflen, "channel=%d",
|
||||
sbuf_printf(sb, "channel=%d",
|
||||
(int)(intptr_t)device_get_ivars(child));
|
||||
return (0);
|
||||
}
|
||||
@ -435,7 +435,7 @@ static device_method_t siis_methods[] = {
|
||||
DEVMETHOD(bus_release_resource, siis_release_resource),
|
||||
DEVMETHOD(bus_setup_intr, siis_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr,siis_teardown_intr),
|
||||
DEVMETHOD(bus_child_location_str, siis_child_location_str),
|
||||
DEVMETHOD(bus_child_location, siis_child_location),
|
||||
DEVMETHOD(bus_get_dma_tag, siis_get_dma_tag),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
@ -32,11 +32,12 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/sbuf.h>
|
||||
|
||||
#include <dev/smbus/smbconf.h>
|
||||
#include <dev/smbus/smbus.h>
|
||||
@ -135,16 +136,13 @@ smbus_hinted_child(device_t bus, const char *dname, int dunit)
|
||||
}
|
||||
|
||||
static int
|
||||
smbus_child_location_str(device_t parent, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
smbus_child_location(device_t parent, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct smbus_ivar *devi;
|
||||
|
||||
devi = device_get_ivars(child);
|
||||
if (devi->addr != 0)
|
||||
snprintf(buf, buflen, "addr=0x%x", devi->addr);
|
||||
else if (buflen)
|
||||
buf[0] = 0;
|
||||
sbuf_printf(sb, "addr=0x%x", devi->addr);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -228,7 +226,7 @@ static device_method_t smbus_methods[] = {
|
||||
DEVMETHOD(bus_add_child, smbus_add_child),
|
||||
DEVMETHOD(bus_hinted_child, smbus_hinted_child),
|
||||
DEVMETHOD(bus_probe_nomatch, smbus_probe_nomatch),
|
||||
DEVMETHOD(bus_child_location_str, smbus_child_location_str),
|
||||
DEVMETHOD(bus_child_location, smbus_child_location),
|
||||
DEVMETHOD(bus_print_child, smbus_print_child),
|
||||
DEVMETHOD(bus_read_ivar, smbus_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, smbus_write_ivar),
|
||||
|
@ -6738,23 +6738,21 @@ hdaa_print_child(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
hdaa_child_location_str(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
hdaa_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct hdaa_devinfo *devinfo = device_get_softc(dev);
|
||||
struct hdaa_pcm_devinfo *pdevinfo =
|
||||
(struct hdaa_pcm_devinfo *)device_get_ivars(child);
|
||||
struct hdaa_audio_as *as;
|
||||
int first = 1, i, len = 0;
|
||||
int first = 1, i;
|
||||
|
||||
len += snprintf(buf + len, buflen - len, "nid=");
|
||||
sbuf_printf(sb, "nid=");
|
||||
if (pdevinfo->playas >= 0) {
|
||||
as = &devinfo->as[pdevinfo->playas];
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (as->pins[i] <= 0)
|
||||
continue;
|
||||
len += snprintf(buf + len, buflen - len,
|
||||
"%s%d", first ? "" : ",", as->pins[i]);
|
||||
sbuf_printf(sb, "%s%d", first ? "" : ",", as->pins[i]);
|
||||
first = 0;
|
||||
}
|
||||
}
|
||||
@ -6763,8 +6761,7 @@ hdaa_child_location_str(device_t dev, device_t child, char *buf,
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (as->pins[i] <= 0)
|
||||
continue;
|
||||
len += snprintf(buf + len, buflen - len,
|
||||
"%s%d", first ? "" : ",", as->pins[i]);
|
||||
sbuf_printf(sb, "%s%d", first ? "" : ",", as->pins[i]);
|
||||
first = 0;
|
||||
}
|
||||
}
|
||||
@ -6830,7 +6827,7 @@ static device_method_t hdaa_methods[] = {
|
||||
DEVMETHOD(device_resume, hdaa_resume),
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, hdaa_print_child),
|
||||
DEVMETHOD(bus_child_location_str, hdaa_child_location_str),
|
||||
DEVMETHOD(bus_child_location, hdaa_child_location),
|
||||
DEVMETHOD(hdac_stream_intr, hdaa_stream_intr),
|
||||
DEVMETHOD(hdac_unsol_intr, hdaa_unsol_intr),
|
||||
DEVMETHOD(hdac_pindump, hdaa_pindump),
|
||||
|
@ -1774,21 +1774,20 @@ hdac_print_child(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
hdac_child_location_str(device_t dev, device_t child, char *buf, size_t buflen)
|
||||
hdac_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
|
||||
snprintf(buf, buflen, "cad=%d", (int)(intptr_t)device_get_ivars(child));
|
||||
sbuf_printf(sb, "cad=%d", (int)(intptr_t)device_get_ivars(child));
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
hdac_child_pnpinfo_str_method(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
hdac_child_pnpinfo_method(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct hdac_softc *sc = device_get_softc(dev);
|
||||
nid_t cad = (uintptr_t)device_get_ivars(child);
|
||||
|
||||
snprintf(buf, buflen,
|
||||
sbuf_printf(sb,
|
||||
"vendor=0x%04x device=0x%04x revision=0x%02x stepping=0x%02x",
|
||||
sc->codecs[cad].vendor_id, sc->codecs[cad].device_id,
|
||||
sc->codecs[cad].revision_id, sc->codecs[cad].stepping_id);
|
||||
@ -2137,8 +2136,8 @@ static device_method_t hdac_methods[] = {
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_get_dma_tag, hdac_get_dma_tag),
|
||||
DEVMETHOD(bus_print_child, hdac_print_child),
|
||||
DEVMETHOD(bus_child_location_str, hdac_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, hdac_child_pnpinfo_str_method),
|
||||
DEVMETHOD(bus_child_location, hdac_child_location),
|
||||
DEVMETHOD(bus_child_pnpinfo, hdac_child_pnpinfo_method),
|
||||
DEVMETHOD(bus_read_ivar, hdac_read_ivar),
|
||||
DEVMETHOD(hdac_get_mtx, hdac_get_mtx),
|
||||
DEVMETHOD(hdac_codec_command, hdac_codec_command),
|
||||
|
@ -542,21 +542,20 @@ hdacc_detach(device_t dev)
|
||||
}
|
||||
|
||||
static int
|
||||
hdacc_child_location_str(device_t dev, device_t child, char *buf, size_t buflen)
|
||||
hdacc_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct hdacc_fg *fg = device_get_ivars(child);
|
||||
|
||||
snprintf(buf, buflen, "nid=%d", fg->nid);
|
||||
sbuf_printf(sb, "nid=%d", fg->nid);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
hdacc_child_pnpinfo_str_method(device_t dev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
hdacc_child_pnpinfo_method(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct hdacc_fg *fg = device_get_ivars(child);
|
||||
|
||||
snprintf(buf, buflen, "type=0x%02x subsystem=0x%08x",
|
||||
sbuf_printf(sb, "type=0x%02x subsystem=0x%08x",
|
||||
fg->type, fg->subsystem_id);
|
||||
return (0);
|
||||
}
|
||||
@ -766,8 +765,8 @@ static device_method_t hdacc_methods[] = {
|
||||
DEVMETHOD(device_suspend, hdacc_suspend),
|
||||
DEVMETHOD(device_resume, hdacc_resume),
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_child_location_str, hdacc_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, hdacc_child_pnpinfo_str_method),
|
||||
DEVMETHOD(bus_child_location, hdacc_child_location),
|
||||
DEVMETHOD(bus_child_pnpinfo, hdacc_child_pnpinfo_method),
|
||||
DEVMETHOD(bus_print_child, hdacc_print_child),
|
||||
DEVMETHOD(bus_probe_nomatch, hdacc_probe_nomatch),
|
||||
DEVMETHOD(bus_read_ivar, hdacc_read_ivar),
|
||||
|
@ -217,7 +217,7 @@ static device_method_t ofw_spibus_methods[] = {
|
||||
DEVMETHOD(device_attach, ofw_spibus_attach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
|
||||
DEVMETHOD(bus_add_child, ofw_spibus_add_child),
|
||||
DEVMETHOD(bus_get_resource_list, ofw_spibus_get_resource_list),
|
||||
|
||||
|
@ -33,8 +33,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/module.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
@ -119,22 +119,13 @@ spibus_probe_nomatch(device_t bus, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
spibus_child_location_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
spibus_child_location(device_t bus, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct spibus_ivar *devi = SPIBUS_IVAR(child);
|
||||
int cs;
|
||||
|
||||
cs = devi->cs & ~SPIBUS_CS_HIGH; /* trim 'cs high' bit */
|
||||
snprintf(buf, buflen, "bus=%d cs=%d", device_get_unit(bus), cs);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
spibus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
{
|
||||
*buf = '\0';
|
||||
sbuf_printf(sb, "bus=%d cs=%d", device_get_unit(bus), cs);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -270,8 +261,7 @@ static device_method_t spibus_methods[] = {
|
||||
DEVMETHOD(bus_probe_nomatch, spibus_probe_nomatch),
|
||||
DEVMETHOD(bus_read_ivar, spibus_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, spibus_write_ivar),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, spibus_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location_str, spibus_child_location_str),
|
||||
DEVMETHOD(bus_child_location, spibus_child_location),
|
||||
DEVMETHOD(bus_hinted_child, spibus_hinted_child),
|
||||
|
||||
/* spibus interface */
|
||||
|
@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/module.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
@ -802,24 +803,22 @@ superio_child_detached(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
superio_child_location_str(device_t parent, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
superio_child_location(device_t parent, device_t child, struct sbuf *sb)
|
||||
{
|
||||
uint8_t ldn;
|
||||
|
||||
ldn = superio_get_ldn(child);
|
||||
snprintf(buf, buflen, "ldn=0x%02x", ldn);
|
||||
sbuf_printf(sb, "ldn=0x%02x", ldn);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
superio_child_pnp_str(device_t parent, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
superio_child_pnp(device_t parent, device_t child, struct sbuf *sb)
|
||||
{
|
||||
superio_dev_type_t type;
|
||||
|
||||
type = superio_get_type(child);
|
||||
snprintf(buf, buflen, "type=%s", devtype_to_str(type));
|
||||
sbuf_printf(sb, "type=%s", devtype_to_str(type));
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1006,8 +1005,8 @@ static device_method_t superio_methods[] = {
|
||||
|
||||
DEVMETHOD(bus_add_child, superio_add_child),
|
||||
DEVMETHOD(bus_child_detached, superio_child_detached),
|
||||
DEVMETHOD(bus_child_location_str, superio_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, superio_child_pnp_str),
|
||||
DEVMETHOD(bus_child_location, superio_child_location),
|
||||
DEVMETHOD(bus_child_pnpinfo, superio_child_pnp),
|
||||
DEVMETHOD(bus_print_child, superio_print_child),
|
||||
DEVMETHOD(bus_read_ivar, superio_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, superio_write_ivar),
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/condvar.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/sx.h>
|
||||
#include <sys/unistd.h>
|
||||
@ -117,7 +118,7 @@ static device_suspend_t uhub_suspend;
|
||||
static device_resume_t uhub_resume;
|
||||
|
||||
static bus_driver_added_t uhub_driver_added;
|
||||
static bus_child_pnpinfo_str_t uhub_child_pnpinfo_string;
|
||||
static bus_child_pnpinfo_t uhub_child_pnpinfo;
|
||||
|
||||
static usb_callback_t uhub_intr_callback;
|
||||
#if USB_HAVE_TT_SUPPORT
|
||||
@ -166,8 +167,8 @@ static device_method_t uhub_methods[] = {
|
||||
DEVMETHOD(device_suspend, uhub_suspend),
|
||||
DEVMETHOD(device_resume, uhub_resume),
|
||||
|
||||
DEVMETHOD(bus_child_location_str, uhub_child_location_string),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, uhub_child_pnpinfo_string),
|
||||
DEVMETHOD(bus_child_location, uhub_child_location),
|
||||
DEVMETHOD(bus_child_pnpinfo, uhub_child_pnpinfo),
|
||||
DEVMETHOD(bus_driver_added, uhub_driver_added),
|
||||
DEVMETHOD_END
|
||||
};
|
||||
@ -1641,18 +1642,14 @@ uhub_find_iface_index(struct usb_hub *hub, device_t child,
|
||||
}
|
||||
|
||||
int
|
||||
uhub_child_location_string(device_t parent, device_t child,
|
||||
char *buf, size_t buflen)
|
||||
uhub_child_location(device_t parent, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct uhub_softc *sc;
|
||||
struct usb_hub *hub;
|
||||
struct hub_result res;
|
||||
|
||||
if (!device_is_attached(parent)) {
|
||||
if (buflen)
|
||||
buf[0] = 0;
|
||||
if (!device_is_attached(parent))
|
||||
return (0);
|
||||
}
|
||||
|
||||
sc = device_get_softc(parent);
|
||||
hub = sc->sc_udev->hub;
|
||||
@ -1661,12 +1658,9 @@ uhub_child_location_string(device_t parent, device_t child,
|
||||
uhub_find_iface_index(hub, child, &res);
|
||||
if (!res.udev) {
|
||||
DPRINTF("device not on hub\n");
|
||||
if (buflen) {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
snprintf(buf, buflen, "bus=%u hubaddr=%u port=%u devaddr=%u"
|
||||
sbuf_printf(sb, "bus=%u hubaddr=%u port=%u devaddr=%u"
|
||||
" interface=%u"
|
||||
#if USB_HAVE_UGEN
|
||||
" ugen=%s"
|
||||
@ -1686,8 +1680,7 @@ uhub_child_location_string(device_t parent, device_t child,
|
||||
}
|
||||
|
||||
static int
|
||||
uhub_child_pnpinfo_string(device_t parent, device_t child,
|
||||
char *buf, size_t buflen)
|
||||
uhub_child_pnpinfo(device_t parent, device_t child, struct sbuf*sb)
|
||||
{
|
||||
struct uhub_softc *sc;
|
||||
struct usb_hub *hub;
|
||||
@ -1695,11 +1688,8 @@ uhub_child_pnpinfo_string(device_t parent, device_t child,
|
||||
struct hub_result res;
|
||||
uint8_t do_unlock;
|
||||
|
||||
if (!device_is_attached(parent)) {
|
||||
if (buflen)
|
||||
buf[0] = 0;
|
||||
if (!device_is_attached(parent))
|
||||
return (0);
|
||||
}
|
||||
|
||||
sc = device_get_softc(parent);
|
||||
hub = sc->sc_udev->hub;
|
||||
@ -1708,9 +1698,6 @@ uhub_child_pnpinfo_string(device_t parent, device_t child,
|
||||
uhub_find_iface_index(hub, child, &res);
|
||||
if (!res.udev) {
|
||||
DPRINTF("device not on hub\n");
|
||||
if (buflen) {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
iface = usbd_get_iface(res.udev, res.iface_index);
|
||||
@ -1718,7 +1705,7 @@ uhub_child_pnpinfo_string(device_t parent, device_t child,
|
||||
/* Make sure device information is not changed during the print. */
|
||||
do_unlock = usbd_ctrl_lock(res.udev);
|
||||
|
||||
snprintf(buf, buflen, "vendor=0x%04x product=0x%04x "
|
||||
sbuf_printf(sb, "vendor=0x%04x product=0x%04x "
|
||||
"devclass=0x%02x devsubclass=0x%02x "
|
||||
"devproto=0x%02x "
|
||||
"sernum=\"%s\" "
|
||||
@ -1742,11 +1729,6 @@ uhub_child_pnpinfo_string(device_t parent, device_t child,
|
||||
|
||||
if (do_unlock)
|
||||
usbd_ctrl_unlock(res.udev);
|
||||
} else {
|
||||
if (buflen) {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
done:
|
||||
mtx_unlock(&Giant);
|
||||
|
@ -541,18 +541,15 @@ acpi_uhub_read_ivar(device_t dev, device_t child, int idx, uintptr_t *res)
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_uhub_child_location_string(device_t parent, device_t child,
|
||||
char *buf, size_t buflen)
|
||||
acpi_uhub_child_location(device_t parent, device_t child, struct sbuf *sb)
|
||||
{
|
||||
ACPI_HANDLE ah;
|
||||
|
||||
uhub_child_location_string(parent, child, buf, buflen);
|
||||
uhub_child_location(parent, child, sb);
|
||||
|
||||
ah = acpi_get_handle(child);
|
||||
if (ah != NULL) {
|
||||
strlcat(buf, " handle=", buflen);
|
||||
strlcat(buf, acpi_name(ah), buflen);
|
||||
}
|
||||
if (ah != NULL)
|
||||
sbuf_printf(sb, " handle=%s", acpi_name(ah));
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -560,7 +557,7 @@ static device_method_t acpi_uhub_methods[] = {
|
||||
DEVMETHOD(device_probe, acpi_uhub_probe),
|
||||
DEVMETHOD(device_attach, acpi_uhub_attach),
|
||||
DEVMETHOD(device_detach, acpi_uhub_detach),
|
||||
DEVMETHOD(bus_child_location_str, acpi_uhub_child_location_string),
|
||||
DEVMETHOD(bus_child_location, acpi_uhub_child_location),
|
||||
DEVMETHOD(bus_read_ivar, acpi_uhub_read_ivar),
|
||||
DEVMETHOD_END
|
||||
|
||||
@ -571,7 +568,7 @@ static device_method_t acpi_uhub_root_methods[] = {
|
||||
DEVMETHOD(device_attach, acpi_uhub_root_attach),
|
||||
DEVMETHOD(device_detach, acpi_uhub_detach),
|
||||
DEVMETHOD(bus_read_ivar, acpi_uhub_read_ivar),
|
||||
DEVMETHOD(bus_child_location_str, acpi_uhub_child_location_string),
|
||||
DEVMETHOD(bus_child_location, acpi_uhub_child_location),
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
|
@ -80,6 +80,6 @@ uhub_find_iface_index(struct usb_hub *hub, device_t child,
|
||||
device_probe_t uhub_probe;
|
||||
device_attach_t uhub_attach;
|
||||
device_detach_t uhub_detach;
|
||||
bus_child_location_str_t uhub_child_location_string;
|
||||
bus_child_location_t uhub_child_location;
|
||||
|
||||
#endif
|
||||
|
@ -146,7 +146,7 @@ static device_method_t vtmmio_methods[] = {
|
||||
/* Bus interface. */
|
||||
DEVMETHOD(bus_driver_added, vtmmio_driver_added),
|
||||
DEVMETHOD(bus_child_detached, vtmmio_child_detached),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, virtio_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, virtio_child_pnpinfo),
|
||||
DEVMETHOD(bus_read_ivar, vtmmio_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, vtmmio_write_ivar),
|
||||
|
||||
@ -382,7 +382,7 @@ vtmmio_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
|
||||
case VIRTIO_IVAR_DEVICE:
|
||||
/*
|
||||
* Dummy value for fields not present in this bus. Used by
|
||||
* bus-agnostic virtio_child_pnpinfo_str.
|
||||
* bus-agnostic virtio_child_pnpinfo.
|
||||
*/
|
||||
*result = 0;
|
||||
break;
|
||||
|
@ -154,7 +154,7 @@ static device_method_t vtpci_legacy_methods[] = {
|
||||
/* Bus interface. */
|
||||
DEVMETHOD(bus_driver_added, vtpci_legacy_driver_added),
|
||||
DEVMETHOD(bus_child_detached, vtpci_legacy_child_detached),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, virtio_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, virtio_child_pnpinfo),
|
||||
DEVMETHOD(bus_read_ivar, vtpci_legacy_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, vtpci_legacy_write_ivar),
|
||||
|
||||
|
@ -206,7 +206,7 @@ static device_method_t vtpci_modern_methods[] = {
|
||||
/* Bus interface. */
|
||||
DEVMETHOD(bus_driver_added, vtpci_modern_driver_added),
|
||||
DEVMETHOD(bus_child_detached, vtpci_modern_child_detached),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, virtio_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, virtio_child_pnpinfo),
|
||||
DEVMETHOD(bus_read_ivar, vtpci_modern_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, vtpci_modern_write_ivar),
|
||||
|
||||
|
@ -329,8 +329,7 @@ virtio_write_device_config(device_t dev, bus_size_t offset, void *dst, int len)
|
||||
}
|
||||
|
||||
int
|
||||
virtio_child_pnpinfo_str(device_t busdev __unused, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
virtio_child_pnpinfo(device_t busdev __unused, device_t child, struct sbuf *sb)
|
||||
{
|
||||
|
||||
/*
|
||||
@ -344,7 +343,7 @@ virtio_child_pnpinfo_str(device_t busdev __unused, device_t child, char *buf,
|
||||
* see a lot of PNP utility in exposing the same value under a
|
||||
* different name.
|
||||
*/
|
||||
snprintf(buf, buflen, "vendor=0x%08x device=0x%04x subvendor=0x%04x "
|
||||
sbuf_printf(sb, "vendor=0x%08x device=0x%04x subvendor=0x%04x "
|
||||
"device_type=0x%08x", (unsigned)virtio_get_vendor(child),
|
||||
(unsigned)virtio_get_device(child),
|
||||
(unsigned)virtio_get_subvendor(child),
|
||||
|
@ -113,8 +113,7 @@ void virtio_stop(device_t dev);
|
||||
int virtio_config_generation(device_t dev);
|
||||
int virtio_reinit(device_t dev, uint64_t features);
|
||||
void virtio_reinit_complete(device_t dev);
|
||||
int virtio_child_pnpinfo_str(device_t busdev, device_t child, char *buf,
|
||||
size_t buflen);
|
||||
int virtio_child_pnpinfo(device_t busdev, device_t child, struct sbuf *sb);
|
||||
|
||||
/*
|
||||
* Read/write a variable amount from the device specific (ie, network)
|
||||
|
@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/module.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
@ -1032,30 +1033,26 @@ isa_pnp_probe(device_t dev, device_t child, struct isa_pnp_id *ids)
|
||||
}
|
||||
|
||||
static int
|
||||
isa_child_pnpinfo_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
isa_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb)
|
||||
{
|
||||
struct isa_device *idev = DEVTOISA(child);
|
||||
|
||||
if (idev->id_vendorid)
|
||||
snprintf(buf, buflen, "pnpid=%s",
|
||||
sbuf_printf(sb, "pnpid=%s",
|
||||
pnp_eisaformat(idev->id_vendorid));
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
isa_child_location_str(device_t bus, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
isa_child_location(device_t bus, device_t child, struct sbuf *sb)
|
||||
{
|
||||
#if 0
|
||||
/* id_pnphandle isn't there yet */
|
||||
struct isa_device *idev = DEVTOISA(child);
|
||||
|
||||
if (idev->id_vendorid)
|
||||
snprintf(buf, buflen, "pnphandle=%d", idev->id_pnphandle);
|
||||
sbuf_printf(sbuf, "pnphandle=%d", idev->id_pnphandle);
|
||||
#endif
|
||||
/* Nothing here yet */
|
||||
*buf = '\0';
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1087,8 +1084,8 @@ static device_method_t isa_methods[] = {
|
||||
DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, isa_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_location_str, isa_child_location_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, isa_child_pnpinfo),
|
||||
DEVMETHOD(bus_child_location, isa_child_location),
|
||||
DEVMETHOD(bus_hinted_child, isa_hinted_child),
|
||||
DEVMETHOD(bus_hint_device_unit, isa_hint_device_unit),
|
||||
|
||||
|
@ -654,8 +654,7 @@ METHOD int child_present {
|
||||
/**
|
||||
* @brief Returns the pnp info for this device.
|
||||
*
|
||||
* Return it as a string. If the storage is insufficient for the
|
||||
* string, then return EOVERFLOW.
|
||||
* Return it as a string, appended to @p _sb
|
||||
*
|
||||
* The string must be formatted as a space-separated list of
|
||||
* name=value pairs. Names may only contain alphanumeric characters,
|
||||
@ -666,22 +665,18 @@ METHOD int child_present {
|
||||
*
|
||||
* @param _dev the parent device of @p _child
|
||||
* @param _child the device which is being examined
|
||||
* @param _buf the address of a buffer to receive the pnp
|
||||
* string
|
||||
* @param _buflen the size of the buffer pointed to by @p _buf
|
||||
* @param _sb sbuf for results string
|
||||
*/
|
||||
METHOD int child_pnpinfo_str {
|
||||
METHOD int child_pnpinfo {
|
||||
device_t _dev;
|
||||
device_t _child;
|
||||
char *_buf;
|
||||
size_t _buflen;
|
||||
};
|
||||
struct sbuf *_sb;
|
||||
} DEFAULT bus_generic_child_pnpinfo;
|
||||
|
||||
/**
|
||||
* @brief Returns the location for this device.
|
||||
*
|
||||
* Return it as a string. If the storage is insufficient for the
|
||||
* string, then return EOVERFLOW.
|
||||
* Return it as a string, appended to @p _sb
|
||||
*
|
||||
* The string must be formatted as a space-separated list of
|
||||
* name=value pairs. Names may only contain alphanumeric characters,
|
||||
@ -692,16 +687,13 @@ METHOD int child_pnpinfo_str {
|
||||
*
|
||||
* @param _dev the parent device of @p _child
|
||||
* @param _child the device which is being examined
|
||||
* @param _buf the address of a buffer to receive the location
|
||||
* string
|
||||
* @param _buflen the size of the buffer pointed to by @p _buf
|
||||
* @param _sb sbuf for results string
|
||||
*/
|
||||
METHOD int child_location_str {
|
||||
METHOD int child_location {
|
||||
device_t _dev;
|
||||
device_t _child;
|
||||
char *_buf;
|
||||
size_t _buflen;
|
||||
};
|
||||
struct sbuf *_sb;
|
||||
} DEFAULT bus_generic_child_location;
|
||||
|
||||
/**
|
||||
* @brief Allow drivers to request that an interrupt be bound to a specific
|
||||
|
@ -159,8 +159,6 @@ EVENTHANDLER_LIST_DEFINE(device_attach);
|
||||
EVENTHANDLER_LIST_DEFINE(device_detach);
|
||||
EVENTHANDLER_LIST_DEFINE(dev_lookup);
|
||||
|
||||
static int bus_child_location_sb(device_t child, struct sbuf *sb);
|
||||
static int bus_child_pnpinfo_sb(device_t child, struct sbuf *sb);
|
||||
static void devctl2_init(void);
|
||||
static bool device_frozen;
|
||||
|
||||
@ -276,10 +274,10 @@ device_sysctl_handler(SYSCTL_HANDLER_ARGS)
|
||||
sbuf_cat(&sb, dev->driver ? dev->driver->name : "");
|
||||
break;
|
||||
case DEVICE_SYSCTL_LOCATION:
|
||||
bus_child_location_sb(dev, &sb);
|
||||
bus_child_location(dev, &sb);
|
||||
break;
|
||||
case DEVICE_SYSCTL_PNPINFO:
|
||||
bus_child_pnpinfo_sb(dev, &sb);
|
||||
bus_child_pnpinfo(dev, &sb);
|
||||
break;
|
||||
case DEVICE_SYSCTL_PARENT:
|
||||
sbuf_cat(&sb, dev->parent ? dev->parent->nameunit : "");
|
||||
@ -736,11 +734,11 @@ devaddq(const char *type, const char *what, device_t dev)
|
||||
sbuf_cat(&sb, " at ");
|
||||
|
||||
/* Add in the location */
|
||||
bus_child_location_sb(dev, &sb);
|
||||
bus_child_location(dev, &sb);
|
||||
sbuf_putc(&sb, ' ');
|
||||
|
||||
/* Add in pnpinfo */
|
||||
bus_child_pnpinfo_sb(dev, &sb);
|
||||
bus_child_pnpinfo(dev, &sb);
|
||||
|
||||
/* Get the parent of this device, or / if high enough in the tree. */
|
||||
if (device_get_parent(dev) == NULL)
|
||||
@ -4947,109 +4945,63 @@ bus_child_present(device_t child)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wrapper function for BUS_CHILD_PNPINFO_STR().
|
||||
* @brief Wrapper function for BUS_CHILD_PNPINFO().
|
||||
*
|
||||
* This function simply calls the BUS_CHILD_PNPINFO_STR() method of the
|
||||
* parent of @p dev.
|
||||
* This function simply calls the BUS_CHILD_PNPINFO() method of the parent of @p
|
||||
* dev.
|
||||
*/
|
||||
int
|
||||
bus_child_pnpinfo_str(device_t child, char *buf, size_t buflen)
|
||||
bus_child_pnpinfo(device_t child, struct sbuf *sb)
|
||||
{
|
||||
device_t parent;
|
||||
|
||||
parent = device_get_parent(child);
|
||||
if (parent == NULL) {
|
||||
*buf = '\0';
|
||||
if (parent == NULL)
|
||||
return (0);
|
||||
}
|
||||
return (BUS_CHILD_PNPINFO_STR(parent, child, buf, buflen));
|
||||
return (BUS_CHILD_PNPINFO(parent, child, sb));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wrapper function for BUS_CHILD_LOCATION_STR().
|
||||
* @brief Generic implementation that does nothing for bus_child_pnpinfo
|
||||
*
|
||||
* This function simply calls the BUS_CHILD_LOCATION_STR() method of the
|
||||
* parent of @p dev.
|
||||
* This function has the right signature and returns 0 since the sbuf is passed
|
||||
* to us to append to.
|
||||
*/
|
||||
int
|
||||
bus_child_location_str(device_t child, char *buf, size_t buflen)
|
||||
bus_generic_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wrapper function for BUS_CHILD_LOCATION().
|
||||
*
|
||||
* This function simply calls the BUS_CHILD_LOCATION() method of the parent of
|
||||
* @p dev.
|
||||
*/
|
||||
int
|
||||
bus_child_location(device_t child, struct sbuf *sb)
|
||||
{
|
||||
device_t parent;
|
||||
|
||||
parent = device_get_parent(child);
|
||||
if (parent == NULL) {
|
||||
*buf = '\0';
|
||||
if (parent == NULL)
|
||||
return (0);
|
||||
}
|
||||
return (BUS_CHILD_LOCATION_STR(parent, child, buf, buflen));
|
||||
return (BUS_CHILD_LOCATION(parent, child, sb));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wrapper function for bus_child_pnpinfo_str using sbuf
|
||||
* @brief Generic implementation that does nothing for bus_child_location
|
||||
*
|
||||
* A convenient wrapper frunction for bus_child_pnpinfo_str that allows
|
||||
* us to splat that into an sbuf. It uses unholy knowledge of sbuf to
|
||||
* accomplish this, however. It is an interim function until we can convert
|
||||
* this interface more fully.
|
||||
* This function has the right signature and returns 0 since the sbuf is passed
|
||||
* to us to append to.
|
||||
*/
|
||||
/* Note: we reach inside of sbuf because it's API isn't rich enough to do this */
|
||||
#define SPACE(s) ((s)->s_size - (s)->s_len)
|
||||
#define EOB(s) ((s)->s_buf + (s)->s_len)
|
||||
|
||||
static int
|
||||
bus_child_pnpinfo_sb(device_t dev, struct sbuf *sb)
|
||||
int
|
||||
bus_generic_child_location(device_t dev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
char *p;
|
||||
ssize_t space;
|
||||
|
||||
MPASS((sb->s_flags & SBUF_INCLUDENUL) == 0);
|
||||
MPASS(sb->s_size >= sb->s_len);
|
||||
if (sb->s_error != 0)
|
||||
return (-1);
|
||||
space = SPACE(sb);
|
||||
if (space <= 1) {
|
||||
sb->s_error = ENOMEM;
|
||||
return (-1);
|
||||
}
|
||||
p = EOB(sb);
|
||||
*p = '\0'; /* sbuf buffer isn't NUL terminated until sbuf_finish() */
|
||||
bus_child_pnpinfo_str(dev, p, space);
|
||||
sb->s_len += strlen(p);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wrapper function for bus_child_pnpinfo_str using sbuf
|
||||
*
|
||||
* A convenient wrapper frunction for bus_child_pnpinfo_str that allows
|
||||
* us to splat that into an sbuf. It uses unholy knowledge of sbuf to
|
||||
* accomplish this, however. It is an interim function until we can convert
|
||||
* this interface more fully.
|
||||
*/
|
||||
static int
|
||||
bus_child_location_sb(device_t dev, struct sbuf *sb)
|
||||
{
|
||||
char *p;
|
||||
ssize_t space;
|
||||
|
||||
MPASS((sb->s_flags & SBUF_INCLUDENUL) == 0);
|
||||
MPASS(sb->s_size >= sb->s_len);
|
||||
if (sb->s_error != 0)
|
||||
return (-1);
|
||||
space = SPACE(sb);
|
||||
if (space <= 1) {
|
||||
sb->s_error = ENOMEM;
|
||||
return (-1);
|
||||
}
|
||||
p = EOB(sb);
|
||||
*p = '\0'; /* sbuf buffer isn't NUL terminated until sbuf_finish() */
|
||||
bus_child_location_str(dev, p, space);
|
||||
sb->s_len += strlen(p);
|
||||
return (0);
|
||||
}
|
||||
#undef SPACE
|
||||
#undef EOB
|
||||
|
||||
/**
|
||||
* @brief Wrapper function for BUS_GET_CPUS().
|
||||
*
|
||||
@ -5579,9 +5531,9 @@ sysctl_devices(SYSCTL_HANDLER_ARGS)
|
||||
if (dev->driver != NULL)
|
||||
sbuf_cat(&sb, dev->driver->name);
|
||||
sbuf_putc(&sb, '\0');
|
||||
bus_child_pnpinfo_sb(dev, &sb);
|
||||
bus_child_pnpinfo(dev, &sb);
|
||||
sbuf_putc(&sb, '\0');
|
||||
bus_child_location_sb(dev, &sb);
|
||||
bus_child_location(dev, &sb);
|
||||
sbuf_putc(&sb, '\0');
|
||||
error = sbuf_finish(&sb);
|
||||
if (error == 0)
|
||||
|
@ -66,8 +66,8 @@ static pci_alloc_devinfo_t ofw_pcibus_alloc_devinfo;
|
||||
static pci_assign_interrupt_t ofw_pcibus_assign_interrupt;
|
||||
static ofw_bus_get_devinfo_t ofw_pcibus_get_devinfo;
|
||||
static bus_child_deleted_t ofw_pcibus_child_deleted;
|
||||
static int ofw_pcibus_child_pnpinfo_str_method(device_t cbdev, device_t child,
|
||||
char *buf, size_t buflen);
|
||||
static int ofw_pcibus_child_pnpinfo_method(device_t cbdev, device_t child,
|
||||
struct sbuf *sb);
|
||||
|
||||
static void ofw_pcibus_enum_devtree(device_t dev, u_int domain, u_int busno);
|
||||
static void ofw_pcibus_enum_bus(device_t dev, u_int domain, u_int busno);
|
||||
@ -79,7 +79,7 @@ static device_method_t ofw_pcibus_methods[] = {
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_child_deleted, ofw_pcibus_child_deleted),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ofw_pcibus_child_pnpinfo_str_method),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_pcibus_child_pnpinfo_method),
|
||||
DEVMETHOD(bus_rescan, bus_null_rescan),
|
||||
DEVMETHOD(bus_get_cpus, ofw_pcibus_get_cpus),
|
||||
DEVMETHOD(bus_get_domain, ofw_pcibus_get_domain),
|
||||
@ -300,14 +300,13 @@ ofw_pcibus_child_deleted(device_t dev, device_t child)
|
||||
}
|
||||
|
||||
static int
|
||||
ofw_pcibus_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf,
|
||||
size_t buflen)
|
||||
ofw_pcibus_child_pnpinfo_method(device_t cbdev, device_t child, struct sbuf *sb)
|
||||
{
|
||||
pci_child_pnpinfo_str_method(cbdev, child, buf, buflen);
|
||||
pci_child_pnpinfo_method(cbdev, child, sb);
|
||||
|
||||
if (ofw_bus_get_node(child) != -1) {
|
||||
strlcat(buf, " ", buflen); /* Separate info */
|
||||
ofw_bus_gen_child_pnpinfo_str(cbdev, child, buf, buflen);
|
||||
sbuf_cat(sb, " "); /* Separate info */
|
||||
ofw_bus_gen_child_pnpinfo(cbdev, child, sb);
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
@ -104,7 +104,7 @@ static device_method_t macgpio_methods[] = {
|
||||
DEVMETHOD(bus_deactivate_resource, macgpio_deactivate_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
|
||||
|
||||
/* ofw_bus interface */
|
||||
DEVMETHOD(ofw_bus_get_devinfo, macgpio_get_devinfo),
|
||||
|
@ -114,7 +114,7 @@ static device_method_t macio_methods[] = {
|
||||
DEVMETHOD(bus_deactivate_resource, macio_deactivate_resource),
|
||||
DEVMETHOD(bus_get_resource_list, macio_get_resource_list),
|
||||
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
|
||||
|
||||
/* ofw_bus interface */
|
||||
DEVMETHOD(ofw_bus_get_devinfo, macio_get_devinfo),
|
||||
|
@ -196,7 +196,7 @@ static device_method_t smu_methods[] = {
|
||||
DEVMETHOD(clock_settime, smu_settime),
|
||||
|
||||
/* ofw_bus interface */
|
||||
DEVMETHOD(bus_child_pnpinfo_str,ofw_bus_gen_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
|
||||
DEVMETHOD(ofw_bus_get_devinfo, smu_get_devinfo),
|
||||
DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat),
|
||||
DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model),
|
||||
|
@ -117,7 +117,7 @@ static device_method_t unin_chip_methods[] = {
|
||||
DEVMETHOD(bus_deactivate_resource, unin_chip_deactivate_resource),
|
||||
DEVMETHOD(bus_get_resource_list, unin_chip_get_resource_list),
|
||||
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
|
||||
|
||||
/* ofw_bus interface */
|
||||
DEVMETHOD(ofw_bus_get_devinfo, unin_chip_get_devinfo),
|
||||
|
@ -75,7 +75,7 @@ static device_method_t opaldev_methods[] = {
|
||||
DEVMETHOD(clock_settime, opal_settime),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
|
||||
|
||||
/* ofw_bus interface */
|
||||
DEVMETHOD(ofw_bus_get_devinfo, opaldev_get_devinfo),
|
||||
|
@ -71,7 +71,7 @@ static device_method_t vdevice_methods[] = {
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_add_child, bus_generic_add_child),
|
||||
DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
|
||||
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
|
||||
DEVMETHOD(bus_print_child, vdevice_print_child),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
@ -426,6 +426,8 @@ int bus_generic_translate_resource(device_t dev, int type, rman_res_t start,
|
||||
int bus_generic_attach(device_t dev);
|
||||
int bus_generic_bind_intr(device_t dev, device_t child,
|
||||
struct resource *irq, int cpu);
|
||||
int bus_generic_child_location(device_t dev, device_t child, struct sbuf *sb);
|
||||
int bus_generic_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb);
|
||||
int bus_generic_child_present(device_t dev, device_t child);
|
||||
int bus_generic_config_intr(device_t, int, enum intr_trigger,
|
||||
enum intr_polarity);
|
||||
@ -551,8 +553,8 @@ rman_res_t bus_get_resource_start(device_t dev, int type, int rid);
|
||||
rman_res_t bus_get_resource_count(device_t dev, int type, int rid);
|
||||
void bus_delete_resource(device_t dev, int type, int rid);
|
||||
int bus_child_present(device_t child);
|
||||
int bus_child_pnpinfo_str(device_t child, char *buf, size_t buflen);
|
||||
int bus_child_location_str(device_t child, char *buf, size_t buflen);
|
||||
int bus_child_pnpinfo(device_t child, struct sbuf *sb);
|
||||
int bus_child_location(device_t child, struct sbuf *sb);
|
||||
void bus_enumerate_hinted_children(device_t bus);
|
||||
int bus_delayed_attach_children(device_t bus);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user