/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * mtip32xx.h - Header file for the P320 SSD Block Driver * Copyright (C) 2011 Micron Technology, Inc. * * Portions of this code were derived from works subjected to the * following copyright: * Copyright (C) 2009 Integrated Device Technology, Inc. */ #ifndef __MTIP32XX_H__ #define __MTIP32XX_H__ #include <linux/spinlock.h> #include <linux/rwsem.h> #include <linux/ata.h> #include <linux/interrupt.h> /* Offset of Subsystem Device ID in pci confoguration space */ #define PCI_SUBSYSTEM_DEVICEID … /* offset of Device Control register in PCIe extended capabilites space */ #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET … /* check for erase mode support during secure erase */ #define MTIP_SEC_ERASE_MODE … /* # of times to retry timed out/failed IOs */ #define MTIP_MAX_RETRIES … /* Various timeout values in ms */ #define MTIP_NCQ_CMD_TIMEOUT_MS … #define MTIP_IOCTL_CMD_TIMEOUT_MS … #define MTIP_INT_CMD_TIMEOUT_MS … #define MTIP_QUIESCE_IO_TIMEOUT_MS … /* check for timeouts every 500ms */ #define MTIP_TIMEOUT_CHECK_PERIOD … /* ftl rebuild */ #define MTIP_FTL_REBUILD_OFFSET … #define MTIP_FTL_REBUILD_MAGIC … #define MTIP_FTL_REBUILD_TIMEOUT_MS … /* unaligned IO handling */ #define MTIP_MAX_UNALIGNED_SLOTS … /* Macro to extract the tag bit number from a tag value. */ #define MTIP_TAG_BIT(tag) … /* * Macro to extract the tag index from a tag value. The index * is used to access the correct s_active/Command Issue register based * on the tag value. */ #define MTIP_TAG_INDEX(tag) … /* * Maximum number of scatter gather entries * a single command may have. */ #define MTIP_MAX_SG … /* * Maximum number of slot groups (Command Issue & s_active registers) * NOTE: This is the driver maximum; check dd->slot_groups for actual value. */ #define MTIP_MAX_SLOT_GROUPS … /* Internal command tag. */ #define MTIP_TAG_INTERNAL … /* Micron Vendor ID & P320x SSD Device ID */ #define PCI_VENDOR_ID_MICRON … #define P320H_DEVICE_ID … #define P320M_DEVICE_ID … #define P320S_DEVICE_ID … #define P325M_DEVICE_ID … #define P420H_DEVICE_ID … #define P420M_DEVICE_ID … #define P425M_DEVICE_ID … /* Driver name and version strings */ #define MTIP_DRV_NAME … #define MTIP_DRV_VERSION … /* Maximum number of minor device numbers per device. */ #define MTIP_MAX_MINORS … /* Maximum number of supported command slots. */ #define MTIP_MAX_COMMAND_SLOTS … /* * Per-tag bitfield size in longs. * Linux bit manipulation functions * (i.e. test_and_set_bit, find_next_zero_bit) * manipulate memory in longs, so we try to make the math work. * take the slot groups and find the number of longs, rounding up. * Careful! i386 and x86_64 use different size longs! */ #define U32_PER_LONG … #define SLOTBITS_IN_LONGS … /* BAR number used to access the HBA registers. */ #define MTIP_ABAR … #ifdef DEBUG #define dbg_printk … #else #define dbg_printk(format, arg...) … #endif #define MTIP_DFS_MAX_BUF_SIZE … enum { … }; struct smart_attr { … } __packed; struct mtip_work { … } ____cacheline_aligned_in_smp; #define DEFINE_HANDLER(group) … /* Register Frame Information Structure (FIS), host to device. */ struct host_to_dev_fis { … }; /* Command header structure. */ struct mtip_cmd_hdr { … }; /* Command scatter gather structure (PRD). */ struct mtip_cmd_sg { … }; struct mtip_port; struct mtip_int_cmd; /* Structure used to describe a command. */ struct mtip_cmd { … }; /* Structure used to describe a port. */ struct mtip_port { … }; /* * Driver private data structure. * * One structure is allocated per probed device. */ struct driver_data { … }; #endif