Home | History | Annotate | Download | only in gpio
History log of /src/sys/dev/gpio/gpiosim.c
RevisionDateAuthorComments
 1.26  24-Nov-2023  brad Style changes. No functional change.
 1.25  08-Nov-2023  brad Simple simulated interrupts for the simulated GPIO device gpiosim(4)
 1.24  10-May-2023  riastradh gpiosim(4): Use config_detach_children.
 1.23  07-Aug-2021  thorpej branches: 1.23.6;
Merge thorpej-cfargs2.
 1.22  24-Apr-2021  thorpej branches: 1.22.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.21  28-Oct-2017  riastradh branches: 1.21.20;
Kill some more extern struct cfdriver declarations.

Down with externs in .c!
 1.20  20-Jan-2017  maya branches: 1.20.4;
Check pmf_device_register return value. NFC
Appeases static analyzers.
 1.19  14-Jul-2016  msaitoh branches: 1.19.2; 1.19.4;
- Use aprint*() instead of printf() in xxx_attach().
- Add missing aprint_naive("\n");
- KNF
 1.18  20-Aug-2015  christos include "ioconf.h" to get the 'void <driver>attach(int count);' prototype.
 1.17  20-Aug-2015  uebayasi Use needs-count for # of pseudo instances; suggested by cube@.
 1.16  25-Feb-2014  pooka branches: 1.16.6;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.15  20-May-2013  mbalmer branches: 1.15.2;
Make the gpiosim(4) device a 64 bit wide GPIO.
 1.14  02-Jun-2012  dsl branches: 1.14.2;
Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.13  30-Aug-2011  mbalmer branches: 1.13.2;
Unconditionally include <sys/modules.h>.
 1.12  29-Aug-2011  mbalmer Register as built-in module when compiled wo/ _MODULE.
 1.11  28-Aug-2011  jmcneill build with WARNS=3
 1.10  26-Aug-2011  mbalmer u_int32_t -> uin32_t.
 1.9  14-Aug-2011  mbalmer fix indents
 1.8  12-Aug-2011  mbalmer gpio(4) and gpiosim(4) can now be built and used as modules. While here,
make some functions static.
 1.7  06-Dec-2009  dyoung Delete unnecessary device-activation hooks. Simplify the rest.
 1.6  07-Aug-2009  mbalmer branches: 1.6.2;
Properly teardown the sysctl node and detach child driver if gpiosim gets
detached itself (e.g. when the 'drvctl -d gpiosimX' command is entered).
 1.5  06-Aug-2009  mbalmer For the sake of correctness, call pmf_device_deregister() in the detach
function.
 1.4  28-Jul-2009  drochner add dummy pmf registration to allow suspend
 1.3  27-Jul-2009  mbalmer Do not attach gpiosim(4) at root, but make it a pseudo device.
With help from Matthias Drochner, thanks!
 1.2  26-Jul-2009  mbalmer Simplify the use _a lot_ by hooking this to sysctl instead of bio(4).
When it attaches, it creates a hw.gpiosimN.value sysctl node which can
then be used to manipulate the simulated device state.
 1.1  25-Jul-2009  mbalmer Rework the GPIO framework. Tie it to the kauth(9) framework to control
access to the GPIO pins. Device drivers using GPIO pins can now be
attached and detached at runtime. GPIO pins can be named for easier
reference from userland programs. Introduce a new gpiosim(4) driver,
which is used for development.

Reviewed by many.
 1.6.2.3  11-Mar-2010  yamt sync with head
 1.6.2.2  19-Aug-2009  yamt sync with head.
 1.6.2.1  07-Aug-2009  yamt file gpiosim.c was added on branch yamt-nfs-mp on 2009-08-19 18:47:05 +0000
 1.13.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.2.1  30-Oct-2012  yamt sync with head
 1.14.2.3  03-Dec-2017  jdolecek update from HEAD
 1.14.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.2.1  23-Jun-2013  tls resync from head
 1.15.2.1  18-May-2014  rmind sync with head
 1.16.6.3  05-Feb-2017  skrll Sync with HEAD
 1.16.6.2  05-Oct-2016  skrll Sync with HEAD
 1.16.6.1  22-Sep-2015  skrll Sync with HEAD
 1.19.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.19.2.1  20-Mar-2017  pgoyette Sync with HEAD
 1.20.4.1  17-May-2017  pgoyette At suggestion of chuq@, modify config_attach_pseudo() to return with a
reference held on the device.

Adapt callers to expect the reference to exist, and to ensure that the
reference is released.
 1.21.20.1  23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.22.8.1  04-Aug-2021  thorpej Adapt to CFARGS().
 1.23.6.1  26-Nov-2023  bouyer Pull up following revision(s) (requested by brad in ticket #463):
share/man/man4/gpiosim.4: revision 1.7
sys/dev/gpio/gpiosim.c: revision 1.25
Simple simulated interrupts for the simulated GPIO device gpiosim(4)

RSS XML Feed