Commit Graph

151 Commits

Author SHA1 Message Date
Doug Ambrisko
fa1e6ef4ef - Fix from jhb for failing I/O request when bus_dmamap_load fails.
- Fix to ioctl path in which the length could be 0 which means
  no data in/out from LSI.
- Fix to ioctl path in which the data in the sense data space
  of the ioctl packet is a really a pointer to some location in
  user-space.  From LSI re-worked a bit by me.
- Add HW support for next gen cards from LSI.

Thanks to LSI for their support!

Submitted by:	jhb, LSI
MFC after:	3 days
2008-11-12 22:44:50 +00:00
Warner Losh
e04ca6236a Fix style nit: s/^ }/}/ in two places. 2008-08-23 23:30:54 +00:00
John Baldwin
2137b017d7 Tweak the output of event log messages from the controller:
- Each log entry contains a text description in the "description" field of
  the entry.  The existing decode logic always ended up duplicating
  information that was already in the description string.  This made the
  logs overly verbose.  Now we just print out the description string.
- Add some simple parsing of the timestamp and event classes.

Reviewed by:	ambrisko, scottl
MFC after:	2 weeks
2008-06-26 22:36:38 +00:00
John Baldwin
c1ed06a84b Adjust the handling of pending log events during boot:
- Fetch events from the controller in batches of 15 rather than a single
  event at a time.
- When fetching events from the controller, honor the event class and
  locale settings (via hw.mfi tunables).  This also allows the firmware to
  skip over unwanted log entries resulting in fewer requests to the
  controller if there many unwanted log entries since the last clean
  shutdown.
- Don't drop the driver mutex while decoding an event.
- If we get an error other than MFI_STAT_NOT_FOUND (basically EOF for
  hitting the end of the event log) then emit a warning and bail on
  processing further log entries.

Reviewed by:	ambrisko, scottl
MFC after:	2 weeks
2008-06-26 22:33:24 +00:00
Doug Ambrisko
46fb79ea72 Add support to talk to the LSI ioctl path on with FreeBSD 32 bit app's
on amd64.  Note the only difference is the iovec32 part so I use the
native structure for everything else.

Also I plan to MFC all the changes in -current to 7-stable and 6-stable
shortly since I've been running them.  This does not include the cam
changes.

MFC after:	3 days
2008-05-28 23:19:27 +00:00
Scott Long
0929b66905 Add support for management apps. Work around an apparent firmware bug that
results in hung i/o if more than 128 commands are scheduled for an array.
2008-05-12 14:09:19 +00:00
Kris Kennaway
c637bc9203 Replace callout_init(..., 1) with callout_init(..., CALLOUT_MPSAFE) for
better grep-compliance and to standardize with the rest of the kernel.

Reviewed by:	       jhb
MFC after:	       1 week
2008-04-16 16:47:14 +00:00
Doug Ambrisko
a355f43ed2 Add in a compat. mode so you can either open the card's device
node or directly open mfi0 and specify the card you want to talk to
in the ioctl.
2008-03-22 02:57:49 +00:00
Doug Ambrisko
04697de95a Fix some bugs in dealing with DCMD'd without data. MegaCli was sending
down some DCMD's without any data.  Thanks to Dell and LSI for helping
to provide clues to figure out this problem.  Now MegaCli can upgrade
the firmware and should work identical when run on Linux.

Reviewed by:	scottl, LSI
MFC after:	1 day
2008-02-02 17:29:28 +00:00
Doug Ambrisko
4844f5c009 Add Dell's sub-vendor id to identify PERC6 RAID controller which has LSI
vendor id's.
2007-12-19 17:23:47 +00:00
Doug Ambrisko
9df7763bf3 I incorrectly assumed the log buffer started from the beginning when it
is actually a circular log.  Deal with it rolling around.  Fortunately,
the log area is big and I haven't seen any roll over yet.  Update and
get rid of the obsolete comment.
2007-12-19 17:22:07 +00:00
Scott Long
b05e6558c9 Play better with CAM so that there aren't so many spurious warnings at boot. 2007-10-12 16:52:55 +00:00
Scott Long
610f2ef365 Update the MFI driver to support new "1078" series of hardware. This
includes the upcoming Dell PERC6 series.  Many thanks to LSI for
contributing this code.

Submitted by: LSI
Approved by: re
2007-08-25 23:58:45 +00:00
John Baldwin
cde586a75c Fix a few nits relative to the previous changes:
- Don't leak the config lock if detach() fails due to the controller char
  dev being open.
- Close a race between detach() and a process opening the controller char
  dev.

MFC after:	1 week
Approved by:	re (bmah)
2007-08-13 21:14:16 +00:00
John Baldwin
8ec5c98ba4 Teach the mfi(4) driver to handle requests from userland management
applications to add and remove volumes.

