Print this page
MFV: illumos-omnios@aea0472ecb9ee91fa70556d6f6a941c10c989f1d
Add support for Emulex Corporation Lancer Gen6: LPe32000 FC Host Adapter
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
NEX-1878 update emlxs from source provided by Emulex


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at
   9  * http://www.opensource.org/licenses/cddl1.txt.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2004-2012 Emulex. All rights reserved.
  24  * Use is subject to license terms.

  25  */
  26 
  27 #define EMLXS_FW_TABLE_DEF
  28 #define EMLXS_MODEL_DEF
  29 
  30 #include <emlxs.h>
  31 
  32 /* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
  33 EMLXS_MSG_DEF(EMLXS_HBA_C);
  34 
  35 
  36 static void emlxs_handle_async_event(emlxs_hba_t *hba, CHANNEL *cp,
  37     IOCBQ *iocbq);
  38 
  39 static void emlxs_pci_cap_offsets(emlxs_hba_t *hba);
  40 
  41 #ifdef MSI_SUPPORT
  42 uint32_t emlxs_msi_map[EMLXS_MSI_MODES][EMLXS_MSI_MAX_INTRS] =
  43         {EMLXS_MSI_MAP1, EMLXS_MSI_MAP2, EMLXS_MSI_MAP4, EMLXS_MSI_MAP8};
  44 uint32_t emlxs_msi_mask[EMLXS_MSI_MODES] =


1993 
1994                 /* Read the PCI device id */
1995                 device_id =
1996                     ddi_get16(hba->pci_acc_handle,
1997                     (uint16_t *)(hba->pci_addr + PCI_DEVICE_ID_REGISTER));
1998 
1999                 /* Read the PCI Subsystem id */
2000                 ssdid =
2001                     ddi_get16(hba->pci_acc_handle,
2002                     (uint16_t *)(hba->pci_addr + PCI_SSDID_REGISTER));
2003 
2004                 if (ssdid == 0 || ssdid == 0xffff) {
2005                         ssdid = device_id;
2006                 }
2007 
2008                 /* Read the Cache Line reg */
2009                 cache_line =
2010                     ddi_get32(hba->pci_acc_handle,
2011                     (uint32_t *)(hba->pci_addr + PCI_CACHE_LINE_REGISTER));
2012 




2013                 /* Check for the multifunction bit being set */
2014                 if ((cache_line & 0x00ff0000) == 0x00800000) {
2015                         channels = EMLXS_MULTI_CHANNEL;
2016                 } else {
2017                         channels = EMLXS_SINGLE_CHANNEL;
2018                 }
2019 
2020                 /* If device ids are unique, then use them for search */
2021                 if (device_id != ssdid) {
2022                         /*
2023                          * Find matching adapter model using
2024                          * device_id, ssdid, and channels
2025                          */
2026                         for (i = 1; i < emlxs_pci_model_count; i++) {
2027                                 if (emlxs_pci_model[i].device_id ==
2028                                     device_id &&
2029                                     emlxs_pci_model[i].ssdid == ssdid &&
2030                                     emlxs_pci_model[i].channels ==
2031                                     channels) {
2032                                         bcopy(&emlxs_pci_model[i],




   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at
   9  * http://www.opensource.org/licenses/cddl1.txt.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2004-2012 Emulex. All rights reserved.
  24  * Use is subject to license terms.
  25  * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
  26  */
  27 
  28 #define EMLXS_FW_TABLE_DEF
  29 #define EMLXS_MODEL_DEF
  30 
  31 #include <emlxs.h>
  32 
  33 /* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
  34 EMLXS_MSG_DEF(EMLXS_HBA_C);
  35 
  36 
  37 static void emlxs_handle_async_event(emlxs_hba_t *hba, CHANNEL *cp,
  38     IOCBQ *iocbq);
  39 
  40 static void emlxs_pci_cap_offsets(emlxs_hba_t *hba);
  41 
  42 #ifdef MSI_SUPPORT
  43 uint32_t emlxs_msi_map[EMLXS_MSI_MODES][EMLXS_MSI_MAX_INTRS] =
  44         {EMLXS_MSI_MAP1, EMLXS_MSI_MAP2, EMLXS_MSI_MAP4, EMLXS_MSI_MAP8};
  45 uint32_t emlxs_msi_mask[EMLXS_MSI_MODES] =


1994 
1995                 /* Read the PCI device id */
1996                 device_id =
1997                     ddi_get16(hba->pci_acc_handle,
1998                     (uint16_t *)(hba->pci_addr + PCI_DEVICE_ID_REGISTER));
1999 
2000                 /* Read the PCI Subsystem id */
2001                 ssdid =
2002                     ddi_get16(hba->pci_acc_handle,
2003                     (uint16_t *)(hba->pci_addr + PCI_SSDID_REGISTER));
2004 
2005                 if (ssdid == 0 || ssdid == 0xffff) {
2006                         ssdid = device_id;
2007                 }
2008 
2009                 /* Read the Cache Line reg */
2010                 cache_line =
2011                     ddi_get32(hba->pci_acc_handle,
2012                     (uint32_t *)(hba->pci_addr + PCI_CACHE_LINE_REGISTER));
2013 
2014                 EMLXS_MSGF(EMLXS_CONTEXT,
2015                     &emlxs_init_debug_msg, "Device IDs: %x/%x/%x",
2016                     device_id, ssdid, cache_line);
2017 
2018                 /* Check for the multifunction bit being set */
2019                 if ((cache_line & 0x00ff0000) == 0x00800000) {
2020                         channels = EMLXS_MULTI_CHANNEL;
2021                 } else {
2022                         channels = EMLXS_SINGLE_CHANNEL;
2023                 }
2024 
2025                 /* If device ids are unique, then use them for search */
2026                 if (device_id != ssdid) {
2027                         /*
2028                          * Find matching adapter model using
2029                          * device_id, ssdid, and channels
2030                          */
2031                         for (i = 1; i < emlxs_pci_model_count; i++) {
2032                                 if (emlxs_pci_model[i].device_id ==
2033                                     device_id &&
2034                                     emlxs_pci_model[i].ssdid == ssdid &&
2035                                     emlxs_pci_model[i].channels ==
2036                                     channels) {
2037                                         bcopy(&emlxs_pci_model[i],