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