MFC after:	1 week
Approved by:	re (bmah)
Reviewed by:	ambrisko, scottl
2007-08-13 19:29:17 +00:00
Scott Long
b50569b71d Prepare for future integration between CAM and newbus. xpt_bus_register
now takes a device_t to be the parent of the bus that is being created.
Most SIMs have been updated with a reasonable argument, but a few exceptions
just pass NULL for now.  This argument isn't used yet and the newbus
integration likely won't be ready until after 7.0-RELEASE.
2007-06-17 05:55:54 +00:00
Doug Ambrisko
5be25877a1 Add in a couple of things:
-	In the ioctl path let command get queued up and return
	when complete _without_ blocking the driving waiting for
	the response.  This way the driver doesn't "lock up" for
	~30s during a flash command.  Submitted by scottl.
      -	Add a guard so that if a DCMD of 0 is sent down the ioctl
	path don't send it to the controller.  Return with a
	status of OK.  This is a little strange since MegaCli
	doesn't seem to like something and will issue some DCMD
	of 0.  This doesn't happen under Linux.  So the emulation
	needs to be improved but I'm not sure what.  Another strange
	thing is that when a DCMD of 0 gets issued under i386 the
	controller returns OK but in amd64 the context is messed
	up.
      -	Add a guard so the context has to be with-in the legal
	limit so we get a reasonable error assertion versus random
	panic.

It's going to be a challenge to figure out why MegaCli is not totally
happy and then sends some bogus commands.  This means that flashing
firmware via the Linux tool won't work since it generates a DCMD of
0 when it should be opening the firmware for a flash update.  Without
this problem flashing works fine.  This means there is no publicly
available tool to upgrade the RAID firmware under FreeBSD right now.

I plan to MFC all of the mfi changes to 6.X shortly.  This might not
include the SCSI pass-through changes.

Submitted by:	scottl
Reviewed by:	scottl
MFC after:	3 days
2007-06-04 16:39:22 +00:00
Scott Long
35ef86f285 Catch up to driver changes required for the mfip sub-driver. 2007-05-16 17:23:36 +00:00
Scott Long
f366931c86 Add the 'mfip' sub-driver for gaining SCSI-passthrough access to devices
on an MFI controller.
2007-05-16 17:19:47 +00:00
Scott Long
ddfae47b9d Collapse the mfi_ld object. Add an ioctl to help management apps map
array Id's to FreeBSD device names.
2007-05-10 15:33:41 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
Scott Long
95a8bcd854 Remove a PCI ID entry that conflicts with the AMR driver. 2007-01-23 02:47:33 +00:00
Scott Long
875d25860a Add PCI Id's for upcoming controllers.
Obtained from: LSI Corp.
MFC After: 3 days
2007-01-17 02:58:41 +00:00
Scott Long
c953d93930 Up the event class reporting from 10 (basically, nothing) to EVT_CLASS_INFO.
Submitted by: Doug Ambrisko
2007-01-07 06:43:25 +00:00
Scott Long
a91d6dab2e Make sure that all of the fields in the header are clean. It was possible for
unsafe flags to leak from one command to another.
2007-01-02 04:12:34 +00:00
Doug Ambrisko
812819c7b1 Some relatively minor changes and bug fixes:
1)	s/mi/mfi/ in FreeBSD ioctl path
     2)	add in "\n" on various failure messages
     3)	cap the length of time to abort an AEN command
     4)	fix passing sense data back to user to make Dell's Linux firmware
	upgrade tool happy.
     5)	bump the MFI_POLL_TIMEOUT_SECS from 10s to 50s since the
	firmware flash command can take ~40s to return.

This is some clean-up and enables RAID firmware to updated via Dell's
tool.  Note Dell's tool requires the updates to the Linux emulator
that has been done in -current with TLS etc.

I need to discuss with scottl how to better submit mfi commands to
the firmware via the ioctl path so we don't do it in polled mode.
2006-12-14 18:29:08 +00:00
Scott Long
3c77cee1ba Change the internal API for polled commands. Calling mfi_polled_command
after calling mfi_mapcmd is no longer needed, so long as the MFI_CMD_POLLED
flag is set.  This change eliminates the possibility of a polled command
getting posted twice to the driver.  This is turn fixes panics on shutdown
when INVARIANTS is set.

Sponsored by: Ironport
2006-11-18 07:33:53 +00:00
Doug Ambrisko
c2be47f25f - Add in FreeBSD native ioctl that models the Linux version.
- Add a translation so the Linux ioctl's don't conflict with
  the FreeBSD definition.
- Assume Linux 32bit emulation on amd64.
This was tested on i386 and amd64 with the 32bit Linux MegaCli.
Eventually we should do a 32bit native FreeBSD translation app.
2006-11-14 16:48:00 +00:00
Scott Long
6d678f8ee7 Remove some debugging code that accidentally crept in. 2006-10-16 04:30:09 +00:00
Scott Long
441f6d5dca - Add a command validator for use in debugging.
- Fix the locking protocol to eliminate races between normal I/O and AENs.
- Various small improvements and usability tweaks.

