Home | History | Annotate | Download | only in sbus
History log of /src/sys/dev/sbus/magma.c
RevisionDateAuthorComments
 1.64  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.63  24-Apr-2021  thorpej branches: 1.63.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.62  12-Apr-2021  mrg handle cd1400_compute_baud() failure and avoid reading uninitialised
variables.
 1.61  10-Nov-2019  chs branches: 1.61.10;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.60  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.59  25-Jul-2014  dholland branches: 1.59.26; 1.59.28;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.58  16-Mar-2014  dholland branches: 1.58.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.57  19-Oct-2013  mrg - remove set but unused variable.
- put variables only inside #ifdef inside that same #ifdef.
use __USE() where appropriate.
 1.56  27-Oct-2012  chs branches: 1.56.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.55  24-Apr-2011  rmind branches: 1.55.4; 1.55.14;
Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.54  17-Sep-2009  tsutsui branches: 1.54.4; 1.54.6;
Include "ioconf.h" instead of extern struct cfdriver foo_cd decls.
 1.53  17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.52  12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.51  12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.50  14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.49  14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.48  02-Jul-2008  plunky branches: 1.48.4; 1.48.10;
change licence of my old code to two-clause BSD licence
remove my name from advertising list
 1.47  11-Jun-2008  drochner mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.46  05-Apr-2008  cegger branches: 1.46.2; 1.46.4; 1.46.6; 1.46.8;
use aprint_*_dev and device_xname
 1.45  19-Nov-2007  ad branches: 1.45.14;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.44  19-Oct-2007  ad branches: 1.44.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.43  08-Oct-2007  ad branches: 1.43.2;
Use the softint API.
 1.42  12-Aug-2007  macallan branches: 1.42.2; 1.42.4;
make this compile (again?) on sparc64 by sprinkling bus_space_vaddr().
Needs testing on both sparc and sparc64 - I don't have a magma.
 1.41  09-Jul-2007  ad branches: 1.41.2; 1.41.6;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.40  04-Mar-2007  mrg branches: 1.40.2; 1.40.4;
fix fall out from caddr_t changes.
 1.39  04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.38  01-Oct-2006  elad branches: 1.38.4;
More from Matt Fleming:

Adapt to KAUTH_DEVICE_TTY_PRIVSET and KAUTH_DEVICE_TTY_OPEN.
 1.37  01-Oct-2006  elad Adapt MD code to KAUTH_DEVICE_TTY_OPEN, batch #2 from Matt Fleming, thanks!

Also, add forgotten splx() calls in some places.
 1.36  23-Sep-2006  jmcneill PR# 29516: magma.c comments are wrong, also splhigh is excessive
 1.35  21-Jul-2006  ad branches: 1.35.4; 1.35.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.34  15-May-2006  yamt include kauth.h for kauth_authorize_generic.
 1.33  14-May-2006  elad integrate kauth.
 1.32  24-Dec-2005  perry branches: 1.32.4; 1.32.6; 1.32.8; 1.32.10; 1.32.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.31  11-Dec-2005  christos merge ktrace-lwp.
 1.30  06-Sep-2005  kleink Change the driver open function's conditional for overriding exclusive tty
use from checking the proc's uid to suser(9), and account for the use of
privileges. Noted by David Holland in PR kern/31126.
 1.29  27-Feb-2005  perry branches: 1.29.4;
nuke trailing whitespace
 1.28  17-Mar-2004  pk branches: 1.28.8; 1.28.10;
Rename PROM_getprop*() => prom_getprop*().
 1.27  29-Jun-2003  fvdl branches: 1.27.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.26  29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.25  22-Feb-2003  tsutsui hz -> Hz
 1.24  17-Dec-2002  pk Establish high-level interrupt with IPL_SERIAL.
 1.23  10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.22  10-Dec-2002  pk Switch to softintr(9).
 1.21  23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.20  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.19  30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.18  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.17  06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.16  21-Mar-2002  eeh branches: 1.16.4;
