xref: /OK3568_Linux_fs/kernel/Documentation/scsi/megaraid.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun==========================
4*4882a593SmuzhiyunNotes on Management Module
5*4882a593Smuzhiyun==========================
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunOverview
8*4882a593Smuzhiyun--------
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunDifferent classes of controllers from LSI Logic accept and respond to the
11*4882a593Smuzhiyunuser applications in a similar way. They understand the same firmware control
12*4882a593Smuzhiyuncommands. Furthermore, the applications also can treat different classes of
13*4882a593Smuzhiyunthe controllers uniformly. Hence it is logical to have a single module that
14*4882a593Smuzhiyuninterfaces with the applications on one side and all the low level drivers
15*4882a593Smuzhiyunon the other.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunThe advantages, though obvious, are listed for completeness:
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun	i.	Avoid duplicate code from the low level drivers.
20*4882a593Smuzhiyun	ii.	Unburden the low level drivers from having to export the
21*4882a593Smuzhiyun		character node device and related handling.
22*4882a593Smuzhiyun	iii.	Implement any policy mechanisms in one place.
23*4882a593Smuzhiyun	iv.	Applications have to interface with only module instead of
24*4882a593Smuzhiyun		multiple low level drivers.
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunCurrently this module (called Common Management Module) is used only to issue
27*4882a593Smuzhiyunioctl commands. But this module is envisioned to handle all user space level
28*4882a593Smuzhiyuninteractions. So any 'proc', 'sysfs' implementations will be localized in this
29*4882a593Smuzhiyuncommon module.
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunCredits
32*4882a593Smuzhiyun-------
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun::
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun	"Shared code in a third module, a "library module", is an acceptable
37*4882a593Smuzhiyun	solution. modprobe automatically loads dependent modules, so users
38*4882a593Smuzhiyun	running "modprobe driver1" or "modprobe driver2" would automatically
39*4882a593Smuzhiyun	load the shared library module."
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun- Jeff Garzik (jgarzik@pobox.com), 02.25.2004 LKML
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun::
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun	"As Jeff hinted, if your userspace<->driver API is consistent between
46*4882a593Smuzhiyun	your new MPT-based RAID controllers and your existing megaraid driver,
47*4882a593Smuzhiyun	then perhaps you need a single small helper module (lsiioctl or some
48*4882a593Smuzhiyun	better name), loaded by both mptraid and megaraid automatically, which
49*4882a593Smuzhiyun	handles registering the /dev/megaraid node dynamically. In this case,
50*4882a593Smuzhiyun	both mptraid and megaraid would register with lsiioctl for each
51*4882a593Smuzhiyun	adapter discovered, and lsiioctl would essentially be a switch,
52*4882a593Smuzhiyun	redirecting userspace tool ioctls to the appropriate driver."
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun- Matt Domsch, (Matt_Domsch@dell.com), 02.25.2004 LKML
55*4882a593Smuzhiyun
56*4882a593SmuzhiyunDesign
57*4882a593Smuzhiyun------
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunThe Common Management Module is implemented in megaraid_mm.[ch] files. This
60*4882a593Smuzhiyunmodule acts as a registry for low level hba drivers. The low level drivers
61*4882a593Smuzhiyun(currently only megaraid) register each controller with the common module.
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunThe applications interface with the common module via the character device
64*4882a593Smuzhiyunnode exported by the module.
65*4882a593Smuzhiyun
66*4882a593SmuzhiyunThe lower level drivers now understand only a new improved ioctl packet called
67*4882a593Smuzhiyunuioc_t. The management module converts the older ioctl packets from the older
68*4882a593Smuzhiyunapplications into uioc_t. After driver handles the uioc_t, the common module
69*4882a593Smuzhiyunwill convert that back into the old format before returning to applications.
70*4882a593Smuzhiyun
71*4882a593SmuzhiyunAs new applications evolve and replace the old ones, the old packet format
72*4882a593Smuzhiyunwill be retired.
73*4882a593Smuzhiyun
74*4882a593SmuzhiyunCommon module dedicates one uioc_t packet to each controller registered. This
75*4882a593Smuzhiyuncan easily be more than one. But since megaraid is the only low level driver
76*4882a593Smuzhiyuntoday, and it can handle only one ioctl, there is no reason to have more. But
77*4882a593Smuzhiyunas new controller classes get added, this will be tuned appropriately.
78