Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Move registers definitions to a separate file, n...



details:   https://anonhg.NetBSD.org/src/rev/b22ca005c956
branches:  trunk
changeset: 837241:b22ca005c956
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sat Nov 24 18:11:22 2018 +0000

description:
Move registers definitions to a separate file, needed for the upcomning mpii
driver. No functionnal change.

diffstat:

 sys/dev/pci/mpii.c    |  1665 +------------------------------------------------
 sys/dev/pci/mpiireg.h |  1676 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1682 insertions(+), 1659 deletions(-)

diffs (truncated from 3376 to 300 lines):

diff -r 92374dd09e87 -r b22ca005c956 sys/dev/pci/mpii.c
--- a/sys/dev/pci/mpii.c        Sat Nov 24 18:10:29 2018 +0000
+++ b/sys/dev/pci/mpii.c        Sat Nov 24 18:11:22 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.12 2018/10/14 17:37:40 jdolecek Exp $ */
+/* $NetBSD: mpii.c,v 1.13 2018/11/24 18:11:22 bouyer Exp $ */
 /*     OpenBSD: mpii.c,v 1.51 2012/04/11 13:29:14 naddy Exp    */
 /*
  * Copyright (c) 2010 Mike Belopuhov <mkb%crypt.org.ru@localhost>
@@ -20,7 +20,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.12 2018/10/14 17:37:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.13 2018/11/24 18:11:22 bouyer Exp $");
 
 #include "bio.h"
 
@@ -44,1665 +44,13 @@
 #include <dev/scsipi/scsi_all.h>
 #include <dev/scsipi/scsiconf.h>
 
+#include <dev/pci/mpiireg.h>
+
+#if NBIO > 0
 #include <dev/biovar.h>
 #include <dev/sysmon/sysmonvar.h>
 #include <sys/envsys.h>
-
-#define MPII_DOORBELL                  (0x00)
-/* doorbell read bits */
-#define MPII_DOORBELL_STATE            (0xf<<28) /* ioc state */
-#define  MPII_DOORBELL_STATE_RESET     (0x0<<28)
-#define  MPII_DOORBELL_STATE_READY     (0x1<<28)
-#define  MPII_DOORBELL_STATE_OPER      (0x2<<28)
-#define  MPII_DOORBELL_STATE_FAULT     (0x4<<28)
-#define  MPII_DOORBELL_INUSE           (0x1<<27) /* doorbell used */
-#define MPII_DOORBELL_WHOINIT          (0x7<<24) /* last to reset ioc */
-#define  MPII_DOORBELL_WHOINIT_NOONE   (0x0<<24) /* not initialized */
-#define  MPII_DOORBELL_WHOINIT_SYSBIOS (0x1<<24) /* system bios */
-#define  MPII_DOORBELL_WHOINIT_ROMBIOS (0x2<<24) /* rom bios */
-#define  MPII_DOORBELL_WHOINIT_PCIPEER (0x3<<24) /* pci peer */
-#define  MPII_DOORBELL_WHOINIT_DRIVER  (0x4<<24) /* host driver */
-#define  MPII_DOORBELL_WHOINIT_MANUFACT        (0x5<<24) /* manufacturing */
-#define MPII_DOORBELL_FAULT            (0xffff<<0) /* fault code */
-/* doorbell write bits */
-#define MPII_DOORBELL_FUNCTION_SHIFT   (24)
-#define MPII_DOORBELL_FUNCTION_MASK    (0xff << MPII_DOORBELL_FUNCTION_SHIFT)
-#define MPII_DOORBELL_FUNCTION(x)      \
-    (((x) << MPII_DOORBELL_FUNCTION_SHIFT) & MPII_DOORBELL_FUNCTION_MASK)
-#define MPII_DOORBELL_DWORDS_SHIFT     16
-#define MPII_DOORBELL_DWORDS_MASK      (0xff << MPII_DOORBELL_DWORDS_SHIFT)
-#define MPII_DOORBELL_DWORDS(x)                \
-    (((x) << MPII_DOORBELL_DWORDS_SHIFT) & MPII_DOORBELL_DWORDS_MASK)
-#define MPII_DOORBELL_DATA_MASK                (0xffff)
-
-#define MPII_WRITESEQ                  (0x04)
-#define  MPII_WRITESEQ_KEY_VALUE_MASK  (0x0000000f) /* key value */
-#define  MPII_WRITESEQ_FLUSH           (0x00)
-#define  MPII_WRITESEQ_1               (0x0f)
-#define  MPII_WRITESEQ_2               (0x04)
-#define  MPII_WRITESEQ_3               (0x0b)
-#define  MPII_WRITESEQ_4               (0x02)
-#define  MPII_WRITESEQ_5               (0x07)
-#define  MPII_WRITESEQ_6               (0x0d)
-
-#define MPII_HOSTDIAG                  (0x08)
-#define  MPII_HOSTDIAG_BDS_MASK                (0x00001800) /* boot device select */
-#define   MPII_HOSTDIAG_BDS_DEFAULT    (0<<11) /* default address map, flash */
-#define   MPII_HOSTDIAG_BDS_HCDW       (1<<11) /* host code and data window */
-#define  MPII_HOSTDIAG_CLEARFBS                (1<<10) /* clear flash bad sig */
-#define  MPII_HOSTDIAG_FORCE_HCB_ONBOOT (1<<9) /* force host controlled boot */
-#define  MPII_HOSTDIAG_HCB_MODE                (1<<8)  /* host controlled boot mode */
-#define  MPII_HOSTDIAG_DWRE            (1<<7)  /* diag reg write enabled */
-#define  MPII_HOSTDIAG_FBS             (1<<6)  /* flash bad sig */
-#define  MPII_HOSTDIAG_RESET_HIST      (1<<5)  /* reset history */
-#define  MPII_HOSTDIAG_DIAGWR_EN       (1<<4)  /* diagnostic write enabled */
-#define  MPII_HOSTDIAG_RESET_ADAPTER   (1<<2)  /* reset adapter */
-#define  MPII_HOSTDIAG_HOLD_IOC_RESET  (1<<1)  /* hold ioc in reset */
-#define  MPII_HOSTDIAG_DIAGMEM_EN      (1<<0)  /* diag mem enable */
-
-#define MPII_DIAGRWDATA                        (0x10)
-
-#define MPII_DIAGRWADDRLOW             (0x14)
-
-#define MPII_DIAGRWADDRHIGH            (0x18)
-
-#define MPII_INTR_STATUS               (0x30)
-#define  MPII_INTR_STATUS_SYS2IOCDB    (1<<31) /* ioc written to by host */
-#define  MPII_INTR_STATUS_RESET                (1<<30) /* physical ioc reset */
-#define  MPII_INTR_STATUS_REPLY                (1<<3)  /* reply message interrupt */
-#define  MPII_INTR_STATUS_IOC2SYSDB    (1<<0)  /* ioc write to doorbell */
-
-#define MPII_INTR_MASK                 (0x34)
-#define  MPII_INTR_MASK_RESET          (1<<30) /* ioc reset intr mask */
-#define  MPII_INTR_MASK_REPLY          (1<<3)  /* reply message intr mask */
-#define  MPII_INTR_MASK_DOORBELL       (1<<0)  /* doorbell interrupt mask */
-
-#define MPII_DCR_DATA                  (0x38)
-
-#define MPII_DCR_ADDRESS               (0x3c)
-
-#define MPII_REPLY_FREE_HOST_INDEX     (0x48)
-
-#define MPII_REPLY_POST_HOST_INDEX     (0x6c)
-
-#define MPII_HCB_SIZE                  (0x74)
-
-#define MPII_HCB_ADDRESS_LOW           (0x78)
-#define MPII_HCB_ADDRESS_HIGH          (0x7c)
-
-#define MPII_REQ_DESCR_POST_LOW                (0xc0)
-#define MPII_REQ_DESCR_POST_HIGH       (0xc4)
-
-/*
- * Scatter Gather Lists
- */
-
-#define MPII_SGE_FL_LAST               (0x1<<31) /* last element in segment */
-#define MPII_SGE_FL_EOB                        (0x1<<30) /* last element of buffer */
-#define MPII_SGE_FL_TYPE               (0x3<<28) /* element type */
- #define MPII_SGE_FL_TYPE_SIMPLE       (0x1<<28) /* simple element */
- #define MPII_SGE_FL_TYPE_CHAIN                (0x3<<28) /* chain element */
- #define MPII_SGE_FL_TYPE_XACTCTX      (0x0<<28) /* transaction context */
-#define MPII_SGE_FL_LOCAL              (0x1<<27) /* local address */
-#define MPII_SGE_FL_DIR                        (0x1<<26) /* direction */
- #define MPII_SGE_FL_DIR_OUT           (0x1<<26)
- #define MPII_SGE_FL_DIR_IN            (0x0<<26)
-#define MPII_SGE_FL_SIZE               (0x1<<25) /* address size */
- #define MPII_SGE_FL_SIZE_32           (0x0<<25)
- #define MPII_SGE_FL_SIZE_64           (0x1<<25)
-#define MPII_SGE_FL_EOL                        (0x1<<24) /* end of list */
-
-struct mpii_sge {
-       u_int32_t               sg_hdr;
-       u_int32_t               sg_lo_addr;
-       u_int32_t               sg_hi_addr;
-} __packed;
-
-struct mpii_fw_tce {
-       u_int8_t                reserved1;
-       u_int8_t                context_size;
-       u_int8_t                details_length;
-       u_int8_t                flags;
-
-       u_int32_t               reserved2;
-
-       u_int32_t               image_offset;
-
-       u_int32_t               image_size;
-} __packed;
-
-/*
- * Messages
- */
-
-/* functions */
-#define MPII_FUNCTION_SCSI_IO_REQUEST                  (0x00)
-#define MPII_FUNCTION_SCSI_TASK_MGMT                   (0x01)
-#define MPII_FUNCTION_IOC_INIT                         (0x02)
-#define MPII_FUNCTION_IOC_FACTS                                (0x03)
-#define MPII_FUNCTION_CONFIG                           (0x04)
-#define MPII_FUNCTION_PORT_FACTS                       (0x05)
-#define MPII_FUNCTION_PORT_ENABLE                      (0x06)
-#define MPII_FUNCTION_EVENT_NOTIFICATION               (0x07)
-#define MPII_FUNCTION_EVENT_ACK                                (0x08)
-#define MPII_FUNCTION_FW_DOWNLOAD                      (0x09)
-#define MPII_FUNCTION_TARGET_CMD_BUFFER_POST           (0x0a)
-#define MPII_FUNCTION_TARGET_ASSIST                    (0x0b)
-#define MPII_FUNCTION_TARGET_STATUS_SEND               (0x0c)
-#define MPII_FUNCTION_TARGET_MODE_ABORT                        (0x0d)
-#define MPII_FUNCTION_FW_UPLOAD                                (0x12)
-
-#define MPII_FUNCTION_RAID_ACTION                      (0x15)
-#define MPII_FUNCTION_RAID_SCSI_IO_PASSTHROUGH         (0x16)
-
-#define MPII_FUNCTION_TOOLBOX                          (0x17)
-
-#define MPII_FUNCTION_SCSI_ENCLOSURE_PROCESSOR         (0x18)
-
-#define MPII_FUNCTION_SMP_PASSTHROUGH                  (0x1a)
-#define MPII_FUNCTION_SAS_IO_UNIT_CONTROL              (0x1b)
-#define MPII_FUNCTION_SATA_PASSTHROUGH                 (0x1c)
-
-#define MPII_FUNCTION_DIAG_BUFFER_POST                 (0x1d)
-#define MPII_FUNCTION_DIAG_RELEASE                     (0x1e)
-
-#define MPII_FUNCTION_TARGET_CMD_BUF_BASE_POST         (0x24)
-#define MPII_FUNCTION_TARGET_CMD_BUF_LIST_POST         (0x25)
-
-#define MPII_FUNCTION_IOC_MESSAGE_UNIT_RESET           (0x40)
-#define MPII_FUNCTION_IO_UNIT_RESET                    (0x41)
-#define MPII_FUNCTION_HANDSHAKE                                (0x42)
-
-/* Common IOCStatus values for all replies */
-#define MPII_IOCSTATUS_MASK                            (0x7fff)
-#define  MPII_IOCSTATUS_SUCCESS                                (0x0000)
-#define  MPII_IOCSTATUS_INVALID_FUNCTION               (0x0001)
-#define  MPII_IOCSTATUS_BUSY                           (0x0002)
-#define  MPII_IOCSTATUS_INVALID_SGL                    (0x0003)
-#define  MPII_IOCSTATUS_INTERNAL_ERROR                 (0x0004)
-#define  MPII_IOCSTATUS_INVALID_VPID                   (0x0005)
-#define  MPII_IOCSTATUS_INSUFFICIENT_RESOURCES         (0x0006)
-#define  MPII_IOCSTATUS_INVALID_FIELD                  (0x0007)
-#define  MPII_IOCSTATUS_INVALID_STATE                  (0x0008)
-#define  MPII_IOCSTATUS_OP_STATE_NOT_SUPPORTED         (0x0009)
-/* Config IOCStatus values */
-#define  MPII_IOCSTATUS_CONFIG_INVALID_ACTION          (0x0020)
-#define  MPII_IOCSTATUS_CONFIG_INVALID_TYPE            (0x0021)
-#define  MPII_IOCSTATUS_CONFIG_INVALID_PAGE            (0x0022)
-#define  MPII_IOCSTATUS_CONFIG_INVALID_DATA            (0x0023)
-#define  MPII_IOCSTATUS_CONFIG_NO_DEFAULTS             (0x0024)
-#define  MPII_IOCSTATUS_CONFIG_CANT_COMMIT             (0x0025)
-/* SCSIIO Reply initiator values */
-#define  MPII_IOCSTATUS_SCSI_RECOVERED_ERROR           (0x0040)
-#define  MPII_IOCSTATUS_SCSI_INVALID_DEVHANDLE         (0x0042)
-#define  MPII_IOCSTATUS_SCSI_DEVICE_NOT_THERE          (0x0043)
-#define  MPII_IOCSTATUS_SCSI_DATA_OVERRUN              (0x0044)
-#define  MPII_IOCSTATUS_SCSI_DATA_UNDERRUN             (0x0045)
-#define  MPII_IOCSTATUS_SCSI_IO_DATA_ERROR             (0x0046)
-#define  MPII_IOCSTATUS_SCSI_PROTOCOL_ERROR            (0x0047)
-#define  MPII_IOCSTATUS_SCSI_TASK_TERMINATED           (0x0048)
-#define  MPII_IOCSTATUS_SCSI_RESIDUAL_MISMATCH         (0x0049)
-#define  MPII_IOCSTATUS_SCSI_TASK_MGMT_FAILED          (0x004a)
-#define  MPII_IOCSTATUS_SCSI_IOC_TERMINATED            (0x004b)
-#define  MPII_IOCSTATUS_SCSI_EXT_TERMINATED            (0x004c)
-/* For use by SCSI Initiator and SCSI Target end-to-end data protection */
-#define  MPII_IOCSTATUS_EEDP_GUARD_ERROR               (0x004d)
-#define  MPII_IOCSTATUS_EEDP_REF_TAG_ERROR             (0x004e)
-#define  MPII_IOCSTATUS_EEDP_APP_TAG_ERROR             (0x004f)
-/* SCSI (SPI & FCP) target values */
-#define  MPII_IOCSTATUS_TARGET_INVALID_IO_INDEX                (0x0062)
-#define  MPII_IOCSTATUS_TARGET_ABORTED                 (0x0063)
-#define  MPII_IOCSTATUS_TARGET_NO_CONN_RETRYABLE       (0x0064)
-#define  MPII_IOCSTATUS_TARGET_NO_CONNECTION           (0x0065)
-#define  MPII_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH     (0x006a)
-#define  MPII_IOCSTATUS_TARGET_DATA_OFFSET_ERROR       (0x006d)
-#define  MPII_IOCSTATUS_TARGET_TOO_MUCH_WRITE_DATA     (0x006e)
-#define  MPII_IOCSTATUS_TARGET_IU_TOO_SHORT            (0x006f)
-#define  MPII_IOCSTATUS_TARGET_ACK_NAK_TIMEOUT         (0x0070)
-#define  MPII_IOCSTATUS_TARGET_NAK_RECEIVED            (0x0071)
-/* Serial Attached SCSI values */
-#define  MPII_IOCSTATUS_SAS_SMP_REQUEST_FAILED         (0x0090)
-#define  MPII_IOCSTATUS_SAS_SMP_DATA_OVERRUN           (0x0091)
-/* Diagnostic Tools values */
-#define  MPII_IOCSTATUS_DIAGNOSTIC_RELEASED            (0x00a0)
-
-#define MPII_REP_IOCLOGINFO_TYPE                       (0xf<<28)
-#define MPII_REP_IOCLOGINFO_TYPE_NONE                  (0x0<<28)
-#define MPII_REP_IOCLOGINFO_TYPE_SCSI                  (0x1<<28)
-#define MPII_REP_IOCLOGINFO_TYPE_FC                    (0x2<<28)
-#define MPII_REP_IOCLOGINFO_TYPE_SAS                   (0x3<<28)
-#define MPII_REP_IOCLOGINFO_TYPE_ISCSI                 (0x4<<28)
-#define MPII_REP_IOCLOGINFO_DATA                       (0x0fffffff)
-
-/* event notification types */
-#define MPII_EVENT_NONE                                        (0x00)
-#define MPII_EVENT_LOG_DATA                            (0x01)
-#define MPII_EVENT_STATE_CHANGE                                (0x02)
-#define MPII_EVENT_HARD_RESET_RECEIVED                 (0x05)
-#define MPII_EVENT_EVENT_CHANGE                                (0x0a)
-#define MPII_EVENT_TASK_SET_FULL                       (0x0e)
-#define MPII_EVENT_SAS_DEVICE_STATUS_CHANGE            (0x0f)
-#define MPII_EVENT_IR_OPERATION_STATUS                 (0x14)
-#define MPII_EVENT_SAS_DISCOVERY                       (0x16)
-#define MPII_EVENT_SAS_BROADCAST_PRIMITIVE             (0x17)
-#define MPII_EVENT_SAS_INIT_DEVICE_STATUS_CHANGE       (0x18)
-#define MPII_EVENT_SAS_INIT_TABLE_OVERFLOW             (0x19)
-#define MPII_EVENT_SAS_TOPOLOGY_CHANGE_LIST            (0x1c)
-#define MPII_EVENT_SAS_ENCL_DEVICE_STATUS_CHANGE       (0x1d)
-#define MPII_EVENT_IR_VOLUME                           (0x1e)
-#define MPII_EVENT_IR_PHYSICAL_DISK                    (0x1f)
-#define MPII_EVENT_IR_CONFIGURATION_CHANGE_LIST                (0x20)
-#define MPII_EVENT_LOG_ENTRY_ADDED                     (0x21)
-
-/* messages */
-
-#define MPII_WHOINIT_NOONE                             (0x00)
-#define MPII_WHOINIT_SYSTEM_BIOS                       (0x01)
-#define MPII_WHOINIT_ROM_BIOS                          (0x02)
-#define MPII_WHOINIT_PCI_PEER                          (0x03)
-#define MPII_WHOINIT_HOST_DRIVER                       (0x04)
-#define MPII_WHOINIT_MANUFACTURER                      (0x05)
-
-/* default messages */
-
-struct mpii_msg_request {
-       u_int8_t                reserved1;
-       u_int8_t                reserved2;
-       u_int8_t                chain_offset;
-       u_int8_t                function;
-
-       u_int8_t                reserved3;
-       u_int8_t                reserved4;
-       u_int8_t                reserved5;
-       u_int8_t                msg_flags;
-
-       u_int8_t                vp_id;
-       u_int8_t                vf_id;
-       u_int16_t               reserved6;



Home | Main Index | Thread Index | Old Index