Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Add some definitions from OpenBSD, needed by the ...
details: https://anonhg.NetBSD.org/src/rev/92374dd09e87
branches: trunk
changeset: 837240:92374dd09e87
user: bouyer <bouyer%NetBSD.org@localhost>
date: Sat Nov 24 18:10:29 2018 +0000
description:
Add some definitions from OpenBSD, needed by the upcoming mfii driver.
No functionnal change.
diffstat:
sys/dev/ic/mfi.c | 20 ++++----
sys/dev/ic/mfireg.h | 109 +++++++++++++++++++++++++++++++++++++++++----------
2 files changed, 96 insertions(+), 33 deletions(-)
diffs (truncated from 312 to 300 lines):
diff -r 0b1690d86a01 -r 92374dd09e87 sys/dev/ic/mfi.c
--- a/sys/dev/ic/mfi.c Sat Nov 24 18:09:13 2018 +0000
+++ b/sys/dev/ic/mfi.c Sat Nov 24 18:10:29 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.59 2018/09/03 16:29:31 riastradh Exp $ */
+/* $NetBSD: mfi.c,v 1.60 2018/11/24 18:10:29 bouyer Exp $ */
/* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
/*
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.59 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.60 2018/11/24 18:10:29 bouyer Exp $");
#include "bio.h"
@@ -1879,7 +1879,7 @@
DNPRINTF(MFI_D_MISC, "%s: mfi_mgmt %#x\n", DEVNAME(ccb->ccb_sc), opc);
dcmd = &ccb->ccb_frame->mfr_dcmd;
- memset(dcmd->mdf_mbox, 0, MFI_MBOX_SIZE);
+ memset(dcmd->mdf_mbox.b, 0, MFI_MBOX_SIZE);
dcmd->mdf_header.mfh_cmd = MFI_CMD_DCMD;
dcmd->mdf_header.mfh_timeout = 0;
@@ -1893,7 +1893,7 @@
/* handle special opcodes */
if (mbox)
- memcpy(dcmd->mdf_mbox, mbox, MFI_MBOX_SIZE);
+ memcpy(dcmd->mdf_mbox.b, mbox, MFI_MBOX_SIZE);
if (dir != MFI_DATA_NONE) {
dcmd->mdf_header.mfh_data_len = len;
@@ -2017,7 +2017,7 @@
/* get figures */
cfg = malloc(sizeof *cfg, M_DEVBUF, M_WAITOK);
- if (mfi_mgmt_internal(sc, MD_DCMD_CONF_GET, MFI_DATA_IN,
+ if (mfi_mgmt_internal(sc, MR_DCMD_CONF_GET, MFI_DATA_IN,
sizeof *cfg, cfg, NULL, false))
goto freeme;
@@ -2141,7 +2141,7 @@
/* send single element command to retrieve size for full structure */
cfg = malloc(sizeof *cfg, M_DEVBUF, M_WAITOK);
- if (mfi_mgmt_internal(sc, MD_DCMD_CONF_GET, MFI_DATA_IN,
+ if (mfi_mgmt_internal(sc, MR_DCMD_CONF_GET, MFI_DATA_IN,
sizeof *cfg, cfg, NULL, false))
goto freeme;
@@ -2150,7 +2150,7 @@
/* memory for read config */
cfg = malloc(size, M_DEVBUF, M_WAITOK|M_ZERO);
- if (mfi_mgmt_internal(sc, MD_DCMD_CONF_GET, MFI_DATA_IN,
+ if (mfi_mgmt_internal(sc, MR_DCMD_CONF_GET, MFI_DATA_IN,
size, cfg, NULL, false))
goto freeme;
@@ -2400,7 +2400,7 @@
}
- if (mfi_mgmt_internal(sc, MD_DCMD_PD_SET_STATE, MFI_DATA_NONE,
+ if (mfi_mgmt_internal(sc, MR_DCMD_PD_SET_STATE, MFI_DATA_NONE,
0, NULL, mbox, false))
goto done;
@@ -2433,7 +2433,7 @@
/* send single element command to retrieve size for full structure */
cfg = malloc(sizeof *cfg, M_DEVBUF, M_WAITOK);
- if (mfi_mgmt_internal(sc, MD_DCMD_CONF_GET, MFI_DATA_IN,
+ if (mfi_mgmt_internal(sc, MR_DCMD_CONF_GET, MFI_DATA_IN,
sizeof *cfg, cfg, NULL, false))
goto freeme;
@@ -2442,7 +2442,7 @@
/* memory for read config */
cfg = malloc(size, M_DEVBUF, M_WAITOK|M_ZERO);
- if (mfi_mgmt_internal(sc, MD_DCMD_CONF_GET, MFI_DATA_IN,
+ if (mfi_mgmt_internal(sc, MR_DCMD_CONF_GET, MFI_DATA_IN,
size, cfg, NULL, false))
goto freeme;
diff -r 0b1690d86a01 -r 92374dd09e87 sys/dev/ic/mfireg.h
--- a/sys/dev/ic/mfireg.h Sat Nov 24 18:09:13 2018 +0000
+++ b/sys/dev/ic/mfireg.h Sat Nov 24 18:10:29 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mfireg.h,v 1.8 2012/09/19 21:24:29 bouyer Exp $ */
+/* $NetBSD: mfireg.h,v 1.9 2018/11/24 18:10:29 bouyer Exp $ */
/* $OpenBSD: mfireg.h,v 1.24 2006/06/19 19:05:45 marco Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco%peereboom.us@localhost>
@@ -182,12 +182,12 @@
((MEGASAS_THUNDERBOLT_NEW_MSG_SIZE - \
(sizeof(struct mfi_mpi2_request_raid_scsi_io) - sizeof(mpi2_sge_io_union))\
) / sizeof(mpi2_sge_io_union))
-
-/*
+
+/*
* (Command frame size allocaed in SRB ext - Raid SCSI IO message size)
- * / size of SGL ;
+ * / size of SGL ;
* (1280 - 256) / 16 = 64
- */
+ */
#define MEGASAS_THUNDERBOLT_MAX_SGE_IN_CHAINMSG \
((MR_COMMAND_SIZE - MEGASAS_THUNDERBOLT_NEW_MSG_SIZE) / \
sizeof(mpi2_sge_io_union))
@@ -234,8 +234,8 @@
#define MR_DCMD_PD_GET_LIST 0x02010000
#define MR_DCMD_PD_LIST_QUERY 0x02010100
#define MR_DCMD_PD_GET_INFO 0x02020000
-#define MD_DCMD_PD_SET_STATE 0x02030100
-#define MD_DCMD_PD_REBUILD 0x02040100
+#define MR_DCMD_PD_SET_STATE 0x02030100
+#define MR_DCMD_PD_REBUILD 0x02040100
#define MR_DCMD_PD_BLINK 0x02070100
#define MR_DCMD_PD_UNBLINK 0x02070200
#define MR_DCMD_LD_MAP_GET_INFO 0x0300e101
@@ -243,7 +243,12 @@
#define MR_DCMD_LD_GET_LIST 0x03010000
#define MR_DCMD_LD_GET_INFO 0x03020000
#define MR_DCMD_LD_GET_PROPERTIES 0x03030000
-#define MD_DCMD_CONF_GET 0x04010000
+#define MR_DCMD_CONF_GET 0x04010000
+#define MR_DCMD_CFG_ADD 0x04020000
+#define MR_DCMD_CFG_CLEAR 0x04030000
+#define MR_DCMD_CFG_MAKE_SPARE 0x04040000
+#define MR_DCMD_CFG_FOREIGN_SCAN 0x04060100
+#define MR_DCMD_CFG_FOREIGN_CLEAR 0x04060500
#define MR_DCMD_BBU_GET_STATUS 0x05010000
#define MR_DCMD_BBU_GET_CAPACITY_INFO 0x05020000
#define MR_DCMD_BBU_GET_DESIGN_INFO 0x05030000
@@ -260,6 +265,12 @@
/* mailbox bytes in direct command */
#define MFI_MBOX_SIZE 12
+union mfi_mbox {
+ uint8_t b[MFI_MBOX_SIZE];
+ uint16_t s[6];
+ uint32_t w[3];
+} __packed __aligned(4);
+
/* mfi completion codes */
typedef enum {
MFI_STAT_OK = 0x00,
@@ -370,9 +381,17 @@
/* XXX should be in mfi_evt_args ? */
#define MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED 0x0152
-#define MR_EVT_PD_REMOVED 0x0070
+#define MR_EVT_ARGS_PD_ADDRESS 0x1d
#define MR_EVT_PD_INSERTED 0x005b
+#define MR_EVT_PD_REMOVED 0x0070
+#define MR_EVT_PD_STATE_CHANGE 0x0072
#define MR_EVT_LD_CHANGE 0x0051
+#define MR_EVT_LD_CREATED 0x008a
+#define MR_EVT_LD_DELETED 0x008b
+#define MR_EVT_PD_REMOVED_EXT 0x00f8
+#define MR_EVT_PD_INSERTED_EXT 0x00f7
+
+
typedef enum {
MR_PD_QUERY_TYPE_ALL = 0,
@@ -493,7 +512,7 @@
struct mfi_dcmd_frame {
struct mfi_frame_header mdf_header;
uint32_t mdf_opcode;
- uint8_t mdf_mbox[MFI_MBOX_SIZE];
+ union mfi_mbox mdf_mbox;
union mfi_sgl mdf_sgl;
} __packed;
#define MFI_DCMD_MBOX_PEND_FLAG 0x1
@@ -573,6 +592,37 @@
uint8_t mep_slot_number;
} __packed;
+struct mfi_evtarg_pd_state {
+ struct mfi_evtarg_pd pd;
+ uint32_t prev_state;
+ uint32_t new_state;
+} __packed;
+
+struct mfi_evtarg_pd_address {
+ uint16_t device_id;
+ uint16_t encl_id;
+
+ union {
+ struct {
+ uint8_t encl_index;
+ uint8_t slot_number;
+ } __packed pd_address;
+ struct {
+ uint8_t encl_position;
+ uint8_t encl_connector_index;
+ } __packed encl_address;
+ } __packed address;
+
+ uint8_t scsi_dev_type;
+
+ union {
+ uint8_t port_bitmap;
+ uint8_t port_numbers;
+ } __packed connected;
+
+ uint64_t sas_addr[2];
+} __packed __aligned(8);
+
struct mfi_evt_detail {
uint32_t med_seq_num;
uint32_t med_time_stamp;
@@ -655,11 +705,7 @@
struct mfi_progress prog;
} __packed pd_prog;
- struct {
- struct mfi_evtarg_pd pd;
- uint32_t prev_state;
- uint32_t new_state;
- } __packed pd_state;
+ struct mfi_evtarg_pd_state pd_state;
struct {
uint16_t vendor_id;
@@ -682,6 +728,8 @@
char str[64];
} __packed ecc;
+ struct mfi_evtarg_pd_address pd_address;
+
uint8_t b[96];
uint16_t s[48];
uint32_t w[24];
@@ -1028,13 +1076,13 @@
u_quad_t mpa_sas_address[2];
} __packed;
-#define MAX_SYS_PDS 240
+#define MFI_MAX_PD 256
struct mfi_pd_list {
uint32_t mpl_size;
uint32_t mpl_no_pd;
- struct mfi_pd_address mpl_address[MAX_SYS_PDS];
+ struct mfi_pd_address mpl_address[MFI_MAX_PD];
} __packed;
-#define MFI_PD_LIST_SIZE (256 * sizeof(struct mfi_pd_address) + 8)
+#define MFI_PD_LIST_SIZE (sizeof(struct mfi_pd_list))
struct mfi_pd {
uint16_t mfp_id;
@@ -1175,7 +1223,7 @@
} __packed;
union mfi_bbu_status_detail {
- struct mfi_ibbu_state ibbu;
+ struct mfi_ibbu_state ibbu;
struct mfi_bbu_state bbu;
};
@@ -1200,6 +1248,21 @@
#define MFI_BBU_STATE_LEARN_CYC_FAIL (1 << 7)
#define MFI_BBU_STATE_LEARN_CYC_TIMEOUT (1 << 8)
#define MFI_BBU_STATE_I2C_ERR_DETECT (1 << 9)
+#define MFI_BBU_STATE_REPLACE_PACK (1 << 10)
+#define MFI_BBU_STATE_CAPACITY_LOW (1 << 11)
+#define MFI_BBU_STATE_LEARN_REQUIRED (1 << 12)
+#define MFI_BBU_STATE_BAD_IBBU ( \
+ MFI_BBU_STATE_PACK_MISSING | \
+ MFI_BBU_STATE_VOLTAGE_LOW | \
+ MFI_BBU_STATE_DISCHARGE_ACTIVE | \
+ MFI_BBU_STATE_LEARN_CYC_REQ | \
+ MFI_BBU_STATE_LEARN_CYC_ACTIVE | \
+ MFI_BBU_STATE_REPLACE_PACK | \
+ MFI_BBU_STATE_CAPACITY_LOW)
+#define MFI_BBU_STATE_BAD_BBU ( \
+ MFI_BBU_STATE_PACK_MISSING | \
+ MFI_BBU_STATE_REPLACE_PACK | \
+ MFI_BBU_STATE_CAPACITY_LOW)
uint8_t pad[20];
union mfi_bbu_status_detail detail;
} __packed;
@@ -1603,7 +1666,7 @@
uint64_t words;
};
-/*
+/*
* Request descriptor types
*/
#define MFI_REQ_DESCRIPT_FLAGS_LD_IO 0x7
@@ -1689,9 +1752,9 @@
Home |
Main Index |
Thread Index |
Old Index