History log of /src/sys/dev/spkr.c |
Revision | | Date | Author | Comments |
1.25 |
| 31-Mar-2023 |
riastradh | spkr(4): Avoid some overflow issues.
XXX pullup-8 XXX pullup-9 XXX pullup-10
Reported-by: syzbot+1a9980f3631bbd710ded@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=ea851fc4688cbac29a567cb49a4fd24d9afff426
Reported-by: syzbot+b4655f9c1734f886d610@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=b61236df29f595e38b12ee533b7b3275c8ec1865
|
1.24 |
| 24-Sep-2022 |
thorpej | branches: 1.24.4; malloc(9) -> kmem(9)
|
1.23 |
| 31-Mar-2022 |
pgoyette | For device modules that provide both auto-config and /dev/xxx interfaces, make sure that initialization and destruction follow the proper sequence. This is triggered by the recent changes to the devsw stuff; per riastradh@ the required call sequence is:
devsw_attach() config_init_component() or config_cf*_attach() ... config_fini_component() or config_cf*_detach() devsw_detach()
While here, add a few missing calls to some of the detach routines.
Testing of these changes has been limited to: 1. compile without build break 2. no related test failures from atf 3. modload/modunload work as well as before.
No functional device testing done, since I don't have any of these devices. Let me know of any damage I might cause here!
XXX Some of the modules affected by this commit are already XXX broken; see kern/56772. This commit does not break any additional modules (as far as I know).
|
1.22 |
| 12-Feb-2022 |
riastradh | sys: Fix various abuse of struct device internals.
Will help to make struct device opaque later.
|
1.21 |
| 07-Aug-2021 |
thorpej | Merge thorpej-cfargs2.
|
1.20 |
| 24-Apr-2021 |
thorpej | branches: 1.20.8; Merge thorpej-cfargs branch:
Simplify and make extensible the config_search() / config_found() / config_attach() interfaces: rather than having different variants for which arguments you want pass along, just have a single call that takes a variadic list of tag-value arguments.
Adjust all call sites: - Simplify wherever possible; don't pass along arguments that aren't actually needed. - Don't be explicit about what interface attribute is attaching if the device only has one. (More simplification.) - Add a config_probe() function to be used in indirect configuiration situations, making is visibly easier to see when indirect config is in play, and allowing for future change in semantics. (As of now, this is just a wrapper around config_match(), but that is an implementation detail.)
Remove unnecessary or redundant interface attributes where they're not needed.
There are currently 5 "cfargs" defined: - CFARG_SUBMATCH (submatch function for direct config) - CFARG_SEARCH (search function for indirect config) - CFARG_IATTR (interface attribte) - CFARG_LOCATORS (locators array) - CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)
...and a sentinel value CFARG_EOL.
Add some extra sanity checking to ensure that interface attributes aren't ambiguous.
Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark ports to associate those device handles with device_t instance. This will trickle trough to more places over time (need back-end for pre-OFW Sun OBP; any others?).
|
1.19 |
| 03-Apr-2021 |
isaki | Rework about the rest note in speaker(4). - Obsolete the sc_rest callback. The rest note operation can be done by the common spkr layer. This also fixes PR kern/56060. This work-in-progress patch was left in my local tree for years. :( - Improve calculations of tone and rest length.
|
1.18 |
| 03-Apr-2021 |
isaki | Improve SPKRDEBUG code. - Replace wrong aprint_debug_dev() with device_printf(). By this, it no longer need to print dev_t. - Improve some messages.
|
1.17 |
| 18-Apr-2019 |
isaki | branches: 1.17.4; 1.17.12; 1.17.14; White space and indent fix.
|
1.16 |
| 03-Sep-2018 |
riastradh | Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int. The generic name min/max should not silently truncate to 32 bits on 64-bit systems. This is purely a name change -- no functional change intended.
HOWEVER! Some subsystems have
#define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b))
even though our standard name for that is MIN/MAX. Although these may invite multiple evaluation bugs, these do _not_ cause integer truncation.
To avoid `fixing' these cases, I first changed the name in libkern, and then compile-tested every file where min/max occurred in order to confirm that it failed -- and thus confirm that nothing shadowed min/max -- before changing it.
I have left a handful of bootloaders that are too annoying to compile-test, and some dead code:
cobalt ews4800mips hp300 hppa ia64 luna68k vax acorn32/if_ie.c (not included in any kernels) macppc/if_gm.c (superseded by gem(4))
It should be easy to fix the fallout once identified -- this way of doing things fails safe, and the goal here, after all, is to _avoid_ silent integer truncations, not introduce them.
Maybe one day we can reintroduce min/max as type-generic things that never silently truncate. But we should avoid doing that for a while, so that existing code has a chance to be detected by the compiler for conversion to uimin/uimax without changing the semantics until we can properly audit it all. (Who knows, maybe in some cases integer truncation is actually intended!)
|
1.15 |
| 28-Oct-2017 |
riastradh | branches: 1.15.2; 1.15.4; 1.15.6; Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".
|
1.14 |
| 01-Jul-2017 |
nat | On a forcefull detach wait for spkr to close as the detach has to succeed.
Ok christos@.
|
1.13 |
| 14-Jun-2017 |
nat | Ensure to detach children.
|
1.12 |
| 11-Jun-2017 |
pgoyette | Implement xxx_rescan() and xxx_childdet() functions; these will be needed when child device wsbell(4) becomes a separately-loadable module.
|
1.11 |
| 11-Jun-2017 |
pgoyette | Clean up the spkr_modcmd() routine so it returns ENOTTY for all commands other than MODULE_CMD_{INIT,FINI}
|
1.10 |
| 11-Jun-2017 |
pgoyette | The wsmux.h file is only created for kernel builds.
|
1.9 |
| 11-Jun-2017 |
nat | New device wsbell - allows for a console beep for non pckbds (usb etc). Works for platforms without pcppi - can work with spkr at audio and spkr at pcppi.
To use add the following to your kernel config: wsbell* at spkr? console?
Ok pgoyette@.
|
1.8 |
| 11-Jun-2017 |
nat | Add ioctls for setting and getting the beep volume. Currently only supported on spkr devices attached to audio.
Ok pgoyette@.
|
1.7 |
| 01-Jun-2017 |
pgoyette | branches: 1.7.2; Add infrastructure for modularization of audio, midi, and sequencer
|
1.6 |
| 06-Jan-2017 |
pgoyette | branches: 1.6.2; 1.6.6; 1.6.10; Implement a common spkr_detach() function and call it from the attachment-specific detach functions. Returns EBUSY if the device instance is busy, based on whether or not a sc->sc_inbuf is allocated. The buffer is malloc()d at spkropen time, and is free()d in spkrclose().
Now we can actually implement the MODULE_CMD_FINI command and unload the driver at will.
Addresses my PR kern/51785
|
1.5 |
| 15-Dec-2016 |
pgoyette | Add the module glue to the common spkr code.
|
1.4 |
| 13-Dec-2016 |
christos | Restructure speaker devices so that there can be multiple of them, and have proper softc's.
|
1.3 |
| 09-Dec-2016 |
christos | fix module build XXX: spkr module is the pcppi version.
|
1.2 |
| 09-Dec-2016 |
christos | move spkrio.h out of isa
|
1.1 |
| 09-Dec-2016 |
christos | more spkr rework.
|
1.6.10.2 |
| 29-Apr-2017 |
pgoyette | Remove more unnecessary #include for sys/localcount.h
|
1.6.10.1 |
| 29-Apr-2017 |
pgoyette | Add DEVSW_MODULE_INIT to existing device-driver modules, so that they willl have a localcount defined and thus be permitted to load. Without a localcount, loading the module will return EINVAL.
XXX the dtrace and drm stuff might need to be fed back upstream?
|
1.6.6.3 |
| 28-Aug-2017 |
skrll | Sync with HEAD
|
1.6.6.2 |
| 05-Feb-2017 |
skrll | Sync with HEAD
|
1.6.6.1 |
| 06-Jan-2017 |
skrll | file spkr.c was added on branch nick-nhusb on 2017-02-05 13:40:26 +0000
|
1.6.2.2 |
| 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.6.2.1 |
| 06-Jan-2017 |
pgoyette | file spkr.c was added on branch pgoyette-localcount on 2017-01-07 08:56:31 +0000
|
1.7.2.2 |
| 03-Aug-2023 |
martin | Apply addition patch to fix the build, requested by riastradh in ticket #1868:
sys/dev/spkr.c (apply patch)
Pacify -Wsign-compare.
|
1.7.2.1 |
| 01-Aug-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #1868):
sys/dev/spkr.c: revision 1.25 (patch)
spkr(4): Avoid some overflow issues.
|
1.15.6.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.15.4.1 |
| 06-Sep-2018 |
pgoyette | Sync with HEAD
Resolve a couple of conflicts (result of the uimin/uimax changes)
|
1.15.2.2 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.15.2.1 |
| 28-Oct-2017 |
jdolecek | file spkr.c was added on branch tls-maxphys on 2017-12-03 11:36:58 +0000
|
1.17.14.3 |
| 03-Apr-2021 |
thorpej | Sync with HEAD.
|
1.17.14.2 |
| 28-Mar-2021 |
thorpej | "" is not a valid interface attribute, so don't pass it to spkr_rescan() (luckily it wasn't used anyway).
|
1.17.14.1 |
| 21-Mar-2021 |
thorpej | Give config_found() the same variadic arguments treatment as config_search(). This commit only adds the CFARG_EOL sentinel to the existing config_found() calls. Conversion of config_found_sm_loc() and config_found_ia() call sites will be in subsequent commits.
|
1.17.12.1 |
| 03-Apr-2021 |
thorpej | Sync with HEAD.
|
1.17.4.1 |
| 01-Aug-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #1686):
sys/dev/spkr.c: revision 1.25 (patch)
spkr(4): Avoid some overflow issues.
|
1.20.8.1 |
| 04-Aug-2021 |
thorpej | Adapt to CFARGS().
|
1.24.4.1 |
| 31-Jul-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #279):
sys/dev/spkr.c: revision 1.25
spkr(4): Avoid some overflow issues.
|