#
cbcb9778 |
|
10-May-2024 |
Elliott Mitchell <ehem+freebsd@m5p.com> |
kern/rman: mark rman get functions as taking constants The arguments are left completely unchanged by these functions. This allows passing constant pointers for verifying ownership, but not modifying the contents. Reviewed by: imp,jhb Pull Request: https://github.com/freebsd/freebsd-src/pull/1224
|
#
996fa9fb |
|
08-May-2024 |
Elliott Mitchell <ehem+freebsd@m5p.com> |
kern/rman: update rman_make_alignment_flags() The flsl() function makes use of hardware functionality to compute the value faster than this loop. The only deviation from flsl() is at 0. Reviewed by: imp,jhb Pull Request: https://github.com/freebsd/freebsd-src/pull/1224
|
#
037946dc |
|
08-May-2024 |
Elliott Mitchell <ehem+freebsd@m5p.com> |
kern/rman: remove rman_reserve_resource_bound(), partially revert 13fb6657723 Not once has rman_reserve_resource_bound() ever been used. There are though several uses of RF_ALIGNMENT. In light of this remove this extra and leave the actually used portion in place. This partially reverts commit 13fb6657723c1e9cb47bbd286942b432a4306b96. Reviewed by: imp,jhb Pull Request: https://github.com/freebsd/freebsd-src/pull/1224
|
#
beb1165a |
|
08-May-2024 |
Elliott Mitchell <ehem+freebsd@m5p.com> |
kern/rman: update debugging lines in subr_rman.c Rather than hard-code the function name, use __func__ instead. Apply some style and adjust indentation as appropriate. Remove the no longer required braces. Reviewed by: imp,jhb Pull Request: https://github.com/freebsd/freebsd-src/pull/1224
|
#
973c3229 |
|
08-May-2024 |
Elliott Mitchell <ehem+freebsd@m5p.com> |
kern/rman: update DPRINTF() macro, avoid semicolon swallowing match function Using a variadic macro allows passing everything properly to printf(). Using the do { } while(0) construct ensures the macro acts like any other single statement. This shows just how long some of this has existed. Reviewed by: imp,jhb Pull Request: https://github.com/freebsd/freebsd-src/pull/1224
|
#
b30a80b6 |
|
13-Mar-2024 |
John Baldwin <jhb@FreeBSD.org> |
rman: Add rman_get/set_type This permits associating a resource type (e.g. SYS_RES_MEMORY) with a struct resource. I considered adding a new field to struct rman to store the type and only providing rman_get_type as an accessor. However, changing 'struct rman' is an ABI breakage. I might revisit this in main, but the current approach is MFC'able. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44122
|
#
04fc3fb8 |
|
27-Feb-2024 |
John Baldwin <jhb@FreeBSD.org> |
rman: Remove rman_set_start/end These functions are not safe as the rman implementation assumes that all regions (including allocated resources) are sorted by address in the internal linked-list. Differential Revision: https://reviews.freebsd.org/D43936
|
#
fdafd315 |
|
24-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Automated cleanup of cdefs and other formatting Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
|
#
685dc743 |
|
16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
#
c84c5e00 |
|
18-Jul-2022 |
Mitchell Horne <mhorne@FreeBSD.org> |
ddb: annotate some commands with DB_CMD_MEMSAFE This is not completely exhaustive, but covers a large majority of commands in the tree. Reviewed by: markj Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35583
|
#
bcddaadb |
|
27-Sep-2021 |
Elliott Mitchell <ehem+freebsd@m5p.com> |
rman: fix overflow in rman_reserve_resource_bound() If the default range of [0, ~0] is given, then (~0 - 0) + 1 == 0. This in turn will cause any allocation of non-zero size to fail. Zero-sized allocations are prohibited, so add a KASSERT to this effect. History indicates it is part of the original rman code. This bug may in fact be older than some contributors. Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30280
|
#
55c57a78 |
|
05-Jul-2021 |
Jessica Clarke <jrtc27@FreeBSD.org> |
rman: Remove an outdated comment that no longer applies Since commit 2dd1bdf1834c in 2016 the r_start and r_end fields have been rman_res_t, which was briefly unsigned long, but commit da1b038af9f9 changed the typedef to be uintmax_t instead. C99 is also something we assume these days. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D30808
|
#
7029da5c |
|
26-Feb-2020 |
Pawel Biernacki <kaktus@FreeBSD.org> |
Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718
|
#
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
|
#
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
|
#
d17f808f |
|
04-May-2016 |
Adrian Chadd <adrian@FreeBSD.org> |
s/struct device */device_t/g Submitted by: kmacy
|
#
da1b038a |
|
17-Mar-2016 |
Justin Hibbits <jhibbits@FreeBSD.org> |
Use uintmax_t (typedef'd to rman_res_t type) for rman ranges. On some architectures, u_long isn't large enough for resource definitions. Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but type `long' is only 32-bit. This extends rman's resources to uintmax_t. With this change, any resource can feasibly be placed anywhere in physical memory (within the constraints of the driver). Why uintmax_t and not something machine dependent, or uint64_t? Though it's possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on 32-bit architectures. 64-bit architectures should have plenty of RAM to absorb the increase on resource sizes if and when this occurs, and the number of resources on memory-constrained systems should be sufficiently small as to not pose a drastic overhead. That being said, uintmax_t was chosen for source clarity. If it's specified as uint64_t, all printf()-like calls would either need casts to uintmax_t, or be littered with PRI*64 macros. Casts to uintmax_t aren't horrible, but it would also bake into the API for resource_list_print_type() either a hidden assumption that entries get cast to uintmax_t for printing, or these calls would need the PRI*64 macros. Since source code is meant to be read more often than written, I chose the clearest path of simply using uintmax_t. Tested on a PowerPC p5020-based board, which places all device resources in 0xfxxxxxxxx, and has 8GB RAM. Regression tested on qemu-system-i386 Regression tested on qemu-system-mips (malta profile) Tested PAE and devinfo on virtualbox (live CD) Special thanks to bz for his testing on ARM. Reviewed By: bz, jhb (previous) Relnotes: Yes Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D4544
|
#
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
|
#
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
|
#
db41d262 |
|
05-Nov-2015 |
John Baldwin <jhb@FreeBSD.org> |
When dumping an rman in DDB, include the RID of each resource. Submitted by: Ravi Pokala (rpokala@panasas.com) Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D4086
|
#
d3a68794 |
|
16-Jul-2014 |
Don Lewis <truckman@FreeBSD.org> |
Nuke the never-used RF_TIMESHARE feature, reducing the complexity of the code. The consensus on arch@ is that this feature might have been useful in the distant past, but is now just unnecessary bloat. The int_rman_activate_resource() and int_rman_deactivate_resource() functions become trivial, so manually inline them. The special deferred handling of RF_ACTIVE is no longer needed in reserve_resource_bound(), so eliminate the associated code at the end of the function. These changes reduce the object file size by more than 500 bytes on i386. Update the rman.9 man page to reflect the removal of the RF_TIMESHARE feature. MFC after: 2 weeks
|
#
626a7975 |
|
07-Jul-2014 |
Don Lewis <truckman@FreeBSD.org> |
Declaration whitespace changes for style(9). MFC after: 1 week
|
#
af3b2549 |
|
27-Jun-2014 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Pull in r267961 and r267973 again. Fix for issues reported will follow.
|
#
37a107a4 |
|
27-Jun-2014 |
Glen Barber <gjb@FreeBSD.org> |
Revert r267961, r267973: These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory
|
#
3da1cf1e |
|
27-Jun-2014 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Extend the meaning of the CTLFLAG_TUN flag to automatically check if there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies
|
#
5b892e73 |
|
28-May-2014 |
Don Lewis <truckman@FreeBSD.org> |
Initialize r_flags the same way in all cases using a sanitized copy of flags that has several bits cleared. The RF_WANTED and RF_FIRSTSHARE bits are invalid in this context, and we want to defer setting RF_ACTIVE in r_flags until later. This should make rman_get_flags() return the correct answer in all cases. Add a KASSERT() to catch callers which incorrectly pass the RF_WANTED or RF_FIRSTSHARE flags. Do a strict equality check on the share type bits of flags. In particular, do an equality check on RF_PREFETCHABLE. The previous code would allow one type of mismatch of RF_PREFETCHABLE but disallow the other type of mismatch. Also, ignore the the RF_ALIGNMENT_MASK bits since alignment validity should be handled by the amask check. This field contains an integer value, but previous code did a strange bitwise comparison on it. Leave the original value of flags unmolested as a minor debug aid. Change the start+amask overflow check to a KASSERT() since it is just meant to catch a highly unlikely programming error in the caller. Reviewed by: jhb MFC after: 1 month
|
#
c201b03f |
|
18-May-2014 |
Don Lewis <truckman@FreeBSD.org> |
Slightly restructure the final loop in rman_reserve_resource_bound(). Replace with the existing loop termination test with a similar condition from the nested "if" that may terminate the loop a bit sooner, but still not too early. This condition can then be removed from the nested "if". Relocate an operator to be style(9) compliant. MFC after: 3 days
|
#
11e104c5 |
|
12-May-2014 |
Don Lewis <truckman@FreeBSD.org> |
Be even more paranoid about overflow. Requested by: ache
|
#
11ada701 |
|
12-May-2014 |
Don Lewis <truckman@FreeBSD.org> |
Nuke a couple of unnecessary assigments. Nothing uses the values of rstart and rend after this point. MFC after: 1 week
|
#
1237b6d9 |
|
05-May-2014 |
Don Lewis <truckman@FreeBSD.org> |
Avoid unsigned integer overflow which can cause rman_reserve_resource_bound() to return incorrect results. Continue the initial search until the first viable region is found. Add a comment to explain the search termination test. PR: kern/188534 Reviewed by: jhb (previous version) MFC after: 1 week
|
#
a241707e |
|
31-May-2012 |
Warner Losh <imp@FreeBSD.org> |
Unlock in the error path to prevent a lock leak. PR: 162174 Submitted by: Ian Lepore MFC after: 2 weeks
|
#
6472ac3d |
|
07-Nov-2011 |
Ed Schouten <ed@FreeBSD.org> |
Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
|
#
69b63a9d |
|
06-Jun-2011 |
John Baldwin <jhb@FreeBSD.org> |
Clear the device_t pointer in 'struct resource' when releasing a device as otherwise the sysctl to export rman info can dereference a stale pointer. PR: kern/115371 Submitted by: Arthur Hartwig MFC after: 1 week
|
#
bb82622c |
|
29-Apr-2011 |
John Baldwin <jhb@FreeBSD.org> |
Extend the rman(9) API to support altering an existing resource. Specifically, these changes allow a resource to back a relocatable and resizable resource such as the I/O window decoders in PCI-PCI bridges. - rman_adjust_resource() can adjust the start and end address of an existing resource. It only succeeds if the newly requested address space is already free. It also supports shrinking a resource in which case the freed space will be marked unallocated in the rman. - rman_first_free_region() and rman_last_free_region() return the start and end addresses for the first or last unallocated region in an rman, respectively. This can be used to determine by how much the resource backing an rman must be adjusted to accomodate an allocation request that does not fit into the existing rman. While here, document the rm_start and rm_end fields in struct rman, rman_is_region_manager(), the bound argument to rman_reserve_resource_bound(), and rman_init_from_resource().
|
#
b67d11bb |
|
29-Apr-2011 |
John Baldwin <jhb@FreeBSD.org> |
Change rman_manage_region() to actually honor the rm_start and rm_end constraints on the rman and reject attempts to manage a region that is out of range. - Fix various places that set rm_end incorrectly (to ~0 or ~0u instead of ~0ul). - To preserve existing behavior, change rman_init() to set rm_start and rm_end to allow managing the full range (0 to ~0ul) if they are not set by the caller when rman_init() is called.
|
#
0f4d3c92 |
|
13-Apr-2011 |
Gavin Atkinson <gavin@FreeBSD.org> |
Add a new DDB command, "show rmans", which will show the address and brief details of each rman header, but not the contents of all rman structures in the system. This is especially useful on platforms where some rmans have many thousands of entries in rmans, making scrolling through the output of "show all rman" impractical. Individual rmans can then be viewed including their contents with "show rman 0xaddr" as usual. Reviewed by: jhb
|
#
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.
|
#
51ca6cd6 |
|
19-May-2009 |
Andriy Gapon <avg@FreeBSD.org> |
sysctl_rman: report shared resources to devinfo shared uses of a resource are recorded on a sub-list hanging off a main resource object on a main resource list; without this change a shared resource (e.g. irq) is reported only once by devinfo -r/-u; with this change the resource is reported for each driver that allocates it (which is even more than what vmstat -i -a reports). Approved by: jhb (mentor)
|
#
8ed4d9c9 |
|
03-Feb-2009 |
Warner Losh <imp@FreeBSD.org> |
rman_debug should be static, so make it static.
|
#
2e0ce59f |
|
22-Oct-2008 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Trivially avoid a null pointer dereference when drivers don't set the rman description. While drivers should set it, a kernel panic is not the right behaviour when faced without one.
|
#
d7f03759 |
|
19-Oct-2008 |
Ulf Lilleengen <lulf@FreeBSD.org> |
- Import the HEAD csup code which is the basis for the cvsmode work.
|
#
39297ba4 |
|
15-Sep-2008 |
Sam Leffler <sam@FreeBSD.org> |
Make ddb command registration dynamic so modules can extend the command set (only so long as the module is present): o add db_command_register and db_command_unregister to add and remove commands, respectively o replace linker sets with SYSINIT's (and SYSUINIT's) that register commands o expose 3 list heads: db_cmd_table, db_show_table, and db_show_all_table for registering top-level commands, show operands, and show all operands, respectively While here also: o sort command lists o add DB_ALIAS, DB_SHOW_ALIAS, and DB_SHOW_ALL_ALIAS to add aliases for existing commands o add "show all trace" as an alias for "show alltrace" o add "show all locks" as an alias for "show alllocks" Submitted by: Guillaume Ballet <gballet@gmail.com> (original version) Reviewed by: jhb MFC after: 1 month
|
#
cf22c63d |
|
25-Aug-2008 |
John Baldwin <jhb@FreeBSD.org> |
Resort a few accessor routines so that they are consistently grouped with 'set_foo/get_foo' adjacent to each other.
|
#
ebf750a9 |
|
28-Apr-2007 |
John-Mark Gurney <jmg@FreeBSD.org> |
Complete removal of restriction about overlaps to rman_manage_region: remove comment and man page verbage... Document return values for rman_init and rman_manage_region.. MFC after: 1 week
|
#
2248f680 |
|
16-Apr-2007 |
John Baldwin <jhb@FreeBSD.org> |
- Add a 'show rman <rm>' DDB command to dump the resources in a resource manager similar to 'devinfo -u'. - Add a 'show allrman' DDB command that effectively does 'show rman' on all resource managers in the system.
|
#
04f0ce21 |
|
23-Feb-2007 |
Scott Long <scottl@FreeBSD.org> |
Fix a case in rman_manage_region() where the resource list would get missorted. This would in turn confuse rman_reserve_resource(). This was only seen for MSI resources that can get allocated and deallocated after boot.
|
#
5505470e |
|
04-Dec-2006 |
John Baldwin <jhb@FreeBSD.org> |
Fix an edge case in rman_manage_region() where it didn't handle a resource ending at ULONG_MAX properly. While here, use TAILQ_FOREACH_SAFE(). Tested by: "Stephane E. Potvin" <sepotvin at videotron-ca> MFC after: 1 week
|
#
9914a8cc |
|
11-Sep-2006 |
John Baldwin <jhb@FreeBSD.org> |
- Fix rman_manage_region() to be a lot more intelligent. It now checks for overlaps, but more importantly, it collapses adjacent free regions. This is needed to cope with BIOSen that split up ports for system devices (like IPMI controllers) across multiple system resource entries. - Now that rman_manage_region() is not so dumb, remove extra logic in the x86 nexus drivers to populate the IRQ rman that manually coalesced the regions. MFC after: 1 week
|
#
2826f174 |
|
03-Aug-2006 |
John Birrell <jb@FreeBSD.org> |
Report the correct function name in a DPRINTF.
|
#
ccdc8d9b |
|
11-Jun-2006 |
Warner Losh <imp@FreeBSD.org> |
Add a convenience function rman_init_from_resource for initializing a rman from a resource. Also, include _bus.h since the implementation of bus_space isn't needed here, just the definitions of the types.
|
#
8f405ed3 |
|
28-Apr-2006 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Remove the puc-specific hacks. The puc(4) driver now properly uses the rman(9) interface.
|
#
0385d647 |
|
19-Apr-2006 |
Warner Losh <imp@FreeBSD.org> |
r_spare1 and r_spare2 aren't needed. They aren't used. They can't be accessed from outside of subr_rman.c. Remove them. Reviewed by: jmg (in theory)
|
#
dc22aef2 |
|
17-Nov-2005 |
Pyun YongHyeon <yongari@FreeBSD.org> |
Prefer NULL to 0. Add missing lock/unlock in sysctl handler. Protect accessing NULL pointer when resource allocation was failed. style(9) Reviewed by: scottl MFC after: 1 week
|
#
06945066 |
|
06-Oct-2005 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Eliminate __RMAN_RESOURCE_VISIBLE hack entirely by moving the struct resource_ to subr_rman.c where it belongs.
|
#
64fd97df |
|
28-Sep-2005 |
Poul-Henning Kamp <phk@FreeBSD.org> |
puc(4) does strange things to resources in order to fool the subdrivers to hook up. It should probably be rewritten to implement a simple bus to which the sub drivers attach using some kind of hint. Until then, provide a couple of crutch functions with big warning signs so it can survive the recent changes to struct resource.
|
#
2b35175c |
|
25-Sep-2005 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Add rman_is_region_manager() for the benefit of an alpha hack.
|
#
ae7ff71f |
|
24-Sep-2005 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Split struct resource in an external and internal part. The external part is still called 'struct resource' but the contents is now visible to drivers etc. This makes it part of the device driver ABI so it not be changed lightly. A comment to this effect is in place. The internal part is called 'struct resource_i' and contain its external counterpart as one field. Move the bus_space tag+handle into the external struct resource, this removes the need for device drivers to even know about these fields in order to use bus_space to access hardware. (More in following commit).
|
#
fd94099e |
|
05-May-2005 |
Colin Percival <cperciva@FreeBSD.org> |
If we are going to 1. Copy a NULL-terminated string into a fixed-length buffer, and 2. copyout that buffer to userland, we really ought to 0. Zero the entire buffer first. Security: FreeBSD-SA-05:08.kmem
|
#
f351862a |
|
12-Apr-2005 |
Warner Losh <imp@FreeBSD.org> |
rman_set_device() seems to have been omitted by mistake. Implement it.
|
#
eb0d6cde |
|
24-Mar-2005 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Move implementation of hw.bus.rman sysctl to subr_rman.c so that subr_bus.c doesn't need to peek inside struct resource. OK from: imp
|
#
358fef53 |
|
15-Mar-2005 |
Warner Losh <imp@FreeBSD.org> |
Sometimes, when asked to return region A..C, we'd return A+N..C+N instead of failing. When looking for a region to allocate, we used to check to see if the start address was < end. In the case where A..B is allocated already, and one wants to allocate A..C (B < C), then this test would improperly fail (which means we'd examine that region as a possible one), and we'd return the region B+1..C+(B-A+1) rather than NULL. Since C+(B-A+1) is necessarily larger than C (end argument), this is incorrect behavior for rman_reserve_resource_bound(). The fix is to exclude those regions where r->r_start + count - 1 > end rather than r->r_start > end. This bug has been in this code for a very long time. I believe that all other tests against end are correctly done. This is why sio0 generated a message about interrupts not being enabled properly for the device. When fdc had a bug that allocated from 0x3f7 to 0x3fb, sio0 was then given 0x3fc-0x404 rather than the 0x3f8-0x3ff that it wanted. Now when fdc has the same bug, sio0 fails to allocate its ports, which is the proper behavior. Since the probe failed, we never saw the messed up resources reported. I suspect that there are other places in the tree that have weird looping or other odd work arounds to try to cope with the observed weirdness this bug can introduce. These workarounds should be located and eliminated. Minor debug write fix to match the above test done as well. 'nice' by: mdodd Sponsored by: timing solutions (http://www.timing.com/)
|
#
a33ab774 |
|
15-Mar-2005 |
Warner Losh <imp@FreeBSD.org> |
Fix a debugging printf. The order of start/end was inconsistant with all the other start/end debugs, causing momentary confusion when the output was examined.
|
#
9454b2d8 |
|
06-Jan-2005 |
Warner Losh <imp@FreeBSD.org> |
/* -> /*- for copyright notices, minor format tweaks as necessary
|
#
0b54748f |
|
19-Aug-2004 |
Nate Lawson <njl@FreeBSD.org> |
Add a newline.
|
#
c003dab8 |
|
19-Aug-2004 |
Nate Lawson <njl@FreeBSD.org> |
Add debugging to rman_manage_region() as well. This is useful since we manage subregions in ACPI. MFC after: 3 days
|
#
5cc00cfc |
|
05-Aug-2004 |
John Baldwin <jhb@FreeBSD.org> |
Fix the code in rman that merges adjacent unallocated resources to use a better check for 'adjacent'. The old code assumed that if two resources were adjacent in the linked list that they were also adjacent range wise. This is not true when a resource manager has to manage disparate regions. For example, the current interrupt code on i386/amd64 will instruct irq_rman to manage two disjoint regions: 0-1 and 3-15 for the non-APIC case. If IRQs 1 and 3 were allocated and then released, the old code would coalesce across the 1 to 3 boundary because the resources were adjacent in the linked list thus adding 2 to the area of resources that irq_rman managed as a side effect. The fix adds extra checks so that adjacent unallocated resources are only merged with the resource being freed if the start and end values of the resources also match up. The patch also consolidates the checks for adjacent resources being allocated.
|
#
da35daff |
|
01-Jul-2004 |
Warner Losh <imp@FreeBSD.org> |
Add ability to set start/end for rman
|
#
0363a126 |
|
30-Jun-2004 |
Warner Losh <imp@FreeBSD.org> |
Hide struct resource and struct rman. You must define __RMAN_RESOURCE_VISIBLE to see inside these now. Reviewed by: dfr, njl (not njr)
|
#
5e1d0a23 |
|
12-Apr-2004 |
Warner Losh <imp@FreeBSD.org> |
Fix off by one error, twice. Submitted by: Carlos Velasco (first one), jhb (second one)
|
#
677b542e |
|
10-Jun-2003 |
David E. O'Brien <obrien@FreeBSD.org> |
Use __FBSDID().
|
#
67096659 |
|
31-May-2003 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Remove unused variable(s). Found by: FlexeLint
|
#
b235704d |
|
12-Feb-2003 |
Warner Losh <imp@FreeBSD.org> |
Implement rman_get_device # I though this was alredy implemented Pointy hat on my head shown by: peter
|
#
72aeb19a |
|
21-Jan-2003 |
Thomas Moestl <tmm@FreeBSD.org> |
Correct an off-by-one in the boundary check. Otherwise, resource allocations would fail if the desired allocation size was equal to the boundary.
|
#
647501a0 |
|
26-Nov-2002 |
Warner Losh <imp@FreeBSD.org> |
Make the rman_{get,set}_* macros into real functions. The macros create an ABI that encodes offsets and sizes of structures into client drivers. The functions isolate the ABI from changes to the resource structure. Since these are used very rarely (once at startup), the speed penalty will be down in the noise. Also, add r_rid to the structure so that clients can save the 'rid' of the resource in the struct resource, plus accessor functions. Future additions to newbus will make use of this to present a simplified interface for resource specification. Approved by: re (jhb) Reviewed by: jhb, jake
|
#
2894f9d0 |
|
05-Sep-2002 |
Mitsuru IWASAKI <iwasaki@FreeBSD.org> |
Add debug.rman_debug sysctl MIB and loader tunable instead of broken RMAN_DEBUG option. This would be useful for debugging resource manager code.
|
#
3aea1e14 |
|
28-Aug-2002 |
Mitsuru IWASAKI <iwasaki@FreeBSD.org> |
Add sanity check seeing if adjusted start address exceeds end address after boundary and alignment adjustment.
|
#
6008862b |
|
04-Apr-2002 |
John Baldwin <jhb@FreeBSD.org> |
Change callers of mtx_init() to pass in an appropriate lock type name. In most cases NULL is passed, but in some cases such as network driver locks (which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used. Tested on: i386, alpha, sparc64
|
#
13fb6657 |
|
21-Dec-2001 |
Thomas Moestl <tmm@FreeBSD.org> |
Add a rman_reserve_resource_bound() function that takes an additional argument specifying the boundary for the resource allocation. Use ulmin()/ulmax() instead of min()/max() in some places to correctly deal with the u_long resource range specifications.
|
#
b49c67f0 |
|
10-Nov-2001 |
Andrew R. Reiter <arr@FreeBSD.org> |
- No need for resetting values to 0 when M_ZERO flag is used. Approved: jhb
|
#
40c6d2be |
|
26-Oct-2001 |
John Baldwin <jhb@FreeBSD.org> |
Use msleep() to avoid lost wakeup's instead of doing an ineffective splhigh() before the mtx_unlock and tsleep(). The splhigh() was probably correct in the original code using simplelocks but is not correct in 5.0-current. Noticed by: Andrew Reiter <awr@FreeBSD.org>
|
#
6a40ecce |
|
10-Oct-2001 |
John Baldwin <jhb@FreeBSD.org> |
Malloc mutexes pre-zero'd as random garbage (including 0xdeadcode) my trigget the check to make sure we don't initalize a mutex twice.
|
#
04bd20e3 |
|
27-May-2001 |
Brian Somers <brian@FreeBSD.org> |
Handle NULL struct device *s
|
#
9ed346ba |
|
08-Feb-2001 |
Bosko Milekic <bmilekic@FreeBSD.org> |
Change and clean the mutex lock interface. mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order)
|
#
1b367556 |
|
23-Jan-2001 |
Jason Evans <jasone@FreeBSD.org> |
Convert all simplelocks to mutexes and remove the simplelock implementations.
|
#
7cc0979f |
|
08-Dec-2000 |
David Malone <dwmalone@FreeBSD.org> |
Convert more malloc+bzero to malloc+M_ZERO. Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
|
#
324d6bac |
|
15-Nov-2000 |
Kirk McKusick <mckusick@FreeBSD.org> |
Bug fix for revision 1.14 on the replacement of CIRCLEQ with TAILQ. Submitted by: Warner Losh <imp@village.org>
|
#
a077f635 |
|
14-Nov-2000 |
Kirk McKusick <mckusick@FreeBSD.org> |
In preparation for deprecating CIRCLEQ macros in favor of TAILQ macros which provide the same functionality and are a bit more efficient, convert use of CIRCLEQ's in resource manager to TAILQ's. Approved by: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
|
#
bbfe0254 |
|
21-Oct-2000 |
Warner Losh <imp@FreeBSD.org> |
Cleanup the rman_make_alignment_flags function to be much clearer and shorter than the prior version.
|
#
85d693f9 |
|
17-Oct-2000 |
Warner Losh <imp@FreeBSD.org> |
Implement resource alignment as discussed in arch@ a long time ago. This was implemented by Shigeru YAMAMOTO-san and Jonathan Chen. I've cleaned them up somewhat and they seem to work well enough to boot current (but given current's state it can be hard to tell). Doug Rabson also reviewed the design and signed off on it.
|
#
c0151c49 |
|
02-May-2000 |
Paul Richards <paul@FreeBSD.org> |
Replace all the ifdef debugging spaghetti with a single ifdef and a macro so that it is easier to read the flow of the code.
|
#
1b727751 |
|
16-Nov-1999 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Commit the remaining part of PR14914: Alot of the code in sys/kern directly accesses the *Q_HEAD and *Q_ENTRY structures for list operations. This patch makes all list operations in sys/kern use the queue(3) macros, rather than directly accessing the *Q_{HEAD,ENTRY} structures. Reviewed by: phk Submitted by: Jake Burkholder <jake@checker.org> PR: 14914
|
#
c3aac50f |
|
27-Aug-1999 |
Peter Wemm <peter@FreeBSD.org> |
$Id$ -> $FreeBSD$
|
#
9fd5198d |
|
26-Jun-1999 |
Doug Rabson <dfr@FreeBSD.org> |
Make sure that we record the flags in all cases. Submitted by: Bernd Walter <ticso@cicely.de> PR: kern/12399
|
#
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
|
#
2a96b3fa |
|
10-Apr-1999 |
Eivind Eklund <eivind@FreeBSD.org> |
Staticize.
|
#
ecc6e7d5 |
|
29-Mar-1999 |
Doug Rabson <dfr@FreeBSD.org> |
Fix a bug which prevented more than two clients from sharing a resource.
|
#
289bdf33 |
|
02-Jan-1999 |
Bruce Evans <bde@FreeBSD.org> |
Ifdefed conditionally used simplock variables.
|
#
f1d19042 |
|
07-Dec-1998 |
Archie Cobbs <archie@FreeBSD.org> |
The "easy" fixes for compiling the kernel -Wunused: remove unreferenced static and local variables, goto labels, and functions declared but not defined.
|
#
f6233520 |
|
23-Nov-1998 |
Bruce Evans <bde@FreeBSD.org> |
Fixed a missing include. `SYSININT(...);' garbage in gave null garbage out.
|
#
af2a5c76 |
|
28-Oct-1998 |
Garrett Wollman <wollman@FreeBSD.org> |
The new resource manager, hopefully in a reasonably stable form.
|