scsi: leapraid: Add new scsi driver
Subsystems (3)
Hao Dongdong
maintainerPATCH v6 1/1 scsi: leapraid: Add new scsi driver
The LeapRAID driver provides support for LeapRAID PCIe RAID controllers, enabling communication between the host operating system, firmware, and hardware for efficient storage management.
The main source files are organized as follows:
leapraid_os.c:
Implements the scsi_host_template functions, PCIe device probing, and initialization routines, integrating the driver with the Linux SCSI subsystem.
leapraid_func.c:
Provides the core functional routines that handle low-level interactions with the controller firmware and hardware, including interrupt handling, topology management, and reset sequence processing, and other related operations.
leapraid_app.c:
Implements the ioctl interface, providing user-space tools access to device management and diagnostic operations.
leapraid_transport.c:
Interacts with the Linux SCSI transport layer to add SAS phys and ports.
leapraid_func.h:
Declares common data structures, constants, and function prototypes shared across the driver.
leapraid.h:
Provides global constants, register mappings, and interface definitions that facilitate communication between the driver and the controller firmware.
The leapraid_probe function is called when the driver detects a supported LeapRAID PCIe device. It allocates and initializes the Scsi_Host structure, configures hardware and firmware interfaces, and registers the host adapter with the Linux SCSI mid-layer.
After registration, the driver invokes scsi_scan_host() to initiate device discovery. The firmware then reports discovered logical and physical devices to the host through interrupt-driven events and synchronizes their operational states.
leapraid_adapter is the core data structure that encapsulates all resources and runtime state information maintained during driver operation, described as follows:
/**
* struct leapraid_adapter - Main LeapRaid adapter structure
* @list: List head for adapter management
* @shost: SCSI host structure
* @pdev: PCI device structure
* @iomem_base: I/O memory mapped base address
* @rep_msg_host_idx: Host index for reply messages
* @mask_int: Interrupt masking flag
* @timestamp_sync_cnt: Timestamp synchronization counter
* @adapter_attr: Adapter attributes
* @mem_desc: Memory descriptor
* @driver_cmds: Driver commands
* @dynamic_task_desc: Dynamic task descriptor
* @fw_evt_s: Firmware event structure
* @notification_desc: Notification descriptor
* @reset_desc: Reset descriptor
* @scan_dev_desc: Device scan descriptor
* @access_ctrl: Access control
* @fw_log_desc: Firmware log descriptor
* @dev_topo: Device topology
* @boot_devs: Boot devices
* @smart_poll_desc: SMART polling descriptor
*/
struct leapraid_adapter {
struct list_head list;
struct Scsi_Host *shost;
struct pci_dev *pdev;
struct leapraid_reg_base __iomem *iomem_base;
u32 rep_msg_host_idx;
bool mask_int;
u32 timestamp_sync_cnt;
struct leapraid_adapter_attr adapter_attr;
struct leapraid_mem_desc mem_desc;
struct leapraid_driver_cmds driver_cmds;
struct leapraid_dynamic_task_desc dynamic_task_desc;
struct leapraid_fw_evt_struct fw_evt_s;
struct leapraid_notification_desc notification_desc;
struct leapraid_reset_desc reset_desc;
struct leapraid_scan_dev_desc scan_dev_desc;
struct leapraid_access_ctrl access_ctrl;
struct leapraid_fw_log_desc fw_log_desc;
struct leapraid_dev_topo dev_topo;
struct leapraid_boot_devs boot_devs;
struct leapraid_smart_poll_desc smart_poll_desc;
};Changes in v6:
- Add 16 debug logging registers.
- Enhance the logging subsystem.
- Link to v5: https://lore.kernel.org/all/[email protected]/
Changes in v5:
- sync driver version to firmware and verify FW revision
- add missing break in LEAPRAID_EVT_SCAN_DEV_DONE case
- Link to v4: https://lore.kernel.org/all/[email protected]/
Changes in v4:
- fix coding style issues across the LeapRAID driver
- refine commit messages and update leapraid.rst documentation
- Link to v3: https://lore.kernel.org/all/[email protected]/
Changes in v3:
- fix sparse warnings for writel() argument type mismatch
- Link to v2: https://lore.kernel.org/all/[email protected]/
Changes in v2:
- fix unused variable and undocumented struct member warnings
- refactor volume event handling and drive hotplug logic
- Link to v1: https://lore.kernel.org/all/[email protected]/
--- Documentation/scsi/index.rst | 1 + Documentation/scsi/leapraid.rst | 137 + MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/leapraid/Kconfig | 14 + drivers/scsi/leapraid/Makefile | 10 + drivers/scsi/leapraid/leapraid.h | 2070 +++++ drivers/scsi/leapraid/leapraid_app.c | 675 ++ drivers/scsi/leapraid/leapraid_func.c | 8264 ++++++++++++++++++++ drivers/scsi/leapraid/leapraid_func.h | 1424 ++++ drivers/scsi/leapraid/leapraid_os.c | 2368 ++++++ drivers/scsi/leapraid/leapraid_transport.c | 1256 +++ 13 files changed, 16228 insertions(+) create mode 100644 Documentation/scsi/leapraid.rst create mode 100644 drivers/scsi/leapraid/Kconfig create mode 100644 drivers/scsi/leapraid/Makefile create mode 100644 drivers/scsi/leapraid/leapraid.h create mode 100644 drivers/scsi/leapraid/leapraid_app.c create mode 100644 drivers/scsi/leapraid/leapraid_func.c create mode 100644 drivers/scsi/leapraid/leapraid_func.h create mode 100644 drivers/scsi/leapraid/leapraid_os.c create mode 100644 drivers/scsi/leapraid/leapraid_transport.c
Documentation/scsi/index.rst +1 -0
@@ -56,6 +56,7 @@ SCSI host adapter drivers g_NCR5380 hpsa hptiop + leapraid libsas lpfc megaraid
Documentation/scsi/leapraid.rst new file +137 -0
137 lines not on this page · raw message
MAINTAINERS +7 -0
@@ -14256,6 +14256,13 @@ S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening F: scripts/leaking_addresses.pl +LEAPIO SCSI RAID DRIVER +M: Hao Dongdong <[email protected]> +L: [email protected] +S: Supported +F: Documentation/scsi/leapraid.rst +F: drivers/scsi/leapraid/ + LED SUBSYSTEM M: Lee Jones <[email protected]> M: Pavel Machek <[email protected]>
drivers/scsi/Kconfig +1 -0
@@ -462,6 +462,7 @@ source "drivers/scsi/aic7xxx/Kconfig.aic79xx" source "drivers/scsi/aic94xx/Kconfig" source "drivers/scsi/hisi_sas/Kconfig" source "drivers/scsi/mvsas/Kconfig" +source "drivers/scsi/leapraid/Kconfig" config SCSI_MVUMI tristate "Marvell UMI driver"
drivers/scsi/Makefile +1 -0
@@ -152,6 +152,7 @@ obj-$(CONFIG_CHR_DEV_SCH) += ch.o obj-$(CONFIG_SCSI_ENCLOSURE) += ses.o obj-$(CONFIG_SCSI_HISI_SAS) += hisi_sas/ +obj-$(CONFIG_SCSI_LEAPRAID) += leapraid/ # This goes last, so that "real" scsi devices probe earlier obj-$(CONFIG_SCSI_DEBUG) += scsi_debug.o
drivers/scsi/leapraid/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +config SCSI_LEAPRAID + tristate "LeapIO RAID Adapter" + depends on PCI && SCSI + select SCSI_SAS_ATTRS + help + This driver supports LeapIO PCIe-based Storage + and RAID controllers. + + <http://www.leap-io.com> + + To compile this driver as a module, choose M here: the + resulting kernel module will be named leapraid.
drivers/scsi/leapraid/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for the LEAPRAID drivers. +# + +obj-$(CONFIG_SCSI_LEAPRAID) += leapraid.o +leapraid-objs += leapraid_func.o \ + leapraid_os.o \ + leapraid_transport.o \ + leapraid_app.o
drivers/scsi/leapraid/leapraid.h new file +2070 -0
2,070 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_app.c new file +675 -0
675 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_func.c new file +8264 -0
60 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_func.h new file +1424 -0
1,424 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_os.c new file +2368 -0
2,368 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_transport.c new file +1256 -0
1,256 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
--
2.25.1
Part of the diff is not shown here. View the raw message.