Sponsored by: IronPort
Portions Submitted by: Doug Ambrisko
2006-10-16 04:18:38 +00:00
Scott Long
37fe50c382 Skip the AEN event command that is always hanging out on the card.
Submitted by: Doug Ambrisko
2006-09-27 05:00:10 +00:00
Scott Long
420a5a0e25 Fix a bad #include statment 2006-09-27 04:54:23 +00:00
Scott Long
5ba21ff136 Add a command debugging module and a periodic watchdog timer.
Sponsored by: IronPort
2006-09-25 11:35:34 +00:00
Doug Ambrisko
a1adc445ed Allow hw.mfi.event_locale/hw.mfi.event_class to be set via loader.
If an event doesn't match the criteria then don't print it.  Some
events are not saved in the log (<0 class events).
2006-09-20 18:49:35 +00:00
Scott Long
78e36c279b Change some variable names and update some comments to help clarify some
confusing issues.
2006-09-20 06:58:02 +00:00
Doug Ambrisko
765ca1d3d2 Change the class from uint8_t to int8_t so people can filter on >0
events.
2006-09-07 19:32:05 +00:00
Doug Ambrisko
47b470b9e3 Change the event log dump on initial boot to use get_event versus
AEN.  This makes the boot messages cleaner.  I now know how this
structure works so I can implement it versus guessing.  Remove the
not ready type code since it is ready now.

I added the time stamp/locale/class so people can parse messages better.
Create a sysctl so that we can set the locale/class level.
2006-09-07 18:40:49 +00:00
Scott Long
6459155f67 Remove old debugging code from the interrupt handler. 2006-09-07 05:05:41 +00:00
Doug Ambrisko
78997d853b Change mfi_add_ld to "immediate command" mode since we need to enumerate
potential boot disks during the probe so they are read for mount root.

Reviewed by:	ps, scottl
2006-06-30 18:59:08 +00:00
Paul Saab
e94bb9b26e Fix a potential problem when mfi_get_log_state and only
release a command if one was allocated.
Also release the command in mfi_shutdown.
2006-06-20 23:08:35 +00:00
Paul Saab
c0b332d17a Instead of using scsi probes to do device discovery, use the firmware
commands to grab the device listing.  This resolves issues using
multiple volumes, where each volume was actually internally pointing
to target 0.
2006-06-20 22:41:44 +00:00
Paul Saab
330df1ac0d Fix a typo when getting the log_state and set the flags on the
command to signify it is being polled and expecting data to be dma'd
from the card.
2006-06-20 22:17:54 +00:00
Paul Saab
fb595e7a9b Cleanup dcmd firmware processing into a single function, mfi_dcmd_command
to avoid duplication and mistakes when setting up firmware commands
for submission.

Reviewed by:	scottl
2006-06-20 21:06:05 +00:00
Paul Saab
83ff9c1304 Clean up some comments and device printf failures in mfi_get_log_state
and mfi_get_controller_info.
2006-06-20 20:41:54 +00:00
Paul Saab
b33484302d Remove two debugging printfs 2006-06-19 05:35:56 +00:00
Doug Ambrisko
c3a252361a Fix missing \n and when there are no arg's that means just print out
the description so we don't have to do any more queries.  Disable the
event query code until it figured out since but it is similar to the
AEN detail so we should be able to get that working.
2006-06-13 14:27:52 +00:00
Doug Ambrisko
741367d5a5 Add in a bunch of things to the mfi driver:
- Linux ioctl support, with the other Linux changes MegaCli
	will run if you mount linprocfs & linsysfs then set
	sysctl compat.linux.osrelease=2.6.12 or similar.  This works
	on i386.  It should work on amd64 but not well tested yet.
	StoreLib may or may not work.  Remember to kldload mfi_linux.
      - Add in AEN (Async Event Notification) support so we can
	get messages from the firmware when something happens.
	Not all messages are in defined in event detail.  Use
	event_log to try to figure out what happened.
      - Try to implement something like SIGIO for StoreLib.  Since
	mrmonitor doesn't work right I can't fully test it.  StoreLib
	works best with the rh9 base.  In theory mrmonitor isn't
	needed due to native driver support of AEN :-)
Now we can configure and monitor the RAID better.

Submitted by:	IronPort Systems.
2006-05-18 23:30:48 +00:00
Scott Long
d21c5e5e18 Fix some small bugs.
Submitted by: pjd
Found by: Coverity Prevent (tm)
2006-04-10 06:44:30 +00:00
Scott Long
aab582690e Fix 64-bit DMA. The problem was an incorrect flag check. Thanks to Paul
Saab for helping to track this down.  Fix a error with 32bit DMA size
calculation that seemed to be harmless.  Add a few micro-optimizations while
I'm here.
2006-03-28 23:59:07 +00:00
Scott Long
20df0de426 Handle invalid capacity parameters from the firmware. 2006-03-28 01:59:11 +00:00
Scott Long
2e21a3ef7e Add a driver for the new LSI MegaRAID SAS controller family. The 'MFI' name
is derived from the phrase 'MegaRAID Firmware Interface' used by LSI.  This
driver provides a block interface to logical disks on the card and a minimal
management device.  It is MPSAFE, INTR_FAST, and 64-bit capable.

Thanks to Dell for providing hardware to test with and IronPort for
sponsoring the work.

Sponsored by: Dell, Ironport
MFC After: 3 days
2006-03-25 06:14:32 +00:00