Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/arcmsr.c
RevisionDateAuthorComments
 1.45  09-Feb-2024  andvar s/firwmare/firmware/ in comments.
 1.44  25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.43  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.42  13-Jun-2021  mlelstv branches: 1.42.2;
Fix race when freeing sensors.
 1.41  24-Apr-2021  thorpej branches: 1.41.2;
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.40  01-Oct-2019  chs branches: 1.40.10;
in many device attach paths, allocate memory with KM_SLEEP instead of KM_NOSLEEP
and remove code to handle failures that can no longer happen.
 1.39  09-Dec-2018  jdolecek use pci_intr_establish_xname() everywhere
 1.38  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.37  12-Aug-2017  mlelstv branches: 1.37.2; 1.37.4;
tag arcmsr scsipi adapter and pci interrupt as MPSAFE. I/O is now done
without taking kernel lock.
 1.36  19-Jun-2016  dholland more NBIO > 0
(not sure why test-compiling yesterday didn't expose these, probably
improper cflags)
 1.35  19-Jun-2016  dholland Broaden the #if NBIO > 0 block. Should fix broken evbppc build.
 1.34  12-Jun-2016  christos Make internal functions static to avoid conflicts with arc_* from zfs.
 1.33  02-May-2016  christos move scsipi_strvis -> libkern:strnvisx()
change the prototype to match userland
fix sizes of strings passed to it
 1.32  12-Mar-2015  christos Dedup the conversion of bioc_disk and bioc_vol to envsys_data_t
 1.31  29-Mar-2014  christos branches: 1.31.6;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.30  20-Jun-2011  pgoyette branches: 1.30.2; 1.30.12; 1.30.16;
Initialize current value for ENVSYS_DRIVE sensors
 1.29  20-Jun-2011  pgoyette Initialize sensors states before registering.
 1.28  20-Jun-2011  pgoyette Maintain our own storage for volume and disk ID info rather than
(ab)using envstat's storage.

XXX Compile-tested only.
 1.27  04-Jun-2011  pgoyette Update to use the new name for the sensor's private data.

XXX This driver still uses the sensor's value_min for an unrelated
XXX purpose, but changing that will have to wait for another day.
 1.26  13-Nov-2010  uebayasi branches: 1.26.2; 1.26.6;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.25  03-Apr-2010  jruoho Only unregister the sensors if these were successfully installed;
sysmon_envsys_unregister() does not check for NULL pointers gracefully.
 1.24  03-Apr-2010  pgoyette If we're detaching the device, make sure we unregister the sensors.
 1.23  14-Mar-2010  pgoyette branches: 1.23.2;
Remove setting of edata->monitor since that member no longer exists.
 1.22  23-Sep-2008  christos branches: 1.22.14;
PR/39583: Brad du Plessis: acrmsr(4) driver doesn't report number of volumes correctly
to bioctl(8)
PR/39584: Juan RP: arcmsr(4) driver disk state values are incorrect (for ARC-1220)
 1.21  24-Jun-2008  gmcgarry branches: 1.21.2;
Replace gcc variadic macros with c99 variadic macros.
 1.20  03-Apr-2008  xtraeme branches: 1.20.4; 1.20.6; 1.20.8; 1.20.10;
Add ARC_FW_DISK_INITIALIZED flag for device_state and do not treat
it as unknown; in this state the disk is correctly working so set it
as online.

Also remove some bogus htole32() for diskinfo->device_state.

This should fix PR kern/38299 by Hiroyuki Bessho.
 1.19  05-Mar-2008  xtraeme Split device_t/softc, and other related cosmetic changes.
 1.18  03-Mar-2008  xtraeme Detect and initialize correctly RAID 1+0 levels.
 1.17  01-Mar-2008  xtraeme RAID 1/1+0 volumes may only be created with foreground initialization,
use the quick_init member in the ARC_FW_CREATE_VOLUME command code.

You can now create RAID 1/1+0 volumes through bioctl(8), but only one
volume will be initialized; the other ones that need initialization will
wait until the first is done.
 1.16  01-Mar-2008  xtraeme arc_create_sensors: if there are no valid volumes (all passthru volumes),
just exit from the kthread.
 1.15  29-Feb-2008  xtraeme arc_bio_inq: ask the firmware only once for the ARC_FW_SYSINFO
command code and use the softc values on the next bio requests.
 1.14  29-Feb-2008  xtraeme If a disk has been disconnected in a volume set, mark it as offline
and put it on another bus and print "disk missing"... the OpenBSD driver
does that but I forgot to re-add it.

Also save some values provided by the firmware in the softc and use them
in the bio(4) ioctls, this speeds up considerably bioctl(8) and avoids
so many firmware commands every time we want the current status.
 1.13  29-Feb-2008  xtraeme arc_refresh_sensors: show rebuilding status.
 1.12  29-Feb-2008  xtraeme arc_bio_disk_novol: don't forget to free diskinfo if arc_msgbuf
returns an error.
 1.11  28-Feb-2008  xtraeme If pmf_device_register1() fails for some reason, make it panic(9)
