sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - error
sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - errorprone - task.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensource licenses. We are gradually adopting the specification, notingthat the tags are considered only advisory and do not, in any way,superceed or replace the license texts.
show more ...
Cleanup unnecessary semicolons from the kernel.Found with devel/coccinelle.
Update kernel inclusions of capability.h to use capsicum.h instead; somefurther refinement is required as some device drivers intended to beportable over FreeBSD versions rely on __FreeBSD_version
Update kernel inclusions of capability.h to use capsicum.h instead; somefurther refinement is required as some device drivers intended to beportable over FreeBSD versions rely on __FreeBSD_version to decide whetherto include capability.h.MFC after: 3 weeks
Change the cap_rights_t type from uint64_t to a structure that we can extendin the future in a backward compatible (API and ABI) way.The cap_rights_t represents capability rights. We used to use o
Change the cap_rights_t type from uint64_t to a structure that we can extendin the future in a backward compatible (API and ABI) way.The cap_rights_t represents capability rights. We used to use one bit torepresent one right, but we are running out of spare bits. Currently the newstructure provides place for 114 rights (so 50 more than the previouscap_rights_t), but it is possible to grow the structure to hold at least 285rights, although we can make it even larger if 285 rights won't be enough.The structure definition looks like this: struct cap_rights { uint64_t cr_rights[CAP_RIGHTS_VERSION + 2]; };The initial CAP_RIGHTS_VERSION is 0.The top two bits in the first element of the cr_rights[] array contain totalnumber of elements in the array - 2. This means if those two bits are equal to0, we have 2 array elements.The top two bits in all remaining array elements should be 0.The next five bits in all array elements contain array index. Only one bit isused and bit position in this five-bits range defines array index. This meansthere can be at most five array elements in the future.To define new right the CAPRIGHT() macro must be used. The macro takes twoarguments - an array index and a bit to set, eg. #define CAP_PDKILL CAPRIGHT(1, 0x0000000000000800ULL)We still support aliases that combine few rights, but the rights have to belongto the same array element, eg: #define CAP_LOOKUP CAPRIGHT(0, 0x0000000000000400ULL) #define CAP_FCHMOD CAPRIGHT(0, 0x0000000000002000ULL) #define CAP_FCHMODAT (CAP_FCHMOD | CAP_LOOKUP)There is new API to manage the new cap_rights_t structure: cap_rights_t *cap_rights_init(cap_rights_t *rights, ...); void cap_rights_set(cap_rights_t *rights, ...); void cap_rights_clear(cap_rights_t *rights, ...); bool cap_rights_is_set(const cap_rights_t *rights, ...); bool cap_rights_is_valid(const cap_rights_t *rights); void cap_rights_merge(cap_rights_t *dst, const cap_rights_t *src); void cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src); bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little);Capability rights to the cap_rights_init(), cap_rights_set(),cap_rights_clear() and cap_rights_is_set() functions are provided byseparating them with commas, eg: cap_rights_t rights; cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FSTAT);There is no need to terminate the list of rights, as those functions areactually macros that take care of the termination, eg: #define cap_rights_set(rights, ...) \ __cap_rights_set((rights), __VA_ARGS__, 0ULL) void __cap_rights_set(cap_rights_t *rights, ...);Thanks to using one bit as an array index we can assert in those functions thatthere are no two rights belonging to different array elements providedtogether. For example this is illegal and will be detected, because CAP_LOOKUPbelongs to element 0 and CAP_PDKILL to element 1: cap_rights_init(&rights, CAP_LOOKUP | CAP_PDKILL);Providing several rights that belongs to the same array's element this way iscorrect, but is not advised. It should only be used for aliases definition.This commit also breaks compatibility with some existing Capsicum system calls,but I see no other way to do that. This should be fine as Capsicum is stillexperimental and this change is not going to 9.x.Sponsored by: The FreeBSD Foundation
Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCIcommand register. The lazy BAR allocation code in FreeBSD sometimesdisables this bit when it detects a range conflict, and w
Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCIcommand register. The lazy BAR allocation code in FreeBSD sometimesdisables this bit when it detects a range conflict, and will re-enableit on demand when a driver allocates the BAR. Thus, the bit is no longera reliable indication of capability, and should not be checked. Thisresults in the elimination of a lot of code from drivers, and also givesthe opportunity to simplify a lot of drivers to use a helper API to setthe busmaster enable bit.This changes fixes some recent reports of disk controllers and theirassociated drives/enclosures disappearing during boot.Submitted by: jhbReviewed by: jfv, marius, achadd, achimMFC after: 1 day
Revert previous commit...Pointyhat to: kevlo (myself)
Prefer NULL over 0 for pointers
Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.This means that their use is restricted to a single C file.
Second-to-last commit implementing Capsicum capabilities in the FreeBSDkernel for FreeBSD 9.0:Add a new capability mask argument to fget(9) and friends, allowing systemcall code to declare what c
Second-to-last commit implementing Capsicum capabilities in the FreeBSDkernel for FreeBSD 9.0:Add a new capability mask argument to fget(9) and friends, allowing systemcall code to declare what capabilities are required when an integer filedescriptor is converted into an in-kernel struct file *. With optionsCAPABILITIES compiled into the kernel, this enforces capabilityprotection; without, this change is effectively a no-op.Some cases require special handling, such as mmap(2), which must preserveinformation about the maximum rights at the time of mapping in the memorymap so that they can later be enforced in mprotect(2) -- this is done bynarrowing the rights in the existing max_protection field used for similarpurposes with file permissions.In namei(9), we assert that the code is not reached from within capabilitymode, as we're not yet ready to enforce namespace capabilities there.This will follow in a later commit.Update two capability names: CAP_EVENT and CAP_KEVENT becomeCAP_POST_KEVENT and CAP_POLL_KEVENT to more accurately indicate what theyrepresent.Approved by: re (bz)Submitted by: jonathanSponsored by: Google Inc
Remove duplicate header includes
Remove references to MAKEDEV(8)
Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.This replaces d_mmap() with the d_mmap2() implementation and alsochanges the type of offset to vm_ooffset_t.Purge d_mmap2().All driver m
Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.This replaces d_mmap() with the d_mmap2() implementation and alsochanges the type of offset to vm_ooffset_t.Purge d_mmap2().All driver modules will need to be rebuilt since D_VERSION is alsobumped.Reviewed by: jhb@MFC after: Not in this lifetime...
Let tdfx(4) use si_drv1 instead of using dev2unit().
Replace all calls to minor() with dev2unit().After I removed all the unit2minor()/minor2unit() calls from the kernelyesterday, I realised calling minor() everywhere is quite confusing.Character d
Replace all calls to minor() with dev2unit().After I removed all the unit2minor()/minor2unit() calls from the kernelyesterday, I realised calling minor() everywhere is quite confusing.Character devices now only have the ability to store a unit number, nota minor number. Remove the confusion by using dev2unit() everywhere.This commit could also be considered as a bug fix. A lot of drivers callminor(), while they should actually be calling dev2unit(). In -CURRENTthis isn't a problem, but it turns out we never had any problem reportsrelated to that issue in the past. I suspect not many people connectmore than 256 pieces of the same hardware.Reviewed by: kib
Add the module dependency on the mem(4) module. This will fix the modulefailing to load on a kernel that has "nodevice mem" in the config. It willnow properly bring in the mem(4) module.Submitted
Add the module dependency on the mem(4) module. This will fix the modulefailing to load on a kernel that has "nodevice mem" in the config. It willnow properly bring in the mem(4) module.Submitted by: antoineReviewed by: impMFC after: 1 week
Take the functionality contained in the former "options TDFX_LINUX"into a separate module. Accordingly, convert the option into a devicenamed similarly.Note for MFC: Perhaps the option should st
Take the functionality contained in the former "options TDFX_LINUX"into a separate module. Accordingly, convert the option into a devicenamed similarly.Note for MFC: Perhaps the option should stay in RELENG_6 for POLA reasons.Suggested by: scottlReviewed by: cokaneMFC after: 5 days
Normalize a significant number of kernel malloc type names:- Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat.- Remove punctuation that i
Normalize a significant number of kernel malloc type names:- Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat.- Remove punctuation that is incompatible with using memory type names as file names, such as '/' characters.- Disambiguate some collisions by adding subsystem prefixes to some memory types.- Generally prefer lower case to upper case.- If the same type is defined in multiple architecture directories, attempt to use the same name in additional cases.Not all instances were caught in this change, so more work is required tofinish this conversion. Similar changes are required for UMA zone names.
Use BUS_PROBE_DEFAULT in preference to 0. Also for vx, returnBUS_PROBE_LOW_PRIORITY in stead of ifdef for devices that xl and vxboth support so that xl will snarf them on up.
remove dead code (inside a DEBUG ifdef)Submitted by: Coverity Prevent analysis tool
Start each of the license/copyright comments with /*-, minor shuffle of lines
Do the dreaded s/dev_t/struct cdev */Bump __FreeBSD_version accordingly.
Add missing <sys/module.h> includes
Convert callers to the new bus_alloc_resource_any(9) API.Submitted by: Mark Santcroos <[email protected]>Reviewed by: imp, dfr, bde
Device megapatch 4/6:Introduce d_version field in struct cdevsw, this must always beinitialized to D_VERSION.Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removingfour D_NOGIANT fl
Device megapatch 4/6:Introduce d_version field in struct cdevsw, this must always beinitialized to D_VERSION.Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removingfour D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
Device megapatch 1/6:Free approx 86 major numbers with a mostly automatically generated patch.A number of strategic drivers have been left behind by caution, and a fewbecause they still (ab)use
Device megapatch 1/6:Free approx 86 major numbers with a mostly automatically generated patch.A number of strategic drivers have been left behind by caution, and a fewbecause they still (ab)use their major number.
123