#
9dbf5b0e |
|
13-Mar-2024 |
John Baldwin <jhb@FreeBSD.org> |
new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCE The public bus_release_resource() API still accepts both forms, but the internal kobj method no longer passes the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44131
|
#
2baed46e |
|
13-Mar-2024 |
John Baldwin <jhb@FreeBSD.org> |
new-bus: Remove the 'rid' and 'type' arguments from BUS_*ACTIVATE_RESOURCE The public bus_activate/deactivate_resource() API still accepts both forms, but the internal kobj methods no longer pass the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44130
|
#
d77f2092 |
|
13-Mar-2024 |
John Baldwin <jhb@FreeBSD.org> |
new-bus: Remove the 'type' argument from BUS_MAP/UNMAP_RESOURCE The public bus_map/unmap_resource() API still accepts both forms, but the internal kobj methods no longer pass the argument. Implementations which need the type now use rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44129
|
#
fef01f04 |
|
13-Mar-2024 |
John Baldwin <jhb@FreeBSD.org> |
new-bus: Remove the 'type' argument from BUS_ADJUST_RESOURCE The public bus_adjust_resource() API still accepts both forms, but the internal kobj method no longer passes the argument. Implementations which need the type now use rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44128
|
#
9edb8d0a |
|
13-Mar-2024 |
John Baldwin <jhb@FreeBSD.org> |
new-bus: Introduce a simpler bus API for managing resources Remove the 'type' and 'rid' arguments from the wrapper bus API functions (e.g. bus_release_resource) that accept a struct resource. The "new" versions extract the 'type' and/or 'rid' from the passed in resource object via rman_get_type and rman_get_rid. This commit adds the new API as functions with a _new suffix. Wrapper macros choose between the old and new functions based on the number of arguments provided to the macro. This commit does not change the ABI but can be safely MFCd to older branches so long as older kernels use rman_set_type when allocating resources. Future commits will push the removal of these extraneous arguments through the bus implementation. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44124
|
#
6b6914c1 |
|
16-Jan-2024 |
Christos Margiolis <christos@FreeBSD.org> |
subr_bus: introduce device_set_descf() and modify allocation logic device_set_descf() is a printf-like version of device_set_desc(). Allocation code has been transferred from device_set_desc_internal() to device_set_desc_copy() and device_set_descf() to avoid complicating device_set_desc_internal(). The "copy" argument in device_set_desc_internal() has been replaced with a flag which is set when the description string has been allocated with M_BUS. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: imp, markj Differential Revision: https://reviews.freebsd.org/D43370
|
#
751615c5 |
|
24-Nov-2023 |
John Baldwin <jhb@FreeBSD.org> |
newbus: Add a set of bus resource helpers for nexus-like devices These routines can be used to implement bus_alloc/adjust/activate/deactive/release_resource on bus drivers which suballocate resources from rman(9) resource managers. These methods require a new bus_get_rman method in the bus driver to return the suitable rman for a given resource type. The activate/deactivate helpers also require the bus to implement the bus_map/ummap_resource methods. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D42739
|
#
19f073c6 |
|
23-Nov-2023 |
John Baldwin <jhb@FreeBSD.org> |
new-bus: Add resource_validate_map_request function This helper function for BUS_MAP_RESOURCE performs common argument validation. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D42723
|
#
95ee2897 |
|
16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: two-line .h pattern Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
#
4d846d26 |
|
10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
|
#
7b5d62bb |
|
18-Oct-2022 |
Takanori Watanabe <takawata@FreeBSD.org> |
ofw: add BUS_GET_DEVICE_PATH interface to openfirm/fdt, somewhat incomplete. This add BUS_GET_DEVICE_PATH interface, which shows device tree of openfirm/fdt. In qemu-system-arm64 with "virt" machine with device-tree firmware, % devctl getpath OFW cpu0 Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D37031
|
#
99e6980f |
|
28-Sep-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
device_get_property: add a HANDLE case This will resolve a reference and return the appropriate handle, a node on the simplebus or an ACPI_HANDLE for ACPI. For now we do not try to further abstract the return type. MFC after: 2 weeks Reviewed by: mw Differential Revision: https://reviews.freebsd.org/D36793
|
#
af390486 |
|
07-Oct-2022 |
Mitchell Horne <mhorne@FreeBSD.org> |
bus.h: rewrite comment describing intr_type Describe more clearly the purpose of these flags and where they are used. Remove grog's comment about revisiting the flags. At this point it does not make sense to change this long-standing API, especially in light of 2cf7870864ea ("Collapse interrupt thread priorities"). Give a better example of a bus modifying these flags; I did not find any existing instance where a bus changes the interrupt's type. Reviewed by: imp, markj, jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36896
|
#
9e4e7bca |
|
23-Aug-2022 |
John Baldwin <jhb@FreeBSD.org> |
*DRIVER_MODULE*: Remove the compat shims to accept the devclass argument. PR: 264969 (exp-run) Differential Revision: https://reviews.freebsd.org/D35168
|
#
29afffb9 |
|
23-Jun-2022 |
Mitchell Horne <mhorne@FreeBSD.org> |
subr_bus: restore bus_null_rescan() Partially revert the previous change; we need to keep this method as a specific override for pci_driver subclasses which should not use pci_rescan_method() -- cardbus and ofw_pcibus. However, change the return value to ENODEV for the same reasoning given in the original commit, and use this as the default rescan method in bus_if.m. Reported by: jhb Fixes: 36a8572ee8f5 ("bus_if: provide a default null rescan method") MFC with: 36a8572ee8f5
|
#
36a8572e |
|
21-Jun-2022 |
Mitchell Horne <mhorne@FreeBSD.org> |
bus_if: provide a default null rescan method There is an existing helper method in subr_bus.c, but almost no drivers know to use it. It also returns the same error as an empty method, making it not very useful. Move this to bus_if.m and return a more sensible error code. This gives a slightly more meaningful error message when attempting 'devctl rescan' on buses and devices alike: "Device not configured" --> "Operation not supported by device" Reviewed by: imp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35501
|
#
0fdf5bc5 |
|
05-May-2022 |
John Baldwin <jhb@FreeBSD.org> |
Remove extraneous devclass argument from DRIVER_MODULE_ORDERED6. This is the variant of DRIVER_MODULE_ORDERED that does not accept a devclass argument. Fixes: 2a99dd30dfaa Deprecate the 'devclass' argument from *DRIVER_MODULE() macros.
|
#
2a99dd30 |
|
19-Apr-2022 |
John Baldwin <jhb@FreeBSD.org> |
Deprecate the 'devclass' argument from *DRIVER_MODULE() macros. This argument is useless for the vast majority of drivers. For now, use __VA_ARGS__ wrapper macros so that that the *DRIVER_MODULE() macros accept both the old version (with a devclass) and the new version (which omits the argument and stores NULL in the driver_module_data structure). This provides an API compatiblity shim that can be merged to older stable branches. Once all drivers relevant to 14.0 (both in and out of tree) have been updated, the API compat shims can be dropped. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D34963
|
#
b344de4d |
|
28-Jan-2022 |
Kornel Duleba <mindal@semihalf.com> |
Extend device_get_property API In order to support various types of data stored in device tree properties or ACPI _DSD packages, create a new enum so the caller can specify the expected type of a property they want to read, according to the binding. The bus logic will use that information to process the underlying data. For example in DT all integer properties are stored in BE format. In order to get constant results across different platforms we need to convert its endianness to match the host. Another example are ACPI_TYPE_INTEGER properties stored as uint64_t. Before this patch the ACPI logic would refuse to read them if the provided buffer was smaller than 8 bytes. Now this can be handled by using DEVICE_PROP_UINT32 type. Modify the existing consumers of this API to reflect the changes and update the man pages accordingly. Reviewed by: mw Obtained from: Semihalf MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D33457
|
#
206dc82b |
|
25-Jan-2022 |
Kornel Duleba <mindal@semihalf.com> |
bus_if: Add a default implementation of get_property There are multiple buses that pretend to be ofw compatible, e.g ofw_pci, mii_fdt. We now need to provide an implementation of BUS_GET_PROPERTY for every one of them. Instead of modifying them one by one it's better to just provide a default implementation that simply traverses up the device tree. Remove the now unneeded BUS_GET_PROPERTY implementation in mii_fdt. Reviewed by: andrew, bz Obtained from: Semihalf MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D34031
|
#
b36bd3a9 |
|
28-Feb-2022 |
Warner Losh <imp@FreeBSD.org> |
bus: Create dev_wired_cache A simple cache to cache differnet locators to the same device. Sponsored by: Netflix Changes Suggested by: jhb Differential Revision: https://reviews.freebsd.org/D32783
|
#
d0a20e40 |
|
28-Feb-2022 |
Warner Losh <imp@FreeBSD.org> |
Add UEFI locator for bus_get_device_path, pci acpi Add a UEFI locator type. It prints the UEFI device names for a FreeBSD device_t name. It works with PCI and ACPI device nodes. USB forthcoming. Sponsored by: Netflix Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D32749
|
#
cae7d9ec |
|
28-Feb-2022 |
Warner Losh <imp@FreeBSD.org> |
bus: Add ACPI locator support Add support for printing ACPI paths. This is a bit of a degenerate case for this interface since it's always just the device handle if the device has one. But it is illustrtive of how to do this for a few nodes in the tree. Sponsored by: Netflix Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D32748
|
#
38e942a3 |
|
28-Feb-2022 |
Warner Losh <imp@FreeBSD.org> |
devctl: Add DEV_GET_PATH DEV_GET_PATH will get the path to a device based on different locators. Sponsored by: Netflix Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D32745
|
#
e19db707 |
|
28-Feb-2022 |
Warner Losh <imp@FreeBSD.org> |
bus: Introduce the bus interface get_device_path This returns the full path of a the child device requested. Since there's different ways to recon the entire path, include a 'locator' method. The default 'FreeBSD' method uses a filesystem-like path name with each device to the root node separated by /. Other locators will be UEFI, ACPI and fdt, though others are possible in the future. Make the locator a string to allow maximum flexibility. Sponsored by: Netflix Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D32744
|
#
d14bc723 |
|
09-Dec-2021 |
Warner Losh <imp@FreeBSD.org> |
newbus: add bus_topo_assert Add bus_topo_assert() and implmement it as GIANT_REQUIRED for the moment. This will allow us to change more easily to a newbus-specific lock int he future. Sponsored by: Netflix Reviewed by: wulf, mav, jhb Differential Revision: https://reviews.freebsd.org/D31833
|
#
c6df6f53 |
|
09-Dec-2021 |
Warner Losh <imp@FreeBSD.org> |
Create wrapper for Giant taken for newbus Create a wrapper for newbus to take giant and for busses to take it too. bus_topo_lock() should be called before interacting with newbus routines and unlocked with bus_topo_unlock(). If you need the topology lock for some reason, bus_topo_mtx() will provide that. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D31831
|
#
1c7d15b0 |
|
30-Nov-2021 |
Warner Losh <imp@FreeBSD.org> |
Make device_busy/unbusy work w/o Giant held The vast majority of the busy/unbusy users in the tree don't acquire Giant before calling device_busy/unbusy. However, if multiple threads are opening a file, say, that causes the device to busy/unbusy, then we can race to the root marking things busy. Move to using a reference count to keep track of how many times a device_t has been made busy. Use that count to make the same decisions that we'd make with the old device state. Note: gpiopps.c uses D_TRACKCLOSE. Others do as well. However, there's a known race with closes that will be corrected for all the drivers that do this in a future commit. Sponsored by: Netflix Reviewed by: hselasky, jhb Differential Revision: https://reviews.freebsd.org/D26284
|
#
25c49c42 |
|
30-Nov-2021 |
Warner Losh <imp@FreeBSD.org> |
Revert "Make device_busy/unbusy work w/o Giant held" This reverts commit 08e781915363f98f4318a864b3b5a52bd99424c6. Commit message was for a very old version of the patch. Will re-commit with the right one since it's so bad. There's no locked versions of it...that code was reworked to use refcnt APIs. Noticed by: jhb, jtrc27 Sponsored by: Netflix
|
#
08e78191 |
|
30-Nov-2021 |
Warner Losh <imp@FreeBSD.org> |
Make device_busy/unbusy work w/o Giant held The vast majority of the busy/unbusy users in the tree don't acquire Giant before calling device_busy/unbusy. However, if multiple threads are opening a file, say, that causes the device to busy/unbusy, then we can race to the root marking things busy. Create a new device_busy_locked and device_unbusy_locked that are the current implemntations of device_busy and device_unbusy. Make device_busy and unbusy acquire Giant before calling the _locked versrions. Since we never sleep in the busy/unbusy path, Giant's single threaded semantics suffice to keep this safe. Sponsored by: Netflix Reviewed by: hselasky, jhb Differential Revision: https://reviews.freebsd.org/D26284
|
#
1fb99e97 |
|
15-Nov-2021 |
Mark Johnston <markj@FreeBSD.org> |
bus: Make BUS_TRANSLATE_RESOURCE behave more like other bus methods - Return an errno value upon failure, instead of 1. - Provide a bus_translate_resource() wrapper. - Implement the generic version, which traverses the hierarchy until a bus driver with a non-trivial implementation is found, in subr_bus.c like other similar default implementations. - Make ofw_pcib_translate_resource() return an error if a matching PCI address range is not found. - Make generic_pcie_translate_resource_common() return an int instead of a bool. Fix up callers. No functional change intended. Reviewed by: imp, jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32855
|
#
2ff7c2cc |
|
20-Oct-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
sys/bus.h: silence warnings about write-only variables in the generated functions for bus accessors. These are the most noising instances for drivers when non-debug kernel is compiled with clang 13. Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32578
|
#
0389e9be |
|
24-Sep-2021 |
Warner Losh <imp@FreeBSD.org> |
bus: retire DF_REBID I did DF_REBID to allow for 'hoover' drivers that would attach to otherwise unattached devices in the tree. This notion didn't catch on as it was tricky to make work well and it was easier to just publish a /dev node of some flavor by the parent device. It's been nothing but dead weight for a long time. Reviewed by: mav Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32056
|
#
3f9a00e3 |
|
30-Jul-2021 |
Bartlomiej Grzesik <bag@semihalf.com> |
device: add device_get_property and device_has_property Generialize bus specific property accessors. Those functions allow driver code to access device specific information. Currently there is only support for FDT and ACPI buses. Reviewed by: manu, mw Sponsored by: Semihalf Differential revision: https://reviews.freebsd.org/D31597
|
#
ddfc9c4c |
|
22-Jun-2021 |
Warner Losh <imp@FreeBSD.org> |
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
|
#
e81b1463 |
|
17-Apr-2021 |
Warner Losh <imp@FreeBSD.org> |
newbus: Minor update fix. driver_t was supposed to just be a quick hack for 4.x compatibility. However, it's been documented now as the preferred API rather than the replacement kobj_class_t. Drop the note about 4.x since it's clear we're a bit late to retiring its use through the tree with almost 1500 references to driver_t. Sponsored by: Netflix
|
#
ef29dd1f |
|
16-Apr-2021 |
Warner Losh <imp@FreeBSD.org> |
newbus: style nit Sponsored by: Netflix
|
#
25bfa448 |
|
21-Mar-2021 |
Adrian Chadd <adrian@FreeBSD.org> |
Add device and ifnet logging methods, similar to device_printf / if_printf * device_printf() is effectively a printf * if_printf() is effectively a LOG_INFO This allows subsystems to log device/netif stuff using different log levels, rather than having to invent their own way to prefix unit/netif names. Differential Revision: https://reviews.freebsd.org/D29320 Reviewed by: imp
|
#
95a85c12 |
|
19-Sep-2020 |
Michal Meloun <mmel@FreeBSD.org> |
Add NetBSD compatible bus_space_peek_N() and bus_space_poke_N() functions. One problem with the bus_space_read_N() and bus_space_write_N() family of functions is that they provide no protection against exceptions which can occur when no physical hardware or device responds to the read or write cycles. In such a situation, the system typically would panic due to a kernel-mode bus error. The bus_space_peek_N() and bus_space_poke_N() family of functions provide a mechanism to handle these exceptions gracefully without the risk of crashing the system. Typical example is access to PCI(e) configuration space in bus enumeration function on badly implemented PCI(e) root complexes (RK3399 or Neoverse N1 N1SDP and/or access to PCI(e) register when device is in deep sleep state. This commit adds a real implementation for arm64 only. The remaining architectures have bus_space_peek()/bus_space_poke() emulated by using bus_space_read()/bus_space_write() (without exception handling). MFC after: 1 month Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D25371
|
#
f6e54eb3 |
|
01-Sep-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
sys: clean up empty lines in .c and .h files
|
#
7795f0fe |
|
20-Aug-2020 |
Warner Losh <imp@FreeBSD.org> |
Move devctl_notify* to devctl.h.
|
#
c9133e6c |
|
20-Aug-2020 |
Warner Losh <imp@FreeBSD.org> |
Make devctl_queue_data_f and devctl_queue_data private. I thought we'd need them, but nobody is using them. Narrow the interface. This will facilitate changes in the future.
|
#
b832a7e5 |
|
13-Dec-2019 |
Warner Losh <imp@FreeBSD.org> |
Create new wrapper function: bus_delayed_attach_children() Delay the attachment of children, when requested, until after interrutps are running. This is often needed to allow children to run transactions on i2c or spi busses. It's a common enough idiom that it will be useful to have its own wrapper. Reviewed by: ian Differential Revision: https://reviews.freebsd.org/D21465
|
#
937a05ba |
|
04-Aug-2019 |
Justin Hibbits <jhibbits@FreeBSD.org> |
Add necessary bits for Linux KPI to work correctly on powerpc PowerPC, and possibly other architectures, use different address ranges for PCI space vs physical address space, which is only mapped at resource activation time, when the BAR gets written. The DRM kernel modules do not activate the rman resources, soas not to waste KVA, instead only mapping parts of the PCI memory at a time. This introduces a BUS_TRANSLATE_RESOURCE() method, implemented in the Open Firmware/FDT PCI driver, to perform this necessary translation without activating the resource. In addition to system KPI changes, LinuxKPI is updated to handle a big-endian host, by adding proper endian swaps to the I/O functions. Submitted by: mmacy Reported by: hselasky Differential Revision: https://reviews.freebsd.org/D21096
|
#
3e7bae08 |
|
01-Jul-2019 |
Andriy Gapon <avg@FreeBSD.org> |
upgrade the warning printf-s in bus accessors to KASSERT-s, take 2 After this change sys/bus.h includes sys/systm.h when _KERNEL is defined. This brings back r349459 but with systm.h hidden from userland. MFC after: 2 weeks
|
#
f45e9414 |
|
27-Jun-2019 |
Andriy Gapon <avg@FreeBSD.org> |
revert r349460, printf -> KASSERT in bus.h, until I can fix it I tested only kernel builds naively assuming that sys/bus.h cannot affect userland builds. Pointyhat to: me
|
#
d55fcc48 |
|
27-Jun-2019 |
Andriy Gapon <avg@FreeBSD.org> |
upgrade the warning printf-s in bus accessors to KASSERT-s After this change sys/bus.h includes sys/systm.h. Discussed with: cem, imp MFC after: 2 weeks
|
#
2b1d0ab2 |
|
05-Jun-2019 |
Andriy Gapon <avg@FreeBSD.org> |
first step towards enforcing must-succeed semantics for bus accessors Unlike BUS_READ_IVAR / BUS_WRITE_IVAR, bus accessors do not have a return code. It is assumed that there is a tight coupling between a bus driver and a driver for a device on the bus with respect to instance variables that the bus defines for its children. So, the driver is supposed to have only valid accesses to the variables and, thus, the accessors must always succeed. Of course, programming errors sometimes happen. At present, such errors go completely unnoticed. The idea of this change is to start catching them. As a first step, there will be a warning about a failed accessor call. This is to give developers a heads-up. I plan to replace the printf with a KASSERT a week later, so that the warning is harder to ignore. Reviewed by: cem, imp, ian MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20458
|
#
e2e050c8 |
|
19-May-2019 |
Conrad Meyer <cem@FreeBSD.org> |
Extract eventfilter declarations to sys/_eventfilter.h This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped.
|
#
1d1a5c2b |
|
05-Apr-2019 |
Konstantin Belousov <kib@FreeBSD.org> |
Add DEV_RESET /dev/devctl2 ioctl. It performs BUS_RESET_CHILD() on the parental bus and the specified device. Reviewed by: imp (previous version), jhb (previous version) Sponsored by: Mellanox Technologies MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D19646
|
#
c53df6da |
|
05-Apr-2019 |
Konstantin Belousov <kib@FreeBSD.org> |
Provide newbus infrastructure for initiating device reset. The methods BUS_RESET_PREPARE(), BUS_RESET(), and BUS_RESET_POST() should be implemented by bus which can provide reset to a device. The methods are described in inline doxygen comments. Code only provides BUS_RESET_PREPARE() and BUS_RESET_POST() helpers instead of default implementation, because actual bus needs to handle device state around reset, while helpers provide the other half of typical prepare/post code. Reviewed by: imp (previous version), jhb (previous version) Sponsored by: Mellanox Technologies MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D19646
|
#
82a5a275 |
|
17-Dec-2018 |
Andriy Gapon <avg@FreeBSD.org> |
add support for marking interrupt handlers as suspended The goal of this change is to fix a problem with PCI shared interrupts during suspend and resume. I have observed a couple of variations of the following scenario. Devices A and B are on the same PCI bus and share the same interrupt. Device A's driver is suspended first and the device is powered down. Device B generates an interrupt. Interrupt handlers of both drivers are called. Device A's interrupt handler accesses registers of the powered down device and gets back bogus values (I assume all 0xff). That data is interpreted as interrupt status bits, etc. So, the interrupt handler gets confused and may produce some noise or enter an infinite loop, etc. This change affects only PCI devices. The pci(4) bus driver marks a child's interrupt handler as suspended after the child's suspend method is called and before the device is powered down. This is done only for traditional PCI interrupts, because only they can be shared. At the moment the change is only for x86. Notable changes in core subsystems / interfaces: - BUS_SUSPEND_INTR and BUS_RESUME_INTR methods are added to bus interface along with convenience functions bus_suspend_intr and bus_resume_intr; - rman_set_irq_cookie and rman_get_irq_cookie functions are added to provide a way to associate an interrupt resource with an interrupt cookie; - intr_event_suspend_handler and intr_event_resume_handler functions are added to the MI interrupt handler interface. I added two new interrupt handler flags, IH_SUSP and IH_CHANGED, to implement the new intr_event functions. IH_SUSP marks a suspended interrupt handler. IH_CHANGED is used to implement a barrier that ensures that a change to the interrupt handler's state is visible to future interrupts. While there, I fixed some whitespace issues in comments and changed a couple of logically boolean variables to be bool. MFC after: 1 month (maybe) Differential Revision: https://reviews.freebsd.org/D15755
|
#
1a305bda |
|
19-Nov-2018 |
Ben Widawsky <bwidawsk@FreeBSD.org> |
acpi: fix acpi_ec_probe to only check EC devices This patch utilizes the fixed_devclass attribute in order to make sure other acpi devices with params don't get confused for an EC device. The existing code assumes that acpi_ec_probe is only ever called with a dereferencable acpi param. Aside from being incorrect because other devices of ACPI_TYPE_DEVICE may be probed here which aren't ec devices, (and they may have set acpi private data), it is even more nefarious if another ACPI driver uses private data which is not dereferancable. This will result in a pointer deref during boot and therefore boot failure. On X86, as it stands today, no other devices actually do this (acpi_cpu checks for PROCESSOR type devices) and so there is no issue. I ran into this because I am adding such a device which gets probed before acpi_ec_probe and sets private data. If ARM ever has an EC, I think they'd run into this issue as well. There have been several iterations of this patch. Earlier iterations had ECDT enumerated ECs not call into the probe/attach functions of this driver. This change was Suggested by: jhb@. Reviewed by: jhb Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D16635
|
#
d36967bd |
|
22-Aug-2018 |
Warner Losh <imp@FreeBSD.org> |
Add a new device flag: DF_ATTACHED_ONCE This flag is set once the device has been successfully attached. When set, it inhibits devmatch from trying to match the device. This in turn allows kldunload to work as expected. Prior to the change, the driver would immediately reload because devmatch had no notion that the driver had once been attached, and therefore shouldn't participate in further matching. Differential Revision: https://reviews.freebsd.org/D16735
|
#
5fa29797 |
|
22-Aug-2018 |
Warner Losh <imp@FreeBSD.org> |
Create devctl freeze/thaw. This adds it to devctl, libdevctl, defines the two IOCTLs and implements the kernel bits. causes any new drivers that are added via kldload to be deferred until a 'thaw' comes in. These do not stack: it is an error to freeze while frozen, or thaw while thawed. Differential Revision: https://reviews.freebsd.org/D16735
|
#
bc6cb3f6 |
|
26-Jun-2018 |
Warner Losh <imp@FreeBSD.org> |
Remove devctl_safe_quote since it's now unused. Sponsored by: Netflix Differential Review: https://reviews.freebsd.org/D16026
|
#
ab531b88 |
|
26-Jun-2018 |
Warner Losh <imp@FreeBSD.org> |
Create new devctl_safe_quote_sb to copy a source string into a struct sbuf to make it safe. Callers are expected to add the " " around it, if needed. Sponsored by: Netflix Differential Review: https://reviews.freebsd.org/D16026
|
#
c580ca4c |
|
30-May-2018 |
Warner Losh <imp@FreeBSD.org> |
Make the data returned by devinfo harder to overflow. Rather than using fixed-length strings, pack them into a string table to return. Also expand the buffer from ~300 charaters to 3k. This should be enough, even for USB. This fixes a problem where USB pnp info is truncated on return to userland. Differential Revision: https://reviews.freebsd.org/D15629
|
#
ad714275 |
|
07-May-2018 |
Warner Losh <imp@FreeBSD.org> |
Add device_quiet_children() and device_has_quiet_children() If you add a child to a device that has quiet children, we'll automatically set the quiet flag on the children, and its children. This is indended for things like CPU that have a large amount of repetition in booting that adds nothing.
|
#
a213ad03 |
|
02-Mar-2018 |
Emmanuel Vadot <manu@FreeBSD.org> |
Introduce BUS_PASS_SUPPORTDEV The reason for this new pass is : The earlier pass names are really specific (interrupt, timer, scheduler etc ..) and making a driver that other device driver (that attach at DEFAULT pass) needs probe at earlier pass can be confiusing. We can live with GPIO driver at INTERRUPT pass because they are often an interrupt controller too but having a usb phy driver probed at RESOURCES (or SCHEDULER for example) is silly. The number was choosen to have a lot of margin if we want to introduce other pass in the futur. Reviewed by: ian, imp, kevans Differential Revision: https://reviews.freebsd.org/D14568
|
#
c4e20cad |
|
27-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
sys/sys: further adoption of SPDX licensing ID tags. Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
|
#
6b5907b3 |
|
28-Oct-2017 |
Ian Lepore <ian@FreeBSD.org> |
Add a #define RESOURCE_SPEC_END. Similar to DEVMETHOD_END and KOBJMETHOD_END, this is to serve as the end marker in an array of resource_spec structures.
|
#
c9748df8 |
|
23-Oct-2017 |
Mark Johnston <markj@FreeBSD.org> |
Remove resource_set_*() declarations from sys/bus.h. The corresponding definitions were removed in r78135. PR: 223189 Submitted by: marc.priggemeyer@gmail.com MFC after: 1 week
|
#
06242553 |
|
29-Jan-2017 |
Justin Hibbits <jhibbits@FreeBSD.org> |
Add a INTR_TRIG_INVALID, and use it in the powerpc interrupt code. Summary: Clang throws the following warning in powerpc intr_machdep: /usr/src/sys/powerpc/powerpc/intr_machdep.c:454:15: warning: comparison of constant -1 with expression of type 'enum intr_trigger' is always false [-Wtautological-constant-out-of-range-compare] if (i->trig == -1) ~~~~~~~ ^ ~~ This may lead to legitimate problems with aggressive optimizations, if not now then in the future. To avoid this, add a new enum, INTR_TRIG_INVALID, set to -1, and use this new enumeration in these checks. Test Plan: Compile test. Reviewed By: jhb, kib Differential Revision: https://reviews.freebsd.org/D9300
|
#
1d64db52 |
|
15-Jan-2017 |
Conrad Meyer <cem@FreeBSD.org> |
Fix a variety of cosmetic typos and misspellings No functional change. PR: 216096, 216097, 216098, 216101, 216102, 216106, 216109, 216110 Reported by: Bulat <bltsrc at mail.ru> Sponsored by: Dell EMC Isilon
|
#
db4fcadf |
|
15-Jan-2017 |
Conrad Meyer <cem@FreeBSD.org> |
"Buses" is the preferred plural of "bus" Replace archaic "busses" with modern form "buses." Intentionally excluded: * Old/random drivers I didn't recognize * Old hardware in general * Use of "busses" in code as identifiers No functional change. http://grammarist.com/spelling/buses-busses/ PR: 216099 Reported by: bltsrc at mail.ru Sponsored by: Dell EMC Isilon
|
#
e05ec081 |
|
29-Aug-2016 |
John Baldwin <jhb@FreeBSD.org> |
Implement 'devctl clear driver' to undo a previous 'devctl set driver'. Add a new 'clear driver' command for devctl along with the accompanying ioctl and devctl_clear_driver() library routine to reset a device to use a wildcard devclass instead of a fixed devclass. This can be used to undo a previous 'set driver' command. After the device's name has been reset to permit wildcard names, it is reprobed so that it can attach to newly-available (to it) device drivers. MFC after: 1 month Sponsored by: Chelsio Communications
|
#
895c8b1c |
|
19-Aug-2016 |
Michal Meloun <mmel@FreeBSD.org> |
INTRNG: Rework handling with resources. Partially revert r301453. - Read interrupt properties at bus enumeration time and store it into global mapping table. - At bus_activate_resource() time, given mapping entry is resolved and connected to real interrupt source. A copy of mapping entry is attached to given resource. - At bus_setup_intr() time, mapping entry stored in resource is used for delivery of requested interrupt configuration. - For MSI/MSIX interrupts, mapping entry is created within pci_alloc_msi()/pci_alloc_msix() call. - For legacy PCI interrupts, mapping entry must be created within pcib_route_interrupt() by pcib driver itself. Reviewed by: nwhitehorn, andrew Differential Revision: https://reviews.freebsd.org/D7493
|
#
f454e7eb |
|
04-Aug-2016 |
John Baldwin <jhb@FreeBSD.org> |
Add __printflike() to bus_describe_intr() to enable -Wformat checks. Fix a few places that were passing a raw string as the format to use a "%s" format string instead. MFC after: 2 months
|
#
0869297d |
|
05-Jun-2016 |
Svatopluk Kraus <skra@FreeBSD.org> |
(1) Add a new bus method to get a mapping data for an interrupt. BUS_MAP_INTR() is used to get an interrupt mapping data according to provided hints. The hints could be modified afterwards, but only if mapping data was allocated. This method is intended to be called before BUS_ALLOC_RESOURCE(). An interrupt mapping data describes an interrupt - hardware number, type, configuration, cpu binding, and whatever is needed to setup it. (2) Introduce a method which allows storing of an additional data in struct resource to be available for bus drivers. This method is convenient in two ways: - there is no need to rework existing bus drivers as they can simply be extended to provide an additional data, - there is no need to modify any existing bus methods as struct resource is already passed to them as argument and thus stored data is simply accessible by other bus drivers. For now, implement this method only for INTRNG. This is motivated by needs of modern SOCs where hardware initialization is not straightforward and resources descriptions are complex, opaque for everyone but provider, and may vary from SOC to SOC. Typical situation is that one bus driver can fetch a resource description for its child device, but it's opaque for this driver. Another bus driver knows a provider for this kind of resource and can pass this resource description to it. In fact, something like device IVARS would be perfect for that if implemented generally enough. Unfortunatelly, IVARS are usable only by their owners now. Only owner knows its IVARS layout, thus other bus drivers are not able to use them. Differential Revision: https://reviews.freebsd.org/D6632
|
#
cc981af2 |
|
20-May-2016 |
John Baldwin <jhb@FreeBSD.org> |
Add new bus methods for mapping resources. Add a pair of bus methods that can be used to "map" resources for direct CPU access using bus_space(9). bus_map_resource() creates a mapping and bus_unmap_resource() releases a previously created mapping. Mappings are described by 'struct resource_map' object. Pointers to these objects can be passed as the first argument to the bus_space wrapper API used for bus resources. Drivers that wish to map all of a resource using default settings (for example, using uncacheable memory attributes) do not need to change. However, drivers that wish to use non-default settings can now do so without jumping through hoops. First, an RF_UNMAPPED flag is added to request that a resource is not implicitly mapped with the default settings when it is activated. This permits other activation steps (such as enabling I/O or memory decoding in a device's PCI command register) to be taken without creating a mapping. Right now the AGP drivers don't set RF_ACTIVE to avoid using up a large amount of KVA to map the AGP aperture on 32-bit platforms. Once RF_UNMAPPED is supported on all platforms that support AGP this can be changed to using RF_UNMAPPED with RF_ACTIVE instead. Second, bus_map_resource accepts an optional structure that defines additional settings for a given mapping. For example, a driver can now request to map only a subset of a resource instead of the entire range. The AGP driver could also use this to only map the first page of the aperture (IIRC, it calls pmap_mapdev() directly to map the first page currently). I will also eventually change the PCI-PCI bridge driver to request mappings of the subset of the I/O window resource on its parent side to create mappings for child devices rather than passing child resources directly up to nexus to be mapped. This also permits bridges that do address translation to request suitable mappings from a resource on the "upper" side of the bus when mapping resources on the "lower" side of the bus. Another attribute that can be specified is an alternate memory attribute for memory-mapped resources. This can be used to request a Write-Combining mapping of a PCI BAR in an MI fashion. (Currently the drivers that do this call pmap_change_attr() directly for x86 only.) Note that this commit only adds the MI framework. Each platform needs to add support for handling RF_UNMAPPED and thew new bus_map/unmap_resource methods. Generally speaking, any drivers that are calling rman_set_bustag() and rman_set_bushandle() need to be updated. Discussed on: arch Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D5237
|
#
8d791e5a |
|
09-May-2016 |
John Baldwin <jhb@FreeBSD.org> |
Add a new bus method to fetch device-specific CPU sets. bus_get_cpus() returns a specified set of CPUs for a device. It accepts an enum for the second parameter that indicates the type of cpuset to request. Currently two valus are supported: - LOCAL_CPUS (on x86 this returns all the CPUs in the package closest to the device when DEVICE_NUMA is enabled) - INTR_CPUS (like LOCAL_CPUS but only returns 1 SMT thread for each core) For systems that do not support NUMA (or if it is not enabled in the kernel config), LOCAL_CPUS fails with EINVAL. INTR_CPUS is mapped to 'all_cpus' by default. The idea is that INTR_CPUS should always return a valid set. Device drivers which want to use per-CPU interrupts should start using INTR_CPUS instead of simply assigning interrupts to all available CPUs. In the future we may wish to add tunables to control the policy of INTR_CPUS (e.g. should it be local-only or global, should it ignore SMT threads or not). The x86 nexus driver exposes the internal set of interrupt CPUs from the the x86 interrupt code via INTR_CPUS. The ACPI bus driver and PCI bridge drivers use _PXM to return a suitable LOCAL_CPUS set when _PXM exists and DEVICE_NUMA is enabled. They also and the global INTR_CPUS set from the nexus driver with the per-domain set from _PXM to generate a local INTR_CPUS set for child devices. Compared to the r298933, this version uses 'struct _cpuset' in <sys/bus.h> instead of 'cpuset_t' to avoid requiring <sys/param.h> (<sys/_cpuset.h> still requires <sys/param.h> for MAXCPU even though <sys/_bitset.h> does not after recent changes).
|
#
8a08b7d3 |
|
02-May-2016 |
John Baldwin <jhb@FreeBSD.org> |
Revert bus_get_cpus() for now. I really thought I had run this through the tinderbox before committing, but many places need <sys/types.h> -> <sys/param.h> for <sys/bus.h> now.
|
#
bc153c69 |
|
02-May-2016 |
John Baldwin <jhb@FreeBSD.org> |
Add a new bus method to fetch device-specific CPU sets. bus_get_cpus() returns a specified set of CPUs for a device. It accepts an enum for the second parameter that indicates the type of cpuset to request. Currently two valus are supported: - LOCAL_CPUS (on x86 this returns all the CPUs in the package closest to the device when DEVICE_NUMA is enabled) - INTR_CPUS (like LOCAL_CPUS but only returns 1 SMT thread for each core) For systems that do not support NUMA (or if it is not enabled in the kernel config), LOCAL_CPUS fails with EINVAL. INTR_CPUS is mapped to 'all_cpus' by default. The idea is that INTR_CPUS should always return a valid set. Device drivers which want to use per-CPU interrupts should start using INTR_CPUS instead of simply assigning interrupts to all available CPUs. In the future we may wish to add tunables to control the policy of INTR_CPUS (e.g. should it be local-only or global, should it ignore SMT threads or not). The x86 nexus driver exposes the internal set of interrupt CPUs from the the x86 interrupt code via INTR_CPUS. The ACPI bus driver and PCI bridge drivers use _PXM to return a suitable LOCAL_CPUS set when _PXM exists and DEVICE_NUMA is enabled. They also and the global INTR_CPUS set from the nexus driver with the per-domain set from _PXM to generate a local INTR_CPUS set for child devices. Reviewed by: wblock (manpage) Differential Revision: https://reviews.freebsd.org/D5519
|
#
e240255f |
|
27-Apr-2016 |
John Baldwin <jhb@FreeBSD.org> |
Add a bus_null_rescan() method that always fails with an error. Use this in place of kobj_error_method to disable BUS_RESCAN() on PCI drivers that do not use the "standard" scanning algorithm.
|
#
88eb5c50 |
|
27-Apr-2016 |
John Baldwin <jhb@FreeBSD.org> |
Add 'devctl delete' that calls device_delete_child(). 'devctl delete' can be used to delete a device that is no longer present. As an anti-foot-shooting measure, 'delete' will not delete a device unless it's parent bus says it is no longer present. This can be overridden by passing the force ('-f') flag. Note that this command should be used with care. If a device is deleted that is actually present it can't be resurrected unless the parent bus device's driver supports rescans. Differential Revision: https://reviews.freebsd.org/D6019
|
#
a907c691 |
|
27-Apr-2016 |
John Baldwin <jhb@FreeBSD.org> |
Add a new rescan method to the bus interface. The BUS_RESCAN() method rescans a single bus device checking for devices that have been added or removed from the bus. A new 'rescan' command is added to devctl(8) to trigger a rescan. Differential Revision: https://reviews.freebsd.org/D6016
|
#
70e22add |
|
09-Apr-2016 |
John Baldwin <jhb@FreeBSD.org> |
Add a function to lookup a device_t object by name. This just walks the global list of devices looking for one with the requested name. The one use case outside of devctl2's implementation is for DDB commands that wish to lookup devices by name.
|
#
cb49b654 |
|
28-Mar-2016 |
Warner Losh <imp@FreeBSD.org> |
Move pccard_safe_quote() up to subr_bus.c and rename to devctl_safe_quote() so it can be used more generally.
|
#
534ccd7b |
|
02-Mar-2016 |
Justin Hibbits <jhibbits@FreeBSD.org> |
Replace all resource occurrences of '0UL/~0UL' with '0/~0'. Summary: The idea behind this is '~0ul' is well-defined, and casting to uintmax_t, on a 32-bit platform, will leave the upper 32 bits as 0. The maximum range of a resource is 0xFFF.... (all bits of the full type set). By dropping the 'ul' suffix, C type promotion rules apply, and the sign extension of ~0 on 32 bit platforms gets it to a type-independent 'unsigned max'. Reviewed By: cem Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5255
|
#
ac6c1372 |
|
26-Feb-2016 |
Justin Hibbits <jhibbits@FreeBSD.org> |
Add the bus_alloc_resource_anywhere() convenience function. Summary: Many instances of bus_alloc_resource() simply use 0 and ~0 for start and end to denote 'anywhere' with a given count. To clean this up, introduce a bus_alloc_resource_anywhere() convenience function. Bump __FreeBSD_version for the new API. Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D5370
|
#
b998c965 |
|
18-Feb-2016 |
Zbigniew Bodek <zbb@FreeBSD.org> |
Introduce bus_get_bus_tag() method Provide bus_get_bus_tag() for sparc64, powerpc, arm, arm64 and mips nexus and its children in order to return a platform specific default tag. This is required to ensure generic correctness of the bus_space tag. It is especially needed for arches where child bus tag does not match the parent bus tag. This solves the problem with ppc architecture where the PCI bus tag differs from parent bus tag which is big-endian. This commit is a part of the following patch: https://reviews.freebsd.org/D4879 Submitted by: Marcin Mazurek <mma@semihalf.com> Obtained from: Semihalf Sponsored by: Annapurna Labs Reviewed by: jhibbits, mmel Differential Revision: https://reviews.freebsd.org/D4879
|
#
2dd1bdf1 |
|
26-Jan-2016 |
Justin Hibbits <jhibbits@FreeBSD.org> |
Convert rman to use rman_res_t instead of u_long Summary: Migrate to using the semi-opaque type rman_res_t to specify rman resources. For now, this is still compatible with u_long. This is step one in migrating rman to use uintmax_t for resources instead of u_long. Going forward, this could feasibly be used to specify architecture-specific definitions of resource ranges, rather than baking a specific integer type into the API. This change has been broken out to facilitate MFC'ing drivers back to 10 without breaking ABI. Reviewed By: jhb Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5075
|
#
a4a87298 |
|
06-Jun-2015 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Change BUS_PROBE_HOOVER from -500 to -1000000. We have PCI bus drivers return -1000 and -10000 to establish a pecking order and we don't want catch-all or match-all drivers to attach instead of them. With this change poto(4) can be compiled into the kernel (or preloaded from the loader), without impact.
|
#
1c229658 |
|
10-Mar-2015 |
Ryan Stone <rstone@FreeBSD.org> |
Fix SR-IOV passthrough devices to allow ppt to attach A late change to the SR-IOV infrastructure broke passthrough of VFs. device_set_devclass() was being used to try to force the ppt driver to attach to the device, but this didn't work because the DF_FIXEDCLASS flag wasn't being set on the device, so the ppt driver probe routine would not match when it returned BUS_NOWILDCARD. Fix this by adding a new device function that both sets the devclass and sets the DF_FIXEDCLASS flag, and use that to force the ppt driver to attach to VFs. Differential Revision: https://reviews.freebsd.org/D2041 Reviewed by: jhb MFC after: 3 weeks
|
#
64de8019 |
|
06-Feb-2015 |
John Baldwin <jhb@FreeBSD.org> |
Add a new device control utility for new-bus devices called devctl. This allows the user to request administrative changes to individual devices such as attach or detaching drivers or disabling and re-enabling devices. - Add a new /dev/devctl2 character device which uses ioctls for device requests. The ioctls use a common 'struct devreq' which is somewhat similar to 'struct ifreq'. - The ioctls identify the device to operate on via a string. This string can either by the device's name, or it can be a bus-specific address. (For unattached devices, a bus address is the only way to locate a device.) Bus drivers register an eventhandler to claim unrecognized device names that the driver recognizes as a valid address. Two buses currently support addresses: ACPI recognizes any device in the ACPI namespace via its full path starting with "\" and the PCI bus driver recognizes an address specification of 'pci[<domain>:]<bus>:<slot>:<func>' (identical to the PCI selector strings supported by pciconf). - To make it easier to cut and paste, change the PnP location string in the PCI bus driver to output a full PCI selector string rather than 'slot=<slot> function=<func>'. - Add a devctl(3) interface in libdevctl which provides a wrapper around the ioctls and is the preferred interface for other userland code. - Add a devctl(8) program which is a simple wrapper around the requests supported by devctl(3). - Add a device_is_suspended() function to check DF_SUSPENDED. - Add a resource_unset_value() function that can be used to remove a hint from the kernel environment. This is used to clear a hint.<driver>.<unit>.disabled hint when re-enabling a boot-time disabled device. Reviewed by: imp (parts) Requested by: imp (changing PCI location string) Relnotes: yes
|
#
94f0eafc |
|
05-Feb-2015 |
John Baldwin <jhb@FreeBSD.org> |
Expose the constants for internal new-bus device flags to userland. The flag value is already exposed via dv_flags, just not the meaning of the flags themselves. Use these constants to annotate devices that are disabled or suspended in devinfo output.
|
#
b10c08a5 |
|
03-Dec-2014 |
John Baldwin <jhb@FreeBSD.org> |
Revert device_getenv_int() for now as it duplicates resource_int_value(). We should perhaps implement a device_getenv_*() and device_setenv_*() API as a convenience wrapper on top of resource_*_value() and resource_set_*().
|
#
56c14bca |
|
26-Nov-2014 |
Alfred Perlstein <alfred@FreeBSD.org> |
Make igb and ixgbe check tunables at probe time. This allows one to make a kernel module to tune the number of queues before the driver loads. This is needed so that a module at SI_SUB_CPU can set tunables for these drivers to take. Otherwise getenv is called too early by the TUNABLE macros. Reviewed by: smh Phabric: https://reviews.freebsd.org/D1149
|
#
a2d75193 |
|
24-Nov-2014 |
John Baldwin <jhb@FreeBSD.org> |
Add a bus_get_domain() wrapper around BUS_GET_DOMAIN(). Use this to add a new per-device '%domain' sysctl node that returns the NUMA domain a device is associated with if it is associated with one. Note that this API is still a WIP and might change before 11.0 actually ships. Differential Revision: https://reviews.freebsd.org/D930 Reviewed by: kib, adrian
|
#
88c94345 |
|
09-Oct-2014 |
Adrian Chadd <adrian@FreeBSD.org> |
Shuffle things. Suggested by: jhb Differential Revision: D906 Sponsored by: Norse Corp
|
#
ffcf962d |
|
08-Oct-2014 |
Adrian Chadd <adrian@FreeBSD.org> |
Add a bus method to fetch the VM domain for the given device/bus. * Add a bus_if.m method - get_domain() - returning the VM domain or ENOENT if the device isn't in a VM domain; * Add bus methods to print out the domain of the device if appropriate; * Add code in srat.c to save the PXM -> VM domain mapping that's done and expose a function to translate VM domain -> PXM; * Add ACPI and ACPI PCI methods to check if the bus has a _PXM attribute and if so map it to the VM domain; * (.. yes, this works recursively.) * Have the pci bus glue print out the device VM domain if present. Note: this is just the plumbing to start enumerating information - it doesn't at all modify behaviour. Differential Revision: D906 Reviewed by: jhb Sponsored by: Norse Corp
|
#
a1c16348 |
|
22-Sep-2014 |
Justin Hibbits <jhibbits@FreeBSD.org> |
Stage one of multipass suspend/resume Summary: Add the beginnings of multipass suspend/resume, by introducing BUS_SUSPEND_CHILD/BUS_RESUME_CHILD, and move the PCI driver to this. Reviewers: jhb Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D590
|
#
69a74bec |
|
05-Aug-2014 |
Ian Lepore <ian@FreeBSD.org> |
Define names that drivers can use to adjust their position relative to other drivers within a BUS_PASS. Reviewed by: imp
|
#
455ba689 |
|
22-May-2014 |
Warner Losh <imp@FreeBSD.org> |
Fix the comment. This really isn't just a 4.x compatibility thing, but is used pervasively through our tree, making it really part of the API.
|
#
e35ce1f2 |
|
27-Jun-2013 |
John Baldwin <jhb@FreeBSD.org> |
Make detaching drivers from PCI devices more robust. While here, fix a bug where a PCI device would be powered down if it failed to probe, but not when its driver was detached (e.g. via kldunload). - Add a new helper method resource_list_release_active() which forcefully releases any active resources of a specified type from a resource list. - Add a bus_child_detached method for the PCI bus driver which forces any active resources to be released (and whines to the console if it finds any) and then powers the device down. - Call pci_child_detached() if we fail to probe a device when a driver is kldloaded. This isn't perfect but can avoid leaking resources from a probe() routine in the kldload case. Reviewed by: imp, brooks MFC after: 1 month
|
#
674b6cec |
|
04-Apr-2013 |
Rui Paulo <rpaulo@FreeBSD.org> |
Remove a comment about devices being able to specify multiple interrupt types. This is no longer the case because interrupt types now have to map to an ithread priority (c.f. intr_priority()).
|
#
c01fc06e |
|
15-Aug-2012 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Revert r239178 and implement two new functions, namely "device_free_softc()" and "device_claim_softc()", to allow USB serial drivers refcounting the softc. These functions are used to grab the softc from auto-free and to free the softc back to the correct malloc type, respectivly. Discussed with: jhb MFC after: 2 weeks
|
#
ea1bd564 |
|
10-Aug-2012 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Add new device method to free the automatically allocated softc structure which is returned by device_get_softc(). This method can be used to easily implement softc refcounting. This can be desirable when the softc has memory references which are controlled by userspace handles for example. This solves the problem of blocking the caller of device_detach() for a non-deterministic time. Discussed with: kib, ed MFC after: 2 weeks
|
#
7f7acad7 |
|
05-Aug-2012 |
Andreas Tobler <andreast@FreeBSD.org> |
Fix typo. Reviewed by: jhb
|
#
77b479e6 |
|
11-Apr-2012 |
John Baldwin <jhb@FreeBSD.org> |
Allow device_busy() and device_unbusy() to be invoked while a device is being attached. This is implemented by adding a new DS_ATTACHING state while a device's DEVICE_ATTACH() method is being invoked. A driver is required to not fail an attach of a busy device. The device's state will be promoted to DS_BUSY rather than DS_ACTIVE() if the device was marked busy during DEVICE_ATTACH(). Reviewed by: kib MFC after: 1 week
|
#
3b12bdb5 |
|
22-Nov-2011 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Rename device_delete_all_children() into device_delete_children(). Suggested by: jhb @ and marius @ MFC after: 1 week
|
#
788a85e8 |
|
22-Nov-2011 |
Marius Strobl <marius@FreeBSD.org> |
- Add a DEVMETHOD_END alias for KOBJMETHOD_END so that along with 'driver_t' and DEVMETHOD() we can fully hide the explicit mention of kobj(9) from device drivers. - Update the example in driver.9 to use DEVMETHOD_END. Submitted by: jhb MFC after: 3 days
|
#
11bcf702 |
|
19-Nov-2011 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Move the device_delete_all_children() function from usb_util.c to kern/subr_bus.c. Simplify this function so that it no longer depends on malloc() to execute. Identify a few other places where it makes sense to use device_delete_all_children(). MFC after: 1 week
|
#
5a7ca5ee |
|
22-Aug-2011 |
John Baldwin <jhb@FreeBSD.org> |
Add two new macros DRIVER_MODULE_ORDERED() and EARLY_DRIVER_MODULE_ORDERED() that allow a module to use an order other than the default of SI_ORDER_MIDDLE when registering a driver. This can be useful for drivers in a kld that contain multiple new-bus drivers as part of one logical device driver. A typical case would be to use SI_ORDER_LAST for the "main" driver to ensure that any other "helper" drivers are registered and available before the "main" driver attempts to attach. Tested by: kib, Jason Harmening jason harmening / gmail Approved by: re (kib) MFC after: 1 week
|
#
34ff71ee |
|
15-Jul-2011 |
John Baldwin <jhb@FreeBSD.org> |
Respect the BIOS/firmware's notion of acceptable address ranges for PCI resource allocation on x86 platforms: - Add a new helper API that Host-PCI bridge drivers can use to restrict resource allocation requests to a set of address ranges for different resource types. - For the ACPI Host-PCI bridge driver, use Producer address range resources in _CRS to enumerate valid address ranges for a given Host-PCI bridge. This can be disabled by including "hostres" in the debug.acpi.disabled tunable. - For the MPTable Host-PCI bridge driver, use entries in the extended MPTable to determine the valid address ranges for a given Host-PCI bridge. This required adding code to parse extended table entries. Similar to the new PCI-PCI bridge driver, these changes are only enabled if the NEW_PCIB kernel option is enabled (which is enabled by default on amd64 and i386). Approved by: re (kib)
|
#
85ee63c9 |
|
29-Apr-2011 |
John Baldwin <jhb@FreeBSD.org> |
Add a new bus method, BUS_ADJUST_RESOURCE() that is intended to be a wrapper around rman_adjust_resource(). Include a generic implementation, bus_generic_adjust_resource() which passes the request up to the parent bus. There is currently no default implementation. A bus_adjust_resource() wrapper is provided for use in drivers.
|
#
e4cd31dd |
|
21-Mar-2011 |
Jeff Roberson <jeff@FreeBSD.org> |
- Merge changes to the base system to support OFED. These include a wider arg2 for sysctl, updates to vlan code, IFT_INFINIBAND, and other miscellaneous small features.
|
#
49fe354a |
|
06-Jan-2011 |
John Baldwin <jhb@FreeBSD.org> |
Retire the INTR_FAST flag as it was obsoleted by the introduction of the filter argument to bus_setup_intr().
|
#
f4ff513c |
|
04-Jan-2011 |
Marius Strobl <marius@FreeBSD.org> |
Reserve INTR_MD[1-4] similarly to what BUS_DMA_BUS[1-4] are intended for and switch sparc64 to use the first one for bus error filter handlers of bridge drivers instead of (ab)using INTR_FAST for that so we eventually can get rid of the latter. Reviewed by: jhb MFC after: 1 month
|
#
144df3a2 |
|
17-Nov-2010 |
John Baldwin <jhb@FreeBSD.org> |
Add a resource_list_reserved() method that returns true if a resource list entry contains a reserved resource.
|
#
a7d5f7eb |
|
19-Oct-2010 |
Jamie Gritton <jamie@FreeBSD.org> |
A new jail(8) with a configuration file, to replace the work currently done by /etc/rc.d/jail.
|
#
3d844edd |
|
10-Sep-2010 |
Andriy Gapon <avg@FreeBSD.org> |
bus_add_child: change type of order parameter to u_int This reflects actual type used to store and compare child device orders. Change is mostly done via a Coccinelle (soon to be devel/coccinelle) semantic patch. Verified by LINT+modules kernel builds. Followup to: r212213 MFC after: 10 days
|
#
ef3b7ba0 |
|
04-Sep-2010 |
Andriy Gapon <avg@FreeBSD.org> |
struct device: widen type of flags and order fields to u_int Also change int -> u_int for order parameter in device_add_child_ordered. There should not be any ABI change as struct device is private to subr_bus.c and the API change should be compatible. To do: change int -> u_int for order parameter of bus_add_child method and its implementations. The change should also be API compatible, but is a bit more churn. Suggested by: imp, jhb MFC after: 1 week
|
#
bebc3391 |
|
12-Jun-2010 |
Konstantin Belousov <kib@FreeBSD.org> |
Add modifications of devctl_notify(9) functions that take flags. Use flags to specify M_WAITOK/M_NOWAIT. M_WAITOK allows devctl to sleep for the memory allocation. As Warner noted, allowing the functions to sleep might cause reordering of the queued notifications. Reviewed by: imp, jh MFC after: 3 weeks
|
#
7b10638c |
|
21-Jan-2010 |
John Baldwin <jhb@FreeBSD.org> |
MFC 198134,198149,198170,198171,198391,200948: Add a facility for associating optional descriptions with active interrupt handlers. This is primarily intended as a way to allow devices that use multiple interrupts (e.g. MSI) to meaningfully distinguish the various interrupt handlers. - Add a new BUS_DESCRIBE_INTR() method to the bus interface to associate a description with an active interrupt handler setup by BUS_SETUP_INTR. It has a default method (bus_generic_describe_intr()) which simply passes the request up to the parent device. - Add a bus_describe_intr() wrapper around BUS_DESCRIBE_INTR() that supports printf(9) style formatting using var args. - Reserve MAXCOMLEN bytes in the intr_handler structure to hold the name of an interrupt handler and copy the name passed to intr_event_add_handler() into that buffer instead of just saving the pointer to the name. - Add a new intr_event_describe_handler() which appends a description string to an interrupt handler's name. - Implement support for interrupt descriptions on amd64, i386, and sparc64 by having the nexus(4) driver supply a custom bus_describe_intr method that invokes a new intr_describe() MD routine which in turn looks up the associated interrupt event and invokes intr_event_describe_handler().
|
#
42a346fa |
|
09-Dec-2009 |
John Baldwin <jhb@FreeBSD.org> |
For some buses, devices may have active resources assigned even though they are not allocated by the device driver. These resources should still appear allocated from the system's perspective so that their assigned ranges are not reused by other resource requests. The PCI bus driver has used a hack to effect this for a while now where it uses rman_set_device() to assign devices to the PCI bus when they are first encountered and later assigns them to the actual device when a driver allocates a BAR. A few downsides of this approach is that it results in somewhat confusing devinfo -r output as well as not being very easily portable to other bus drivers. This commit adds generic support for "reserved" resources to the resource list API used by many bus drivers to manage the resources of child devices. A resource may be reserved via resource_list_reserve(). This will allocate the resource from the bus' parent without activating it. resource_list_alloc() recognizes an attempt to allocate a reserved resource. When this happens it activates the resource (if requested) and then returns the reserved resource. Similarly, when a reserved resource is released via resource_list_release(), it is deactivated (if it is active) and the resource is then marked reserved again, but is left allocated from the bus' parent. To completely remove a reserved resource, a bus driver may use resource_list_unreserve(). A bus driver may use resource_list_busy() to determine if a reserved resource is allocated by a child device or if it can be unreserved. The PCI bus driver has been changed to use this framework instead of abusing rman_set_device() to keep track of reserved vs allocated resources. Submitted by: imp (an older version many moons ago) MFC after: 1 month
|
#
8dfed8b0 |
|
15-Oct-2009 |
John Baldwin <jhb@FreeBSD.org> |
Style fixes to the function prototypes for bus_alloc_resources() and bus_release_resources().
|
#
37b8ef16 |
|
15-Oct-2009 |
John Baldwin <jhb@FreeBSD.org> |
Add a facility for associating optional descriptions with active interrupt handlers. This is primarily intended as a way to allow devices that use multiple interrupts (e.g. MSI) to meaningfully distinguish the various interrupt handlers. - Add a new BUS_DESCRIBE_INTR() method to the bus interface to associate a description with an active interrupt handler setup by BUS_SETUP_INTR. It has a default method (bus_generic_describe_intr()) which simply passes the request up to the parent device. - Add a bus_describe_intr() wrapper around BUS_DESCRIBE_INTR() that supports printf(9) style formatting using var args. - Reserve MAXCOMLEN bytes in the intr_handler structure to hold the name of an interrupt handler and copy the name passed to intr_event_add_handler() into that buffer instead of just saving the pointer to the name. - Add a new intr_event_describe_handler() which appends a description string to an interrupt handler's name. - Implement support for interrupt descriptions on amd64 and i386 by having the nexus(4) driver supply a custom bus_describe_intr method that invokes a new intr_describe() MD routine which in turn looks up the associated interrupt event and invokes intr_event_describe_handler(). Requested by: many Reviewed by: scottl MFC after: 2 weeks
|
#
623b4aa5 |
|
15-Sep-2009 |
Attilio Rao <attilio@FreeBSD.org> |
MFC r197224: Use explicit int values for the device states in order to allow, if necessary, in the future, adds of new states without breaking ABI between revisions. Please note that this is a special condition as we want this fix in before RC1 as we assume it is critical and so it has been handled as an instant-merge. Approved by: re (kib)
|
#
9a3ca999 |
|
15-Sep-2009 |
Attilio Rao <attilio@FreeBSD.org> |
Use explicit int values for the device states in order to allow, if necessary, in the future, adds of new states without breaking ABI between revisions. Proposed by: kib Approved by: imp
|
#
4c68dee0 |
|
13-Sep-2009 |
Attilio Rao <attilio@FreeBSD.org> |
Revert r196779 in order to implement a different scheme for newbus locking methodology. Requested by: imp
|
#
80002a63 |
|
03-Sep-2009 |
Attilio Rao <attilio@FreeBSD.org> |
Add intermediate states for attaching and detaching that will be reused by the enhached newbus locking once it is checked in. This change can be easilly MFCed to STABLE_8 at the appropriate moment. Reviewed by: jhb, scottl Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
|
#
247db074 |
|
20-Aug-2009 |
John Baldwin <jhb@FreeBSD.org> |
MFC 196403: Temporarily revert the new-bus locking for 8.0 release. Approved by: re (kib)
|
#
a56fe095 |
|
20-Aug-2009 |
John Baldwin <jhb@FreeBSD.org> |
Temporarily revert the new-bus locking for 8.0 release. It will be reintroduced after HEAD is reopened for commits by re@. Approved by: re (kib), attilio
|
#
444b9186 |
|
02-Aug-2009 |
Attilio Rao <attilio@FreeBSD.org> |
Make the newbus subsystem Giant free by adding the new newbus sxlock. The newbus lock is responsible for protecting newbus internIal structures, device states and devclass flags. It is necessary to hold it when all such datas are accessed. For the other operations, softc locking should ensure enough protection to avoid races. Newbus lock is automatically held when virtual operations on the device and bus are invoked when loading the driver or when the suspend/resume take place. For other 'spourious' operations trying to access/modify the newbus topology, newbus lock needs to be automatically acquired and dropped. For the moment Giant is also acquired in some key point (modules subsystem) in order to avoid problems before the 8.0 release as module handlers could make assumptions about it. This Giant locking should go just after the release happens. Please keep in mind that the public interface can be expanded in order to provide more support, if there are really necessities at some point and also some bugs could arise as long as the patch needs a bit of further testing. Bump __FreeBSD_version in order to reflect the newbus lock introduction. Reviewed by: ed, hps, jhb, imp, mav, scottl No answer by: ariff, thompsa, yongari Tested by: pho, G. Trematerra <giovanni dot trematerra at gmail dot com>, Brandon Gooch <jamesbrandongooch at gmail dot com> Sponsored by: Yahoo! Incorporated Approved by: re (ksmith)
|
#
98266dcf |
|
09-Jun-2009 |
Warner Losh <imp@FreeBSD.org> |
As discussed on arch@, restire devclass_{add,delete,find,quiesce}_driver. They aren't needed or used and complicate locking newbus.
|
#
4ef60d26 |
|
09-Jun-2009 |
John Baldwin <jhb@FreeBSD.org> |
Add support for multiple passes of the device tree during the boot-time probe. The current device order is unchanged. This commit just adds the infrastructure and ABI changes so that it is easier to merge later changes into 8.x. - Driver attachments now have an associated pass level. Attachments are not allowed to probe or attach to drivers until the system-wide pass level is >= the attachment's pass level. By default driver attachments use the "last" pass level (BUS_PASS_DEFAULT). Driver's that wish to probe during an earlier pass use EARLY_DRIVER_MODULE() instead of DRIVER_MODULE() which accepts the pass level as an additional parameter. - A new method BUS_NEW_PASS has been added to the bus interface. This method is invoked when the system-wide pass level is changed to kick off a rescan of the device tree so that drivers that have just been made "eligible" can probe and attach. - The bus_generic_new_pass() function provides a default implementation of BUS_NEW_PASS(). It first allows drivers that were just made eligible for this pass to identify new child devices. Then it propogates the rescan to child devices that already have an attached driver by invoking their BUS_NEW_PASS() method. It also reprobes devices without a driver. - BUS_PROBE_NOMATCH() is only invoked for devices that do not have an attached driver after being scanned during the final pass. - The bus_set_pass() function is used during boot to raise the pass level. Currently it is only called once during root_bus_configure() to raise the pass level to BUS_PASS_DEFAULT. This has the effect of probing all devices in a single pass identical to previous behavior. Reviewed by: imp Approved by: re (kib)
|
#
d7f03759 |
|
19-Oct-2008 |
Ulf Lilleengen <lulf@FreeBSD.org> |
- Import the HEAD csup code which is the basis for the cvsmode work.
|
#
c14909b6 |
|
20-Jun-2008 |
Warner Losh <imp@FreeBSD.org> |
Split out the probing magic of device_probe_and_attach into device_probe() so that it can be used by busses that may wish to do additional processing between probe and attach. Reviewed by: dfr@
|
#
dcc81068 |
|
20-Mar-2008 |
John Baldwin <jhb@FreeBSD.org> |
Implement a BUS_BIND_INTR() method in the bus interface to bind an IRQ resource to a CPU. The default method is to pass the request up to the parent similar to BUS_CONFIG_INTR() so that all busses don't have to explicitly implement bus_bind_intr. A bus_bind_intr(9) wrapper routine similar to bus_setup/teardown_intr() is added for device drivers to use. Unbinding an interrupt is done by binding it to NOCPU. The IRQ resource must be allocated, but it can happen in any order with respect to bus_setup_intr(). Currently it is only supported on amd64 and i386 via nexus(4) methods that simply call the intr_bind() routine. Tested by: gallatin
|
#
908e1e5d |
|
08-Mar-2008 |
Warner Losh <imp@FreeBSD.org> |
Any driver that relies on its parent to set the devclass has no way to know if has siblings that need an actual probe. Introduce a specail return value called BUS_PROBE_NOOWILDCARD. If the driver returns this, the probe is only successful for devices that have had a specific devclass set for them. Reviewed by: current@, jhb@, grehan@
|
#
4f7f6238 |
|
27-Jan-2008 |
Mitsuru IWASAKI <iwasaki@FreeBSD.org> |
Add devctl_process_running() so that power management system driver can check whether devd(8) is running. MFC after: 1 week
|
#
ef544f63 |
|
22-Feb-2007 |
Paolo Pisati <piso@FreeBSD.org> |
o break newbus api: add a new argument of type driver_filter_t to bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@
|
#
bd4b6eb9 |
|
11-Sep-2006 |
John Baldwin <jhb@FreeBSD.org> |
Add prototype for bus_generic_add_child() missed in previous commit.
|
#
378f231e |
|
02-Sep-2006 |
John-Mark Gurney <jmg@FreeBSD.org> |
add a newbus method for obtaining the bus's bus_dma_tag_t... This is required by arches like sparc64 (not yet implemented) and sun4v where there are seperate IOMMU's for each PCI bus... For all other arches, it will end up returning NULL, which makes it a no-op... Convert a few drivers (the ones we've been working w/ on sun4v) to the new convection... Eventually all drivers will need to replace the parent tag of NULL, w/ bus_get_dma_tag(dev), though dev is usually different for each driver, and will require hand inspection... Reviewed by: scottl (earlier version)
|
#
db2bc1bb |
|
08-Jul-2006 |
Warner Losh <imp@FreeBSD.org> |
Create bus_enumerate_hinted_children. This routine will allow drivers to use the hinted child system. Bus drivers that use this need to implmenet the bus_hinted_child method, where they actually add the child to their bus, as they see fit. The bus is repsonsible for getting the attribtues for the child, adding it in the right order, etc. ISA hinting will be updated to use this method. MFC After: 3 days
|
#
be4db476 |
|
19-Apr-2006 |
John-Mark Gurney <jmg@FreeBSD.org> |
const'ify resource_spec to note that we won't be changing anything while releasing resources... also, NULL out the resources as we free them...
|
#
6db1c434 |
|
24-Sep-2005 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Add convenience macros for bus_space usage that doesn't require specification of bus tag+handle. Instead of bus_space_write_1(sc->tag, sc->handle, ...) this macros offer bus_write_1(sc->resource, ...) The name+argument transformation is constant and the the macros are generated (by hand) by the script in tools/bus_macro.sh.
|
#
a7789231 |
|
24-Sep-2005 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Add two convenience functions for device drivers: bus_alloc_resources() and bus_free_resources(). These functions take a list of resources and handle them all in one go. A flag makes it possible to mark a resource as optional. A typical device driver can save 10-30 lines of code by using these. Usage examples will follow RSN. MFC: A good idea, eventually.
|
#
fe0519b1 |
|
17-Sep-2005 |
Warner Losh <imp@FreeBSD.org> |
MFp4: Expose device_probe_child()
|
#
2bd5d814 |
|
12-Apr-2005 |
Warner Losh <imp@FreeBSD.org> |
resource_list_purge: release the resources in this list, and purge the elements of this list (eg, reset it). Man page to follow
|
#
cdf7c848 |
|
11-Apr-2005 |
Warner Losh <imp@FreeBSD.org> |
Return the resource created/found in resource_list_add to avoid an extra resouce_list_find in some places. Suggested by: sam Found by: Coventry Analysis tool.
|
#
fada20b9 |
|
04-Apr-2005 |
Nate Lawson <njl@FreeBSD.org> |
Add devclass_get_drivers(9) which provides an array of pointers to driver instances in a given devclass. This is useful for systems that want to call code in driver static methods, similar to device_identify(). Reviewed by: dfr MFC after: 2 weeks
|
#
36fed965 |
|
17-Mar-2005 |
Warner Losh <imp@FreeBSD.org> |
Use STAILQ in preference to SLIST for the resources. Insert new resources last in the list rather than first. This makes the resouces print in the 4.x order rather than the 5.x order (eg fdc0 at 0x3f0-0x3f5,0x3f7 is 4.x, but 0x3f7,0x3f0-0x3f5 is 5.x). This also means that the pci code will once again print the resources in BAR ascending order.
|
#
9fc03867 |
|
24-Feb-2005 |
Warner Losh <imp@FreeBSD.org> |
Introduce defines for different levels of match in the bus probe routine to try to standardize values a bit. Discussed on: arch@ MFC After: 3 days
|
#
234111d6 |
|
18-Jan-2005 |
Warner Losh <imp@FreeBSD.org> |
Introduce bus_free_resource. It is a convenience function which wraps bus_release_resource by grabbing the rid from the resource.
|
#
d0d4cc63 |
|
31-Dec-2004 |
Warner Losh <imp@FreeBSD.org> |
Implement device_quiesce. This method means 'you are about to be unloaded, cleanup, or return ebusy of that's inconvenient.' The default module hanlder for newbus will now call this when we get a MOD_QUIESCE event, but in the future may call this at other times. This shouldn't change any actual behavior until drivers start to use it.
|
#
8844d5ef |
|
07-Dec-2004 |
Nate Lawson <njl@FreeBSD.org> |
Add the devclass_get_count(9) function and man page. It gets a count of the number of devices in a devclass and is a subset of devclass_get_devices(9). Reviewed by: imp, dfr
|
#
4c4392e7 |
|
18-Jul-2004 |
Doug Rabson <dfr@FreeBSD.org> |
Add doxygen doc comments for most of newbus and the BUS interface.
|
#
35e32fd8 |
|
04-Jun-2004 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
Add a devclass level to the dev sysctl tree, in order to support per- class variables in addition to per-device variables. In plain English, this means that dev.foo0.bar is now called dev.foo.0.bar, and it is possible to to have dev.foo.bar as well.
|
#
60002516 |
|
04-Jun-2004 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
Whitespace cleanup.
|
#
5c1921b7 |
|
24-May-2004 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
As previously threatened, give each device its own sysctl context and subtree (under the new dev top-level node). This should greatly simplify drivers which need per-device sysctl variables (such as ndis).
|
#
bdffb39f |
|
17-Mar-2004 |
Nate Lawson <njl@FreeBSD.org> |
Add bus_alloc_resource_any(9), which does bus_alloc_resource() with the appropriate default values. Document it in the manpage. Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde Abstains: bde
|
#
17e02bb3 |
|
24-Oct-2003 |
Warner Losh <imp@FreeBSD.org> |
Convenience functions to generate notifications from the kernel. The ACPI code will start using these shortly. Reviewed by: njl
|
#
46ba7a35 |
|
16-Oct-2003 |
Doug Rabson <dfr@FreeBSD.org> |
* Add multiple inheritance to kobj. Each class can have zero or more base classes and if a method is not found in a given class, its base classes are searched (in the order they were declared). This search is recursive, i.e. a method may be define in a base class of a base class. * Change the kobj method lookup algorithm to one which is SMP-safe. This relies only on the constraint that an observer of a sequence of writes of pointer-sized values will see exactly one of those values, not a mixture of two or more values. This assumption holds for all processors which FreeBSD supports. * Add locking to kobj class initialisation. * Add a simpler form of 'inheritance' for devclasses. Each devclass can have a parent devclass. Searches for drivers continue up the chain of devclasses until either a matching driver is found or a devclass is reached which has no parent. This can allow, for instance, pci drivers to match cardbus devices (assuming that cardbus declares pci as its parent devclass). * Increment __FreeBSD_version. This preserves the driver API entirely except for one minor feature used by the ISA compatibility shims. A workaround for ISA compatibility will be committed separately. The kobj and newbus ABI has changed - all modules must be recompiled.
|
#
da13b8f9 |
|
10-Sep-2003 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Introduce BUS_CONFIG_INTR(). The method allows devices to tell parents about interrupt trigger mode and interrupt polarity. This allows ACPI for example to pass interrupt resource information up the hierarchy. The default implementation of the method therefore is to pass the request to the parent. Reviewed by: jhb, njl
|
#
6591b310 |
|
02-Jul-2003 |
John Baldwin <jhb@FreeBSD.org> |
Add a resource_disabled() helper function that returns true (non-zero) if a specified resource has been disabled via a non-zero 'disabled' hint and false otherwise.
|
#
01a9b434 |
|
21-Apr-2003 |
Warner Losh <imp@FreeBSD.org> |
Create a new function, device_is_attached(), that is like device_is_alive() that tells us if the device has successfully attached. device_is_alive just tells us that the device has successfully probed.
|
#
016f4819 |
|
17-Feb-2003 |
Warner Losh <imp@FreeBSD.org> |
Bump pnpinfo and location size to 128 bytes. Since these are computed on the fly and read into userland one at a time, this costs very little total memory. The pnpinfo sizes of pccard is more than 64 bytes due to the length of the strings that man cards have in their CIS.
|
#
0a1d3ef9 |
|
07-Oct-2002 |
Warner Losh <imp@FreeBSD.org> |
Add wrappers around the newly created bus_child_pnpinfo_str and bus_child_location_str.
|
#
bed80719 |
|
14-Sep-2002 |
Warner Losh <imp@FreeBSD.org> |
Add additional information returned to userland by the device querying functions. We add pnpinfo, locationinfo, devflags (the newbus flags on the device), flags (the flags that device_get_flags returns) and state to the list of things we return. pnpinfo and locationinfo are place holders at the moment that will be filled in by the device's parent (optionally). Userland programs will likely use this information from time to time and take appropriate actions. Improvements to devinfo to follow.
|
#
653de878 |
|
12-Sep-2002 |
John Baldwin <jhb@FreeBSD.org> |
Add a blank line to make this more consistent with the rest of the file.
|
#
5878eb3f |
|
20-Jul-2002 |
Warner Losh <imp@FreeBSD.org> |
Add bus_child_present and the child_present method to bus_if.m
|
#
32bc1098 |
|
28-Mar-2002 |
Matthew N. Dodd <mdodd@FreeBSD.org> |
Add resource_list_add_next() which returns the RID for the resource added.
|
#
87b1520a |
|
21-Dec-2001 |
Thomas Moestl <tmm@FreeBSD.org> |
Add a generic __BUS_ACCESSOR macro to construct ivar accessor functions, and a generic resource_list_print_type() function to print all resouces of a certain type in a resource list. Use ulmin()/ulmax() instead of min()/max() in two places to handle u_longs correctly.
|
#
3eadb99f |
|
31-Oct-2001 |
Andrey A. Chernov <ache@FreeBSD.org> |
Add devclass_find_free_unit() prototype
|
#
5a280d9c |
|
16-Jun-2001 |
Peter Wemm <peter@FreeBSD.org> |
Add INTR_TYPE_AV so that we can get to the PI_AV priority in the ithread handlers. This is beneficial since it means that pcm's MPSAFE handler can get run before things that will block on Giant in the shared irq case.
|
#
2398f0cd |
|
12-Jun-2001 |
Peter Wemm <peter@FreeBSD.org> |
Hints overhaul: - Replace some very poorly thought out API hacks that should have been fixed a long while ago. - Provide some much more flexible search functions (resource_find_*()) - Use strings for storage instead of an outgrowth of the rather inconvenient temporary ioconf table from config(). We already had a fallback to using strings before malloc/vm was running anyway.
|
#
c612c69d |
|
19-Apr-2001 |
David E. O'Brien <obrien@FreeBSD.org> |
style(9) edit. Prompted by email from: dfr
|
#
e761636a |
|
09-Feb-2001 |
John Baldwin <jhb@FreeBSD.org> |
Axe INTR_HEAVY, INTR_LIGHT, and INTR_THREADED. Add in a INTR_TYPE_CLK priorirty for clock interrupt handlers and an INTR_ENTROPY flag to mark interrupt sources that are good sources of entropy.
|
#
46aa504e |
|
27-Nov-2000 |
Matthew N. Dodd <mdodd@FreeBSD.org> |
Alter the return value and arguments of the GET_RESOURCE_LIST bus method. Alter consumers of this method to conform to the new convention. Minor cosmetic adjustments to bus.h. This isn't of concern as this interface isn't in use yet.
|
#
edcb5775 |
|
09-Nov-2000 |
Mike Smith <msmith@FreeBSD.org> |
Implement a trivial but effective interface for obtaining the kernel's device tree and resource manager contents. This is the kernel side of the upcoming libdevinfo, which will expose this information to userspace applications in a trivial fashion. Remove the now-obsolete DEVICE_SYSCTLS code.
|
#
0cb53e24 |
|
17-Oct-2000 |
Matthew N. Dodd <mdodd@FreeBSD.org> |
Add new bus method 'GET_RESOURCE_LIST' and appropriate generic implementation. Add bus_generic_rl_{get,set,delete,release,alloc}_resource() functions which provide generic operations for devices using resource list style resource management. This should simplify a number of bus drivers. Further commits to follow.
|
#
0384fff8 |
|
06-Sep-2000 |
Jason Evans <jasone@FreeBSD.org> |
Major update to the way synchronization is done in the kernel. Highlights include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
|
#
9282307a |
|
03-Jul-2000 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Add device_set_softc() which does the obvious. Not objected to by: dfr
|
#
e3975643 |
|
25-May-2000 |
Jake Burkholder <jake@FreeBSD.org> |
Back out the previous change to the queue(3) interface. It was not discussed and should probably not happen. Requested by: msmith and others
|
#
740a1973 |
|
23-May-2000 |
Jake Burkholder <jake@FreeBSD.org> |
Change the way that the queue(3) structures are declared; don't assume that the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd
|
#
4b4a49fd |
|
01-May-2000 |
Doug Rabson <dfr@FreeBSD.org> |
* Move the driver_t::refs field to kobj_t to replace kobj_t::instances. * Back out a couple of workarounds for the confusion between kobj_t::instances and driver_t::refs.
|
#
f7b77691 |
|
08-Apr-2000 |
Doug Rabson <dfr@FreeBSD.org> |
* Factor out the object system from new-bus so that it can be used by non-device code. * Re-implement the method dispatch to improve efficiency. The new system takes about 40ns for a method dispatch on a 300Mhz PII which is only 10ns slower than a direct function call on the same hardware. This changes the new-bus ABI slightly so make sure you re-compile any driver modules which you use.
|
#
ce73953a |
|
31-Mar-2000 |
Warner Losh <imp@FreeBSD.org> |
device_set_unit() DO NOT USE THIS. This was approved before 4.0 release for inclusion into the release, but bde talked me out of committing the module that needs this until after the release. It is after the release now. :-)
|
#
664a31e4 |
|
28-Dec-1999 |
Peter Wemm <peter@FreeBSD.org> |
Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come.
|
#
fe0d4089 |
|
03-Dec-1999 |
Matthew N. Dodd <mdodd@FreeBSD.org> |
Remove the 'ivars' arguement to device_add_child() and device_add_child_ordered(). 'ivars' may now be set using the device_set_ivars() function. This makes it easier for us to change how arbitrary data structures are associated with a device_t. Eventually we won't be modifying device_t to add additional pointers for ivars, softc data etc. Despite my best efforts I've probably forgotten something so let me know if this breaks anything. I've been running with this change for months and its been quite involved actually isolating all the changes from the rest of the local changes in my tree. Reviewed by: peter, dfr
|
#
efa726dd |
|
17-Nov-1999 |
Peter Wemm <peter@FreeBSD.org> |
'const'ify a bunch of pointers in the resource_*() functions for accessing the config hint tables. This fixes a few warnings elsewhere (eg: fd).
|
#
5dad867f |
|
08-Nov-1999 |
Peter Wemm <peter@FreeBSD.org> |
Zap DEV_DRIVER_MODULE(). The New world order is that drivers create their dev nodes with make_dev() in a devfs-compatable way by supplying names. This doesn't fit into a compile-time scheme like DEV_DRIVER_MODULE, especially since the cdevsw[] array's days are numbered.
|
#
3320884f |
|
08-Nov-1999 |
Peter Wemm <peter@FreeBSD.org> |
Don't let drivers that use DEV_DRIVER_MODULE() compile as they won't work and will leave a system stranded.
|
#
25afb89b |
|
12-Oct-1999 |
Doug Rabson <dfr@FreeBSD.org> |
* Add struct resource_list* argument to resource_list_alloc and resource_list_release. This removes the dependancy on the layout of ivars. * Move set_resource, get_resource and delete_resource from isa_if.m to bus_if.m. * Simplify driver code by providing wrappers to those methods: bus_set_resource(dev, type, rid, start, count); bus_get_resource(dev, type, rid, startp, countp); bus_get_resource_start(dev, type, rid); bus_get_resource_count(dev, type, rid); bus_delete_resource(dev, type, rid); * Delete isa_get_rsrc and use bus_get_resource_start instead. * Fix a stupid typo in isa_alloc_resource reported by Takahashi Yoshihiro <nyan@FreeBSD.org>. * Print a diagnostic message if we can't assign resources to a PnP device. * Change device_print_prettyname() so that it doesn't print "(no driver assigned)-1" for anonymous devices.
|
#
062acdb7 |
|
07-Sep-1999 |
Doug Rabson <dfr@FreeBSD.org> |
Change isa_get/set_flags() to device_get/set_flags().
|
#
c3aac50f |
|
27-Aug-1999 |
Peter Wemm <peter@FreeBSD.org> |
$Id$ -> $FreeBSD$
|
#
15317dd8 |
|
28-Jul-1999 |
Matthew N. Dodd <mdodd@FreeBSD.org> |
Alter the behavior of sys/kern/subr_bus.c:device_print_child() - device_print_child() either lets the BUS_PRINT_CHILD method produce the entire device announcement message or it prints "foo0: not found\n" Alter sys/kern/subr_bus.c:bus_generic_print_child() to take on the previous behavior of device_print_child() (printing the "foo0: <FooDevice 1.1>" bit of the announce message.) Provide bus_print_child_header() and bus_print_child_footer() to actually print the output for bus_generic_print_child(). These functions should be used whenever possible (unless you can just use bus_generic_print_child()) The BUS_PRINT_CHILD method now returns int instead of void. Modify everything else that defines or uses a BUS_PRINT_CHILD method to comply with the above changes. - Devices are 'on' a bus, not 'at' it. - If a custom BUS_PRINT_CHILD method does the same thing as bus_generic_print_child(), use bus_generic_print_child() - Use device_get_nameunit() instead of both device_get_name() and device_get_unit() - All BUS_PRINT_CHILD methods return the number of characters output. Reviewed by: dfr, peter
|
#
f1550d9d |
|
24-Jul-1999 |
Doug Rabson <dfr@FreeBSD.org> |
This makes the in kernel printf routines conform to the documented behavior of their userland counterparts with respect to return values. Submitted by: Matthew N. Dodd <winter@jurai.net>
|
#
03016f42 |
|
04-Jul-1999 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Remove cmaj and bmaj args from DEV_DRIVER_MODULE.
|
#
20b62c5a |
|
30-May-1999 |
Doug Rabson <dfr@FreeBSD.org> |
* Add a function devclass_create() which looks up the named devclass and creates it if it doesn't exist. * Rename resource_list_remove() to resource_list_delete() for consistency.
|
#
bea6af4d |
|
28-May-1999 |
Doug Rabson <dfr@FreeBSD.org> |
* Change device_add_child_after() to device_add_child_ordered() which is easier to use and more flexible. * Change BUS_ADD_CHILD to take an order argument instead of a place. * Define a partial ordering for isa devices so that sensitive devices are probed before non-sensitive ones.
|
#
7e082b48 |
|
22-May-1999 |
Doug Rabson <dfr@FreeBSD.org> |
Add some helper functions to make it easier to write a driver for a bus which needs to manage resources for its children.
|
#
6c2e3dde |
|
14-May-1999 |
Doug Rabson <dfr@FreeBSD.org> |
* Define a new static method DEVICE_IDENTIFY which is called to add device instances to a parent bus. * Define a new method BUS_ADD_CHILD which can be called from DEVICE_IDENTIFY to add new instances. * Add a generic implementation of DEVICE_PROBE which calls DEVICE_IDENTIFY for each driver attached to the parent's devclass. * Move the hint-based isa probe from the isa driver to a new isahint driver which can be shared between i386 and alpha.
|
#
52400704 |
|
09-May-1999 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Unconfuse DEV_MODULE() and DEV_DRIVER_MODULE() about the difference between a major number for a dev_t.
|
#
566643e3 |
|
08-May-1999 |
Doug Rabson <dfr@FreeBSD.org> |
Move the declaration of the interrupt type from the driver structure to the BUS_SETUP_INTR call.
|
#
b547392e |
|
08-May-1999 |
Peter Wemm <peter@FreeBSD.org> |
Change resource_set_*() interface to be more useful.
|
#
46eede00 |
|
07-May-1999 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Continue where Julian left off in July 1998: Virtualize bdevsw[] from cdevsw. bdevsw() is now an (inline) function. Join CDEV_MODULE and BDEV_MODULE to DEV_MODULE (please pay attention to the order of the cmaj/bmaj arguments!) Join CDEV_DRIVER_MODULE and BDEV_DRIVER_MODULE to DEV_DRIVER_MODULE (ditto!) (Next step will be to convert all bdev dev_t's to cdev dev_t's before they get to do any damage^H^H^H^H^H^Hwork in the kernel.)
|
#
6182fdbd |
|
16-Apr-1999 |
Peter Wemm <peter@FreeBSD.org> |
Bring the 'new-bus' to the i386. This extensively changes the way the i386 platform boots, it is no longer ISA-centric, and is fully dynamic. Most old drivers compile and run without modification via 'compatability shims' to enable a smoother transition. eisa, isapnp and pccard* are not yet using the new resource manager. Once fully converted, all drivers will be loadable, including PCI and ISA. (Some other changes appear to have snuck in, including a port of Soren's ATA driver to the Alpha. Soren, back this out if you need to.) This is a checkpoint of work-in-progress, but is quite functional. The bulk of the work was done over the last few years by Doug Rabson and Garrett Wollman. Approved by: core
|
#
6350e58a |
|
29-Mar-1999 |
Doug Rabson <dfr@FreeBSD.org> |
Add some useful functions to the device framework: * bus_setup_intr() as a wrapper for BUS_SETUP_INTR * bus_teardown_intr() as a wrapper for BUS_TEARDOWN_INTR * device_get_nameunit() which returns e.g. "foo0" for name "foo" and unit 0. * device_set_desc_copy() malloc a copy of the description string. * device_quiet(), device_is_quiet(), device_verbose() suppress probe message. Add one method to the BUS interface, BUS_CHILD_DETACHED() which is called after the child has been detached to allow the bus to clean up any memory which it allocated on behalf of the child. I also fixed a bug which corrupted the list of drivers in a devclass if a driver was added to more than one devclass.
|
#
66f8df86 |
|
06-Mar-1999 |
Bruce Evans <bde@FreeBSD.org> |
Include <sys/queue.h> so that this file is almost self-sufficient, as is specified in about 40 section 9 man pages. Translated to C (C doesn't support forward declarations of enums).
|
#
c3654b5c |
|
16-Jan-1999 |
Doug Rabson <dfr@FreeBSD.org> |
A few small improvements to the bus code: * A function device_printf() to make pretty-printing driver messages easier. * A function device_get_children() to query the children of a device. * Generic implementations of BUS_ALLOC_RESOURCE and BUS_RELEASE_RESOURCE. * Change bus_generic_print_child() so that it is actually useful.
|
#
14177d72 |
|
14-Nov-1998 |
Garrett Wollman <wollman@FreeBSD.org> |
My changes to the new device interface: - Interface wth the new resource manager. - Allow for multiple drivers implementing a single devclass. - Remove ordering dependencies between header files. - Style cleanup. - Add DEVICE_SUSPEND and DEVICE_RESUME methods. - Move to a single-phase interrupt setup scheme. Kernel builds on the Alpha are brken until Doug gets a chance to incorporate these changes on that side. Agreed to in principle by: dfr
|
#
bb54cacb |
|
31-Jul-1998 |
Doug Rabson <dfr@FreeBSD.org> |
Make it possible to have a driver registered with more than one parent bus.
|
#
0bf03084 |
|
22-Jul-1998 |
Doug Rabson <dfr@FreeBSD.org> |
Add some very simple support for a compiled in (from config(8)) resource database.
|
#
45c95fa1 |
|
12-Jul-1998 |
Doug Rabson <dfr@FreeBSD.org> |
Change interrupt api to be closer to intr_create/intr_connect.
|
#
6521fa61 |
|
05-Jul-1998 |
Doug Rabson <dfr@FreeBSD.org> |
Minor tidying.
|
#
99d11cde |
|
14-Jun-1998 |
Doug Rabson <dfr@FreeBSD.org> |
Major changes to the generic device framework for FreeBSD/alpha: * Eliminate bus_t and make it possible for all devices to have attached children. * Support dynamically extendable interfaces for drivers to replace both the function pointers in driver_t and bus_ops_t (which has been removed entirely. Two system defined interfaces have been defined, 'device' which is mandatory for all devices and 'bus' which is recommended for all devices which support attached children. * In addition, the alpha port defines two simple interfaces 'clock' for attaching various real time clocks to the system and 'mcclock' for the many different variations of mc146818 clocks which can be attached to different alpha platforms. This eliminates two more function pointer tables in favour of the generic method dispatch system provided by the device framework. Future device interfaces may include: * cdev and bdev interfaces for devfs to use in replacement for specfs and the fixed interfaces bdevsw and cdevsw. * scsi interface to replace struct scsi_adapter (not sure how this works in CAM but I imagine there is something similar there). * various tailored interfaces for different bus types such as pci, isa, pccard etc.
|
#
897cd717 |
|
10-Jun-1998 |
Doug Rabson <dfr@FreeBSD.org> |
Add initial support for the FreeBSD/alpha kernel. This is very much a work in progress and has never booted a real machine. Initial development and testing was done using SimOS (see http://simos.stanford.edu for details). On the SimOS simulator, this port successfully reaches single-user mode and has been tested with loads as high as one copy of /bin/ls :-). Obtained from: partly from NetBSD/alpha
|