Use bus_space_vaddr().
 1.15  17-Mar-2002  atatat Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.14  11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.13  22-Jan-2002  pk Support for the ` Magma 2+1HS Sp' (from mouse on port-sparc):
- allow for sbus node name matching
- get clock frequency from prom property.
 1.12  13-Nov-2001  lukem add RCSIDs
 1.11  26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.10  02-May-2001  scw branches: 1.10.2; 1.10.4;
Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
 1.9  02-Nov-2000  eeh branches: 1.9.2;
Adapt to the new line discipline scheme.
 1.8  09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.7  04-Jun-2000  cgd branches: 1.7.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.6  23-Mar-2000  thorpej branches: 1.6.2;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.5  21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.4  28-Jul-1998  pk branches: 1.4.14; 1.4.20;
Fix #includes
 1.3  03-Jun-1998  pk Update from Iain on the parallel port stuff.
 1.2  20-May-1998  pk Do not assume that a parallel component is always configured.
Squash compiler warnings if MAGMA_DEBUG is on.
 1.1  19-May-1998  pk Magma SBus serial & parallel port driver from Iain Hibbert.
 1.4.20.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.14.2  22-Nov-2000  bouyer Sync with HEAD.
 1.4.14.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.7.2.1  19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.9.2.10  19-Dec-2002  thorpej Sync with HEAD.
 1.9.2.9  11-Dec-2002  thorpej Sync with HEAD.
 1.9.2.8  11-Nov-2002  nathanw Catch up to -current
 1.9.2.7  18-Oct-2002  nathanw Catch up to -current.
 1.9.2.6  17-Sep-2002  nathanw Catch up to -current.
 1.9.2.5  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.9.2.4  28-Feb-2002  nathanw Catch up to -current.
 1.9.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.9.2.2  08-Oct-2001  nathanw Catch up to -current.
 1.9.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.10.4.3  13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.10.4.2  10-Oct-2001  fvdl Convert all remaining devices.
 1.10.4.1  01-Oct-2001  fvdl Catch up with -current.
 1.10.2.6  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.2.5  28-Jun-2002  jdolecek g/c mbpp poll(), it returned ENODEV anyway
 1.10.2.4  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.10.2.3  16-Mar-2002  jdolecek Catch up with -current.
 1.10.2.2  11-Feb-2002  jdolecek Sync w/ -current.
 1.10.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.4.1  16-May-2002  gehenna Add the character device switch.
 1.27.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.27.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.27.2.4  04-Feb-2005  skrll Adapt to branch.
 1.27.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.27.2.1  03-Aug-2004  skrll Sync with HEAD
 1.28.10.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.28.8.1  29-Apr-2005  kent sync with -current
 1.29.4.5  07-Dec-2007  yamt sync with head
 1.29.4.4  27-Oct-2007  yamt sync with head.
 1.29.4.3  03-Sep-2007  yamt sync with head.
 1.29.4.2  30-Dec-2006  yamt sync with head.
 1.29.4.1  21-Jun-2006  yamt sync with head.
 1.32.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.32.10.2  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.32.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.32.8.2  11-Aug-2006  yamt sync with head
 1.32.8.1  24-May-2006  yamt sync with head.
 1.32.6.1  01-Jun-2006  kardel Sync with head.
 1.32.4.1  09-Sep-2006  rpaulo sync with head
 1.35.6.1  22-Oct-2006  yamt sync with head
 1.35.4.1  18-Nov-2006  ad Sync with head.
 1.38.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.40.4.1  11-Jul-2007  mjf Sync with head.
 1.40.2.4  23-Oct-2007  ad Sync with head.
 1.40.2.3  20-Aug-2007  ad Sync with HEAD.
 1.40.2.2  01-Jul-2007  ad Adapt to callout API change.
 1.40.2.1  17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.41.6.3  21-Nov-2007  joerg Sync with HEAD.
 1.41.6.2  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.41.6.1  16-Aug-2007  jmcneill Sync with HEAD.
 1.41.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.42.4.1  14-Oct-2007  yamt sync with head.
 1.42.2.2  09-Jan-2008  matt sync with HEAD
 1.42.2.1  06-Nov-2007  matt sync with HEAD
 1.43.2.2  21-Nov-2007  bouyer Sync with HEAD
 1.43.2.1  25-Oct-2007  bouyer Sync with HEAD.
 1.44.2.1  08-Dec-2007  mjf Sync with HEAD.
 1.45.14.3  02-Jul-2008  mjf Sync with HEAD.
 1.45.14.2  29-Jun-2008  mjf Sync with HEAD.
 1.45.14.1  02-Jun-2008  mjf Sync with HEAD.
 1.46.8.2  03-Jul-2008  simonb Sync with head.
 1.46.8.1  18-Jun-2008  simonb Sync with head.
 1.46.6.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.46.6.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.46.4.3  11-Mar-2010  yamt sync with head
 1.46.4.2  16-May-2009  yamt sync with head
 1.46.4.1  04-May-2009  yamt sync with head.
 1.46.2.1  17-Jun-2008  yamt sync with head.
 1.48.10.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.48.4.1  28-Apr-2009  skrll Sync with HEAD.
 1.54.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.54.4.1  31-May-2011  rmind sync with head
 1.55.14.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.14.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.55.4.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.55.4.1  30-Oct-2012  yamt sync with head
 1.56.2.1  18-May-2014  rmind sync with head
 1.58.2.1  10-Aug-2014  tls Rebase.
 1.59.28.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.59.28.1  10-Jun-2019  christos Sync with HEAD
 1.59.26.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.61.10.2  17-Apr-2021  thorpej Sync with HEAD.
 1.61.10.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.63.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed