Commit Graph

52 Commits

Author SHA1 Message Date
dholland
a68f9396b6 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.
2014-03-16 05:20:22 +00:00
skrll
2d1abfdfec More alignment spellos 2014-01-25 10:14:29 +00:00
christos
b787afbfb6 - remove unused variables
- move variables inside ifdef sections
- ifdef notdef unused code
- use __USE for debugging variables
2013-10-17 21:24:24 +00:00
christos
8acb1eb6b2 Fix the non-thunderbolt case. XXX: Is that right even?
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
2013-06-28 14:46:44 +00:00
bouyer
43d500aa17 MFI_STATE_BOOT_MESSAGE_PENDING also needs to be handed for non-TBOLT
controllers, from FreeBSD. tested by Hugo Silva against a GEN2 controller.
2012-11-09 18:46:54 +00:00
bouyer
f2b31f39d0 Add a pass-through ioctl for mfi(4), allowing userland to send raw commands
to the controller. This is compatible with the linux and FreeBSD
implementations.
Add the needed conversion for mfi ioctls in COMPAT_LINUX
Allocate a character major number, and create /dev/mfi0 by default
on amd64 and i386.
This allows (along with a hand-created /emul/linux/proc/devices file)
to run the MegaCLI linux binary provided by LSI.
2012-09-19 21:24:28 +00:00
bouyer
7c3587c477 Make MFI_DEBUG build on i386.
Report BBU state changes with aprint_normal(), it seems that sysmon_envsys()
doens't report changes for ENVSYS_INDICATOR as it does for ENVSYS_DRIVE.
2012-08-26 16:22:32 +00:00
bouyer
97f1f42c3f After discussion on tech-kern@, fix performance issue related to
cache flush commands from WAPBL, by skipping the cache flush if the
BBU is present and considered good. Users which still want the write back
cache with a non-working BBU can set vfs.wapbl.flush_disk_cache to 0.
- add commands to monitor the BBU state. Add a boolean BBU sensor
  to monitor the BBU state via sysmon_envsys(9).
- if the BBU is considered good, turn SCSI_SYNCHRONIZE_CACHE_10 and
  SCSI_SYNCHRONIZE_CACHE_16 commands from upper layer into NOOPs.
  While there, handle SCSI_SYNCHRONIZE_CACHE_16 in addition to
  SCSI_SYNCHRONIZE_CACHE_10.
- Add a shutdown pmf(9) handler, which flushes the cache and shutdown the
  firmware
- on detach, also flush cache and shutdown firmware.
- on attach, print the firmware-provided name, and the BBU state
Tested on a LSI MegaRAID SAS 9265-8i and a PERC 5/i Integrated
2012-08-26 16:05:29 +00:00
bouyer
bd7a682fbd Avoid "unused variable" warning for non-DIAGNOSTIC kernels.
Pointed out by Havard Eidnes
2012-08-23 12:24:33 +00:00
bouyer
1d04ca4271 Add support newer LSI RAID controllers based on the SAS2208 chip,
codenamed "ThunderBolt". Add tagged queuing support for all adapters
supported by mfi(4).
Tested with a MegaRAID SAS 9265-8i adapter, and an older Dell PERC 5/i.
2012-08-23 09:59:13 +00:00
bouyer
5a6e0a7e6f Really init sc_ioptype in mfi_attach() 2012-08-05 22:47:36 +00:00
bouyer
927cb9aa03 sg64.len is 32bits, so use htole32() 2012-08-05 17:23:25 +00:00
bouyer
b669f4cc30 MFI_IOP_SKINNY is an enum not a single bit value, so it can't be used as
a bit flag. As sc_flags is really used to hold an enum mfi_iop value,
change it to enum mfi_iop and rename to sc_ioptype. While there init it
in mfi_attach() instead of mfi_pci_attach().
2012-08-05 15:50:49 +00:00
bouyer
e981d39ae5 Add some support for 64bit DMA but stick to 32bit DMA for now.
From OpenBSD mfi.c rev 1.119.
2012-08-05 14:54:01 +00:00
sborrill
3da3803c32 Add support for skinny variants (e.g. IBM ServeRAID M1015). Based on OpenBSD
changes with some improvements. Tested on IBM x3550M3 with RAID0 and RAID1
volumes including bioctl(8) operation.
2012-03-21 14:22:35 +00:00
sborrill
1c6487cbaf From OpenBSD. Fixes a deadlock during autoconf.
scrub more fields in the ccb when returning them to the free list after
theyve been used, in particular the mfi header flags which has a bit
that specifies if a command should be completed via the interrupt path.

if we use a ccb during boot we set that bit, but it isnt necessarily
cleared by things that use it later on. this means a ccb we expected to
complete via an interrupt never actually generates an interrupt or appears
in the reply queue. this obviously stalls the io.
2012-03-21 13:19:11 +00:00
pgoyette
2c629d0bbf Initialize current value for ENVSYS_DRIVE sensors 2011-06-20 22:02:55 +00:00
pgoyette
57e6b23a48 Initializes sensors states before registering. 2011-06-20 17:48:45 +00:00
pgoyette
89bf6ebb9f Remove setting of edata->monitor since that member no longer exists. 2010-03-14 18:05:07 +00:00
msaitoh
38a7bbf82a Add newer cars supports. Tested on MegaRAID SAS 9260-8i.
- Add MFI gen2 support from OpenBSD.
 - Add entry for MegaRAID SAS 9260-8i
2010-02-09 00:05:18 +00:00
msaitoh
8b946f18cd Fix a bug that the system which has no logical volume panics in shutdown
hook. Without any logical volume, sysmon_envsys_register() fails. On such
case, sc->sc_sme must be NULL for the detach. Reviewed by dyoung and bouyer.
2010-02-08 23:54:33 +00:00
bouyer
3ccd2d9884 bio(4) is MP-safe but mfi(4) is not. So get the kernel_lock at
mfi_ioctl() entry and release it on exit.
2010-01-19 20:54:32 +00:00
dyoung
da6660904b Delete whitespace at ends of lines. No functional change intended. 2009-09-13 21:24:58 +00:00
bouyer
88384a5472 Oups, remove extra } 2009-08-27 09:40:39 +00:00
bouyer
952c92b561 mfi.c still uses the spl() synchronisation scheme and so needs the kernel lock.
The sysmon subsystem is marked MPSAFE and so runs without the kernel lock.
So get the kernel lock in mfi_sensor_refresh()  before calling
mfi_ioctl_vol().
This fixes command list corruption seen on heavy I/O load on the mfi
driver(4).
2009-08-26 21:41:05 +00:00
dyoung
bbc238f2cd Let us detach & re-attach children of mfi0. Detach mfi0 at shutdown.
Detachment may fail after freeing some but not all resources, so
take care not to re-release any resource during detachment.

Tested on a Dell PowerEdge 1950.
2009-07-16 18:58:38 +00:00
dyoung
ebab3c38ca device_t/softc split. Tested and shown to work on a Dell PowerEdge
1950.
2009-07-16 18:10:00 +00:00
dyoung
c85f1bbee5 Try to detach ancestors (sd0 at scsibus0, scsibus0 at mfi0), first,
to avoid dangling references to envsys(4) sensors and such if
detaching the ancestors should fail.
2009-07-16 01:30:10 +00:00
dyoung
78500bdfd5 Add a rudimentary detachment hook for mfi(4). 2009-07-16 01:01:46 +00:00
cegger
529e91fca1 struct device * -> device_t, no functional changes intended. 2009-05-12 14:16:35 +00:00
cegger
c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
mlelstv
c94f3d9355 Don't release CCB twice. Found by code inspection. 2009-02-16 18:05:19 +00:00
yamt
b1fea83762 remove extra semicolons. 2009-01-03 03:43:21 +00:00
bouyer
3e37931111 Change mfi_mgmt() to take a mfi_ccb and scsipi_xfer as argument, as
mfi_scsi_io does. Do not tsleep in mfi_mgmt waiting for completion;
let the caller handle it. If mfi_mgmt() is called with a non-NULL scsipi_xfer
have mfi_mgmt_done() wake it up, else wake up the mfi_ccb.
mfi_poll()/mfi_post() is up to the caller.

mfi_scsipi_request(): handle SCSI_SYNCHRONIZE_CACHE_10 as we do for other
commmands: have mfi_mgmt() fill in the ccb, queue of poll the ccb and
return.