rather than printing an error. The shutdown handler is mandatory on
this driver to flush controller's cache or stopping background
rebuilds.
 1.10  28-Feb-2008  xtraeme Register a sensor per disk connected to a valid volume, so that we
can get more details if state on a disk or volume has changed,
previously only state about the volume was available.

You'll see something like this with envstat(8) now:

$ envstat -darcmsr0
RAID 5 volume0 (sd0): building
disk0 volume0 (sd0): online
disk1 volume0 (sd0): online
disk2 volume0 (sd0): online
disk3 volume0 (sd0): online
$

Convert the driver to use pmf(9) and register a shutdown power handler
via pmf_device_register1() that was added recently.

Misc cosmetics tweaks while I'm here.
 1.9  02-Jan-2008  xtraeme branches: 1.9.2; 1.9.4; 1.9.6; 1.9.10;
New functionality for arcmsr(4) native management via bioctl(8):

Added support to create/remove hot-spare, pass-through disks.
Added support to create/remove volume sets.
Added support to show information about physical disks, even if they
are marked unused, hot-spares or pass-through.

sd(4) devices are attached/detached automagically when a pass-through
disk or volume set is created/removed... thanks scsipi(9) and cube@
for hints.
 1.8  07-Dec-2007  xtraeme branches: 1.8.2; 1.8.4; 1.8.6; 1.8.10; 1.8.12;
Add BIOC_SVMIGRATING to bio(4) and bioctl(8) to report if a volume
is migrating currently showing the percentage.

Update arcmsr(4) to report this, like:

$ sudo ./bioctl -h arcmsr0
Volume Status Size Device
arcmsr0 0 Migrating 698G ARC-1210-VOL#00 RAID 5 7% done
0 Online 234G 0:0.0 noencl <WDC WD2500YS-01SHB1 20.06C06>
1 Online 234G 0:1.0 noencl <WDC WD2500YS-01SHB1 20.06C06>
2 Online 234G 0:2.0 noencl <WDC WD2500YS-01SHB1 20.06C06>
3 Online 234G 0:3.0 noencl <WDC WD2500YS-01SHB1 20.06C06>
$
 1.7  07-Dec-2007  xtraeme - Improve the locking based in comments from ad@.
- malloc(9) -> kmem(9) now that most of the bio code doesn't need to run
on interrupt context.
- Reduce code that runs in interrupt context to a small part in
arc_msgbuf() and is protected by arc_lock()/arc_unlock().

Reviewed and help by ad@.
 1.6  05-Dec-2007  gmcgarry Fix locking botch.
 1.5  05-Dec-2007  xtraeme Boh! I spoke too soon before, without the rwlock(9) sometimes
arc_wait() waits forever, so put it back until I figure any other way
to remove the rwlock(9).
 1.4  05-Dec-2007  xtraeme Use SCSIPI_CHAN_NOSETTLE... the driver doesn't have to wait.
 1.3  05-Dec-2007  xtraeme Make it use mutex(9) and condvar(9), bye bye spl(9) and tsleep(9).

Fully stable with all debugging options turned on, unless someday any
problem appears :-)
 1.2  05-Dec-2007  xtraeme - arc_msgbuf: free wbuf and rbuf with the correct type (M_TEMP vs M_DEVBUF)
