Commit Graph

182 Commits

Author SHA1 Message Date
Warner Losh
031beb4e23 sys: Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:58 -06:00
Warner Losh
685dc743dc sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:36 -06:00
Warner Losh
71625ec9ad sys: Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:24 -06:00
Warner Losh
2ff63af9b8 sys: Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:18 -06:00
Warner Losh
95ee2897e9 sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:11 -06:00
Warner Losh
b61a573019 spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD
The SPDX folks have obsoleted the BSD-2-Clause-NetBSD 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
2023-05-12 10:44:04 -06:00
Warner Losh
4d846d260e 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
2023-05-12 10:44:03 -06:00
Ed Schouten
af3c78886f Alter the prototype of qsort_r(3) to match POSIX, which adopted the
glibc-based interface.

Unfortunately, the glibc maintainers, despite knowing the existence
of the FreeBSD qsort_r(3) interface in 2004 and refused to add the
same interface to glibc based on grounds of the lack of standardization
and portability concerns, has decided it was a good idea to introduce
their own qsort_r(3) interface in 2007 as a GNU extension with a
slightly different and incompatible interface.

With the adoption of their interface as POSIX standard, let's switch
to the same prototype, there is no need to remain incompatible.

C++ and C applications written for the historical FreeBSD interface
get source level compatibility when building in C++ mode, or when
building with a C compiler with C11 generics support, provided that
the caller passes a fifth parameter of qsort_r() that exactly matches
the historical FreeBSD comparator function pointer type and does not
redefine the historical qsort_r(3) prototype in their source code.

Symbol versioning is used to keep old binaries working.

MFC:			never
Relnotes:		yes
Reviewed by:		cem, imp, hps, pauamma
Differential revision:	https://reviews.freebsd.org/D17083
2022-09-30 15:26:30 -07:00
Gordon Bergling
88cdf609e4 bhnd(4): Correct some typos in source code comments
- s/occured/occurred/

While here, fix some whitespace issues.

MFC after:	3 days
2022-09-04 12:49:42 +02:00
Gordon Bergling
ce99e4fa44 bhnd(4): Correct a typo in a source code comment
- s/in he/in the/

MFC after:	3 days
2022-08-27 12:10:00 +02:00
John Baldwin
162c26ad77 bhnd: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 12:22:00 -07:00
John Baldwin
05bdf34a9d Remove unused bhndb_devclass. 2022-05-09 12:22:00 -07:00
John Baldwin
817be43174 Remove unused cfi_devclass. 2022-05-09 12:22:00 -07:00
John Baldwin
58d8316109 bhnd: Use devclass_find to lookup devclass for bhnd.
Differential Revision:	https://reviews.freebsd.org/D35058
2022-05-05 16:34:02 -07:00
John Baldwin
acb7423df7 bhnd: Use __diagused for a variable only used in a KASSERT(). 2022-04-13 16:08:20 -07:00
Gordon Bergling
75e1650d7f bhnd(4): Remove a double word in a source code comment
- s/an an/an/

MFC after:	3 days
2022-04-09 14:31:19 +02:00
Gordon Bergling
060f5c02e9 bhnd(4): Remove some double words in source code comments
- s/be be/be/
- s/is is/is/

MFC after:	3 days
2022-04-09 09:26:50 +02:00
John Baldwin
3cebca152b bnhd: Write out updated resource dependencies from the table.
The driver parsed the table to update the relevant resource map
registers, but failed to write the new register value after computing
it.

Reported by:	-Wunused-but-set-variable
Reviewed by:	landonf, imp
Differential Revision:	https://reviews.freebsd.org/D34814
2022-04-07 10:46:19 -07:00
Warner Losh
87a4328651 bhnd_nvram_store_export_child: eliminate num_props write only variable
Sponsored by:		Netflix
2022-04-04 22:29:21 -06:00
Warner Losh
5466363900 bhnd_pmu_sdiod_drive_strength_init: eliminate write only intr_val variable
Sponsored by:		Netflix
2022-04-04 22:29:20 -06:00
Warner Losh
9af048a0b1 bhnd_pwrctl_attach: eliminate write only bus variable
Sponsored by:		Netflix
2022-04-04 22:29:18 -06:00
Mark Johnston
1db163b825 bhnd: Fix some -Wunused-but-set-variable warnings
MFC after:	1 week
2022-02-28 10:54:25 -05:00
Mateusz Guzik
06c95f1fac bhnd: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-14 14:59:09 +00:00
Warner Losh
d14bc7230b 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
2021-12-09 17:04:57 -07:00
Warner Losh
c6df6f5322 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
2021-12-09 17:04:45 -07:00
Ed Maste
9feff969a0 Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights
These ones were unambiguous cases where the Foundation was the only
listed copyright holder (in the associated license block).

Sponsored by:	The FreeBSD Foundation
2021-08-08 10:42:24 -04:00
Warner Losh
ddfc9c4c59 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
2021-06-22 20:52:06 -06:00
Michael Zhilin
d513292e74 [bhnd] remove unused sc variable
Cosmetic patch to remove unused sc variable.

Tested on mips32

Reviewed by: bz, imp, landonf
Sponsored by: Postgres Professional
Differential revision: https://reviews.freebsd.org/D18948
2021-05-28 23:26:14 +03:00
Mateusz Guzik
ab3fad6ea2 bhnd: clean up empty lines in .c and .h files 2020-09-01 21:43:05 +00:00
Pawel Biernacki
7029da5c36 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
2020-02-26 14:26:36 +00:00
Mark Johnston
918988576c Avoid relying on header pollution from sys/refcount.h.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2019-07-29 20:26:01 +00:00
Oleksandr Tymoshenko
f913a5749f Fix format/arg mismatch
USe correct format for int arguments

PR:		229549
Submitted by:	David Binderman <dcb314@hotmail.com>
MFC after:	1 week
2019-01-25 21:38:28 +00:00
Matt Macy
4f4eb606dd bhnd nvram map: don't write "variable records written" to standard out by default
Add -v (verbose) option for the developers. The rest of us
derive no value from this information.
2018-05-19 18:15:41 +00:00
Landon J. Fuller
be9a13138e bhnd(4): Use the new BHND_CAP_BP64 capability flag to exclude DMA
translations unsupported by the backplane.
2018-03-29 19:48:50 +00:00
Landon J. Fuller
f3524ec8ed bhnd(4): include a subset of the ChipCommon capability flags in bhnd_chipid;
this provides early access to device capability flags required by bhnd(4)
bus and bhndb(4) bridge drivers.
2018-03-29 19:44:15 +00:00
Landon J. Fuller
397b9e40e9 Add missing NULL checks when calling malloc(M_NOWAIT) in
bhnd_nv_strdup/bhnd_nv_strndup.

If malloc(9) failed during initial bhnd(4) attach, while allocating the root
NVRAM path string ("/"), the returned NULL pointer would be passed as the
destination to memcpy().

Reported by:	Ilja Van Sprundel <ivansprundel@ioactive.com>
2018-03-22 22:13:46 +00:00
Landon J. Fuller
7c7c726bca siba(4): Ignore disabled per-core address match entries.
Previously, the address regions described by disabled admatch entries would
be treated as being mapped to the given core; while incorrect, this was
essentially harmless given that the entries describe unused address space
on the few affected devices.

We now perform parsing of per-core admatch registers and interrupt flags in
siba_erom, correctly skip any disabled admatch entries, and use the
siba_erom API in siba_add_children() to perform enumeration of attached
cores.
2018-02-12 19:36:26 +00:00
Landon J. Fuller
d177c19903 bwn(4): migrate bwn(4) to the native bhnd(9) interface, and drop siba_bwn.
- Remove the shim interface that allowed bwn(4) to use either siba_bwn or
  bhnd(4), replacing all siba_bwn calls with their bhnd(4) bus equivalents.
- Drop the legay, now-unused siba_bwn bus driver.
- Clean up bhnd(4) board flag defines referenced by bwn(4).

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13518
2018-02-05 23:38:15 +00:00
Landon J. Fuller
f248a99a0e bhnd_chipc(4): Fix leak of child device ivars by explicitly deleting
any children prior to detach.

With the newbus child deletion ordering changes introduced in r307518,
parent devices are now detached (and their driver set to NULL) prior to
detaching and deleting child devices; child-related bus methods (e.g.
BUS_CHILD_DETACHED, BUS_CHILD_DELETED) are no longer be dispatched to the
parent device driver after it returns 0 (success) from DEVICE_DETACH.

Sponsored by:   The FreeBSD Foundation
2018-01-20 01:55:34 +00:00
Landon J. Fuller
a225321fbc bhnd/bwn(4): Define a bhnd(4) softmodem device class for the v.90 modem
codec core, and mark the core as unpopulated on all BCM4306 bwn(4) devices.

Sponsored by:	The FreeBSD Foundation
2018-01-19 22:43:08 +00:00
Landon J. Fuller
711221efd8 bhndb_pci(4): Implement bridge support for CardBus-attached devices.
- Extend the probe method to accept devclasses that inherit from the pci
   devclass (e.g. cardbus).
 - Some BCM4306-based CardBus adapters appear to advertise 4K SPROM, but
   only the first 2K is mapped into BAR0. We can safely assume that the
   SPROM data fits within the first 2K of the SPROM, rather than rejecting
   the SPROM mapping as invalid.

Sponsored by:	The FreeBSD Foundation
2018-01-19 22:22:02 +00:00
Landon J. Fuller
1c8edc1ed8 bhnd(4): fix a few bugs in pwrctl/fixed-clock device support.
- Do not panic on siba(4) detach when the bhnd(4) bus calls
   bhnd_get_pmu_info() on a PMU-less device.
 - Fix bhnd_pwrctl attach/detach on fixed-clock devices:
    - Treat bhnd_pwrctl_updateclk() as a no-op on fixed-clock devices.
    - Use bhnd_pwrctl_updateclk() to perform the appropriate clock
      transition on detach.

Sponsored by:	The FreeBSD Foundation
2018-01-19 21:58:48 +00:00
Landon J. Fuller
5ad00fa2cf bhnd_chipc(4): Fix the assignment of non-wildcard child unit numbers
introduced in r326102 and r326109; all chipc children should be added with
a wildcard unit (-1).

Sponsored by:	The FreeBSD Foundation
2018-01-19 21:36:28 +00:00
Landon J. Fuller
84d6a5d4a7 bhndb_pci(4): fix incorrect BHND_PCI_SRSH_PI workaround
On a SPROM-less device, the PCI(e) bridge core will be initialized with its
power-on-reset defaults; this can leave the SPROM-derived BHND_PCI_SRSH_PI
value pointing to the wrong backplane address. This value is used by the
PCI core when performing address translation between the static register
windows in BAR0 that map the PCI core's register block, and backplane
address space.

Previously, bhndb_pci(4) incorrectly used the potentially invalid static
BAR0 PCI register windows when attempting to correct the BHND_PCI_SRSH_PI
value in the PCI core's SPROM shadow.

Instead, we now read/update BHND_PCI_SRSH_PI by fetching the PCI core's
backplane address from the core enumeration table, and then using a dynamic
register window to explicitly map the PCI core's register block into BAR0.

Sponsored by:	The FreeBSD Foundation
2018-01-17 03:34:26 +00:00
Pedro F. Giffuni
92e1020a52 dev/bhnd: Make use of mallocarray(9).
This makes a calloc-like definition check for overflows as is common
practice.
2018-01-11 15:44:03 +00:00
Landon J. Fuller
07a0a243ec bhnd(4): Add missing BCM4312 backplane clock speed entry.
The default 80MHz clock speed returned by bhnd_pmu_si_clock() was already
correct; this just prevents the "No backplane clock specified" warning
printf from being emitted when querying backplane clock speed.

Sponsored by:	The FreeBSD Foundation
2018-01-04 19:47:01 +00:00
Eitan Adler
caa7e52f3f kernel: Fix several typos and minor errors
- duplicate words
- typos
- references to old versions of FreeBSD

Reviewed by:	imp, benno
2017-12-27 03:23:21 +00:00
Landon J. Fuller
6585f74d30 bhnd(4): Fix the pa0itssit/pa1itssit NVRAM variable type definitions
required by bwn(4); idle TSSI target values are expressed as signed
integers.

Sponsored by:	The FreeBSD Foundation
2017-12-16 05:22:16 +00:00
Landon J. Fuller
80a7c0f53b bhndb(4): Enable addrext support on DMA64 devices, and fix an incorrect DMA
DMA boundary constraint applied in bhndb_dma_tag_create().

Sponsored by:	The FreeBSD Foundation
2017-12-16 04:35:37 +00:00
Landon J. Fuller
6467a17b49 bhnd(4)/bwn(4): Fix a number of small issues reported by Coverity.
- Fix reference of uninitialized error value in bhndb_generic_resume() if
  the dynamic window count is 0.

- Fix incorrect bhnd_pmu(4) UPTME_MASK and PLL0_PC2_WILD_INT_MASK
  constants.

- Variable definitions referenced by our generated SPROM layouts will never
  be NULL, but add explicit asserts to make that clear.

- Add missing variable initialization in bhnd_nvram_sprom_ident().

- Fix leak of driver array in bhnd_erom_probe_driver_classes().

- Fix zero-length memset() in bhndb_pci_eio_init().

- Fix an off-by-one error and potential invalid OOBSEL bit shift operation
  in bcma_dinfo_init_intrs().

- Remove dead code in siba_suspend_hw().

- Fix duplicate call to bhnd_pmu_enable_regulator() in both the enable and
  disable code paths of bhnd_compat_cc_pmu_set_ldoparef().

Reported by:	Coverity
CIDs:		1355194, 1362020, 1362022, 1373114, 1366563, 1373115,
		1381569, 1381579, 1383555, 1383566, 1383571
Sponsored by:	The FreeBSD Foundation
2017-12-15 04:51:47 +00:00