Introduce mfi_mgmt_internal() which behaves like mfi_mgmt() did (tsleep
waiting for completion). Use it for internal and ioctl management
requests.

Fix kern/39297 from Greg Oster (mfi calls tsleep() from mfi_intr()),
tested by Mark Davies.
2008-10-23 21:00:06 +00:00
gmcgarry
7d3d745b26 status is unsigned. 2008-06-24 10:08:43 +00:00
cegger
ac625f0f59 revert rev. 1.16 and redo the fix as proposed by oster per private mail 2008-04-22 22:49:49 +00:00
cegger
36244f71ec Fix error path:
Don't try to free non-allocated memory. Only free allocated memory.
This fixes a crash reported by Brian A. Seklecki on port-xen:
http://mail-index.netbsd.org/port-xen/2008/04/10/msg003555.html

Fix tested by Brian A. Seklecki:
http://mail-index.netbsd.org/port-xen/2008/04/21/msg003604.html
2008-04-22 09:29:08 +00:00
cegger
7088512994 use aprint_*_dev and device_xname 2008-04-08 12:07:25 +00:00
xtraeme
db64271c36 Add back the bus_dmamap_sync() calls that were in the old
mfi_despatch_cmd() func after merging changes in rev 1.12.

Merge rev 1.69 and 1.64 from openbsd, fixing two bugs:

Fix subtle x ? y : z bug when calling mfi_create_sgl. This worked because
during runtime the bug condition does not happen.

When determining the size of the volumes and disks we want how many
bytes each of them has, not the number of kilobytes. this solves the
"why am i dividing by 2" question. the answer is "you dont, you multiply
by 512".

The first item fixes a panic with Dell Perc 5/i reported by oster@.
Changes tested on Dell Perc 5/i by oster@.
2008-03-27 21:15:29 +00:00
xtraeme
91a508cbf7 Apply some KNF to this driver and do some random changes as well:
- Change malloc + memset(blah, 0, ...)  to malloc with M_ZERO.
- The adapt_ioctl assigned was returning ENOTTY, so there's no point
  on having it.
- Static'ify.

I believe there are some paths on this driver where the splbio()s
are not needed, but can't test to verify...
2008-02-25 21:22:32 +00:00
xtraeme
54880c4f00 Added support for the mfi(4) controllers with powerpc IOPs such as
LSI SAS1078 or Dell PERC 6, from OpenBSD.

Tested by Akira Kato on current-users@.
2008-02-25 10:46:02 +00:00
xtraeme
31962fc6e5 Extend the envsys2 API (one more time, sorry) as defined in:
http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
2007-11-16 08:00:11 +00:00
ad
a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
xtraeme
9622f8ee94 s/ENVSYS_FMONDRVSTATE/ENVSYS_FMONSTCHANGED/. Noticed by Manuel Bouyer@. 2007-09-04 20:46:00 +00:00
xtraeme
edbf497407 mfi_sensor_gtredata:
- There's no need to set edata->units again, it was set already before.
- Remove the last ENVSYS_SVALID assignment that overrides previous
  assignments (found by mhitch@).
2007-07-04 17:07:04 +00:00
xtraeme
4510a124e4 There's no need to set ENVSYS_FMONNOTSUPP in sensor's flags anymore,
userland limits for this type of sensor is disabled by sysmon_envsys(9).
2007-07-01 11:35:31 +00:00
xtraeme
da3f163bd2 Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
  and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
  sysmon_power(9) and powerd(8), that means there is no 32 bytes event
  size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
2007-07-01 07:37:12 +00:00
dogcow
cdc34fdb17 tred->sensor is a u_int. 2007-05-01 19:39:22 +00:00
bouyer
982bad256f Add bio(4) and associated bioctl(8) from OpenBSD, a driver control block
device controllers, and more specifically raid controllers.
Add a new sensor type, ENVSYS_DRIVE, to report drive status. From OpenBSD.
Add bio and sysmon support to mfi(4). This allow userland to query
status for drives and logical volumes attached to a mfi(4) controller. While
there fix some debug printfs in mfi so they compile.
Add bio(4) to amd64 and i386 GENERIC.
2007-05-01 17:18:52 +00:00
christos
53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00