this fixes a panic with debugging options.
- Do not use a callout to refresh sensor data, and make it available
every time someone requests it.
- Enable ENVSYS_FMONSTCHANGED for notifications in the volumes.
 1.1  05-Dec-2007  xtraeme Rename the Areca RAID driver (known as arc(4) to arcmsr(4) to avoid
namespace conflict with NetBSD/arc.

Found by tsutsui@.
 1.8.12.1  08-Jan-2008  bouyer Sync with HEAD
 1.8.10.2  09-Dec-2007  jmcneill Sync with HEAD.
 1.8.10.1  07-Dec-2007  jmcneill file arcmsr.c was added on branch jmcneill-pm on 2007-12-09 19:37:52 +0000
 1.8.6.3  18-Feb-2008  mjf Sync with HEAD.
 1.8.6.2  08-Dec-2007  mjf Sync with HEAD.
 1.8.6.1  07-Dec-2007  mjf file arcmsr.c was added on branch mjf-devfs on 2007-12-08 18:19:41 +0000
 1.8.4.2  08-Dec-2007  ad Sync with head.
 1.8.4.1  07-Dec-2007  ad file arcmsr.c was added on branch vmlocking2 on 2007-12-08 17:57:25 +0000
 1.8.2.4  17-Mar-2008  yamt sync with head.
 1.8.2.3  21-Jan-2008  yamt sync with head
 1.8.2.2  07-Dec-2007  yamt sync with head
 1.8.2.1  07-Dec-2007  yamt file arcmsr.c was added on branch yamt-lazymbuf on 2007-12-07 17:30:22 +0000
 1.9.10.4  28-Sep-2008  mjf Sync with HEAD.
 1.9.10.3  29-Jun-2008  mjf Sync with HEAD.
 1.9.10.2  02-Jun-2008  mjf Sync with HEAD.
 1.9.10.1  03-Apr-2008  mjf Sync with HEAD.
 1.9.6.1  24-Mar-2008  keiichi sync with head.
 1.9.4.4  24-Sep-2008  bouyer Pull up following revision(s) (requested by christos in ticket #1205):
sys/dev/pci/arcmsrvar.h: revision 1.13
sys/dev/pci/arcmsr.c: revision 1.22
PR/39583: Brad du Plessis: acrmsr(4) driver doesn't report number of
volumes correctly
to bioctl(8)
PR/39584: Juan RP: arcmsr(4) driver disk state values are incorrect (for
ARC-1220)
 1.9.4.3  29-Aug-2008  bouyer Apply patch, requested by christos in tickets #1175:
sys/dev/bio.c patch
sys/dev/biovar.h patch
sys/dev/pci/arcmsr.c patch
sys/dev/pci/arcmsrvar.h patch
sbin/bioctl/Makefile patch
sbin/bioctl/bioctl.8 patch
sbin/bioctl/bioctl.c patch
sbin/bioctl/dehumanize_number.c patch
sbin/bioctl/strtonum.c patch
sbin/bioctl/strtonum.h patch

Port bioctl(8) and arcmsr(4) from current:
bioctl(8): Rewritten to handle new features like creating/removing
hot-spare, pass-through disks and RAID volumes, start/stop
consistency checks in volumes and others.
arcmsr(4): Added support to create/remove hot-spare, pass-through
disks and RAID volumes, start/stop consistency checks
in volumes as well as showing information about physical
disks (even if they are marked as hot-spare, pass-through
or unused).
 1.9.4.2  11-Jan-2008  xtraeme Pull up following revision(s) (requested by christos in ticket #1037):
sys/dev/pci/arcmsr.c: patch
sys/dev/pci/arcmsrvar.h: patch
sys/dev/pci/pcidevs: patch
sys/dev/pci/files.pci: patch
sys/arch/i386/conf/GENERIC: patch
sys/arch/i386/conf/XEN2_DOM0: patch
sys/arch/i386/conf/INSTALL_LARGE: patch
sys/arch/amd64/conf/GENERIC: patch
sys/arch/amd64/conf/INSTALL: patch
share/man/man4/Makefile: patch
share/man/man4/arcmsr.4: patch
distrib/sets/lists/man/mi: patch

Add the Areca Technology Corporation SATA RAID controller driver, ported
from OpenBSD.
 1.9.4.1  02-Jan-2008  xtraeme file arcmsr.c was added on branch netbsd-4 on 2008-01-11 17:03:16 +0000
 1.9.2.3  23-Mar-2008  matt sync with HEAD
 1.9.2.2  09-Jan-2008  matt sync with HEAD
 1.9.2.1  02-Jan-2008  matt file arcmsr.c was added on branch matt-armv6 on 2008-01-09 01:53:32 +0000
 1.20.10.1  27-Jun-2008  simonb Sync with head.
 1.20.8.3  04-Sep-2008  skrll Sync with netbsd-4.
 1.20.8.2  03-Jun-2008  skrll Sync with netbsd-4.
 1.20.8.1  03-Apr-2008  skrll file arcmsr.c was added on branch wrstuden-fixsa on 2008-06-03 20:47:23 +0000
 1.20.6.2  10-Oct-2008  skrll Sync with HEAD.
 1.20.6.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.20.4.2  11-Aug-2010  yamt sync with head.
 1.20.4.1  04-May-2009  yamt sync with head.
 1.21.2.1  19-Oct-2008  haad Sync with HEAD.
 1.22.14.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.23.2.3  12-Jun-2011  rmind sync with head
 1.23.2.2  05-Mar-2011  rmind sync with head
 1.23.2.1  30-May-2010  rmind sync with head
 1.26.6.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.26.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.30.16.1  18-May-2014  rmind sync with head
 1.30.12.3  03-Dec-2017  jdolecek update from HEAD
 1.30.12.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.12.1  02-Dec-2012  tls Areca controller maximum-transfer size limits -- looked up in FreeBSD
driver.

Actually exporting the per-volume transfer size for this driver will
be quite hard; the controller firmware shows the host the configured
volumes when the host probes the controller's "scsibus", and we can't
really associate them with particular RAID volumes until later. I think
we will have to intercept the SCSI inquiry commands -- yuck.
 1.30.2.1  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.31.6.4  28-Aug-2017  skrll Sync with HEAD
 1.31.6.3  09-Jul-2016  skrll Sync with HEAD
 1.31.6.2  29-May-2016  skrll Sync with HEAD
 1.31.6.1  06-Apr-2015  skrll Sync with HEAD
 1.37.4.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.37.4.1  10-Jun-2019  christos Sync with HEAD
 1.37.2.2  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.37.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.40.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.41.2.1  17-Jun-2021  thorpej Sync w/ HEAD.
 1.42.2.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed