6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
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) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 #include "bge_impl.h"
27 #include <sys/sdt.h>
28 #include <sys/mac_provider.h>
29 #include <sys/mac.h>
30 #include <sys/mac_flow.h>
31
32 /*
33 * This is the string displayed by modinfo, etc.
34 */
35 static char bge_ident[] = "Broadcom Gb Ethernet";
36
37 /*
38 * Property names
39 */
40 static char debug_propname[] = "bge-debug-flags";
41 static char clsize_propname[] = "cache-line-size";
42 static char latency_propname[] = "latency-timer";
43 static char localmac_boolname[] = "local-mac-address?";
44 static char localmac_propname[] = "local-mac-address";
45 static char macaddr_propname[] = "mac-address";
3194 */
3195 bgep->chipid.device = pci_config_get16(bgep->cfg_handle,
3196 PCI_CONF_DEVID);
3197 value16 = pci_config_get16(bgep->cfg_handle, PCI_CONF_COMM);
3198 value16 = value16 | (PCI_COMM_MAE | PCI_COMM_ME);
3199 pci_config_put16(bgep->cfg_handle, PCI_CONF_COMM, value16);
3200 mhcrValue = MHCR_ENABLE_INDIRECT_ACCESS |
3201 MHCR_ENABLE_TAGGED_STATUS_MODE |
3202 MHCR_MASK_INTERRUPT_MODE |
3203 MHCR_MASK_PCI_INT_OUTPUT |
3204 MHCR_CLEAR_INTERRUPT_INTA |
3205 MHCR_ENABLE_ENDIAN_WORD_SWAP |
3206 MHCR_ENABLE_ENDIAN_BYTE_SWAP;
3207 /*
3208 * For some chipsets (e.g., BCM5718), if MHCR_ENABLE_ENDIAN_BYTE_SWAP
3209 * has been set in PCI_CONF_COMM already, we need to write the
3210 * byte-swapped value to it. So we just write zero first for simplicity.
3211 */
3212 if (DEVICE_5717_SERIES_CHIPSETS(bgep))
3213 pci_config_put32(bgep->cfg_handle, PCI_CONF_BGE_MHCR, 0);
3214 pci_config_put32(bgep->cfg_handle, PCI_CONF_BGE_MHCR, mhcrValue);
3215 bge_ind_put32(bgep, MEMORY_ARBITER_MODE_REG,
3216 bge_ind_get32(bgep, MEMORY_ARBITER_MODE_REG) |
3217 MEMORY_ARBITER_ENABLE);
3218 #else
3219 mhcrValue = pci_config_get32(bgep->cfg_handle, PCI_CONF_BGE_MHCR);
3220 #endif
3221 if (mhcrValue & MHCR_ENABLE_ENDIAN_WORD_SWAP) {
3222 bgep->asf_wordswapped = B_TRUE;
3223 } else {
3224 bgep->asf_wordswapped = B_FALSE;
3225 }
3226 bge_asf_get_config(bgep);
3227 #endif
3228 if (err != DDI_SUCCESS) {
3229 bge_problem(bgep, "pci_config_setup() failed");
3230 goto attach_fail;
3231 }
3232 bgep->progress |= PROGRESS_CFG;
3233 cidp = &bgep->chipid;
3234 bzero(cidp, sizeof (*cidp));
3235 bge_chip_cfg_init(bgep, cidp, B_FALSE);
3236 if (bge_check_acc_handle(bgep, bgep->cfg_handle) != DDI_FM_OK) {
3237 ddi_fm_service_impact(bgep->devinfo, DDI_SERVICE_LOST);
3238 goto attach_fail;
3239 }
3240
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
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) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 /*
27 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
28 */
29
30 #include "bge_impl.h"
31 #include <sys/sdt.h>
32 #include <sys/mac_provider.h>
33 #include <sys/mac.h>
34 #include <sys/mac_flow.h>
35
36 /*
37 * This is the string displayed by modinfo, etc.
38 */
39 static char bge_ident[] = "Broadcom Gb Ethernet";
40
41 /*
42 * Property names
43 */
44 static char debug_propname[] = "bge-debug-flags";
45 static char clsize_propname[] = "cache-line-size";
46 static char latency_propname[] = "latency-timer";
47 static char localmac_boolname[] = "local-mac-address?";
48 static char localmac_propname[] = "local-mac-address";
49 static char macaddr_propname[] = "mac-address";
3198 */
3199 bgep->chipid.device = pci_config_get16(bgep->cfg_handle,
3200 PCI_CONF_DEVID);
3201 value16 = pci_config_get16(bgep->cfg_handle, PCI_CONF_COMM);
3202 value16 = value16 | (PCI_COMM_MAE | PCI_COMM_ME);
3203 pci_config_put16(bgep->cfg_handle, PCI_CONF_COMM, value16);
3204 mhcrValue = MHCR_ENABLE_INDIRECT_ACCESS |
3205 MHCR_ENABLE_TAGGED_STATUS_MODE |
3206 MHCR_MASK_INTERRUPT_MODE |
3207 MHCR_MASK_PCI_INT_OUTPUT |
3208 MHCR_CLEAR_INTERRUPT_INTA |
3209 MHCR_ENABLE_ENDIAN_WORD_SWAP |
3210 MHCR_ENABLE_ENDIAN_BYTE_SWAP;
3211 /*
3212 * For some chipsets (e.g., BCM5718), if MHCR_ENABLE_ENDIAN_BYTE_SWAP
3213 * has been set in PCI_CONF_COMM already, we need to write the
3214 * byte-swapped value to it. So we just write zero first for simplicity.
3215 */
3216 if (DEVICE_5717_SERIES_CHIPSETS(bgep))
3217 pci_config_put32(bgep->cfg_handle, PCI_CONF_BGE_MHCR, 0);
3218 #else
3219 mhcrValue = MHCR_ENABLE_INDIRECT_ACCESS |
3220 MHCR_ENABLE_TAGGED_STATUS_MODE |
3221 MHCR_MASK_INTERRUPT_MODE |
3222 MHCR_MASK_PCI_INT_OUTPUT |
3223 MHCR_CLEAR_INTERRUPT_INTA;
3224 #endif
3225 pci_config_put32(bgep->cfg_handle, PCI_CONF_BGE_MHCR, mhcrValue);
3226 bge_ind_put32(bgep, MEMORY_ARBITER_MODE_REG,
3227 bge_ind_get32(bgep, MEMORY_ARBITER_MODE_REG) |
3228 MEMORY_ARBITER_ENABLE);
3229 if (mhcrValue & MHCR_ENABLE_ENDIAN_WORD_SWAP) {
3230 bgep->asf_wordswapped = B_TRUE;
3231 } else {
3232 bgep->asf_wordswapped = B_FALSE;
3233 }
3234 bge_asf_get_config(bgep);
3235 #endif
3236 if (err != DDI_SUCCESS) {
3237 bge_problem(bgep, "pci_config_setup() failed");
3238 goto attach_fail;
3239 }
3240 bgep->progress |= PROGRESS_CFG;
3241 cidp = &bgep->chipid;
3242 bzero(cidp, sizeof (*cidp));
3243 bge_chip_cfg_init(bgep, cidp, B_FALSE);
3244 if (bge_check_acc_handle(bgep, bgep->cfg_handle) != DDI_FM_OK) {
3245 ddi_fm_service_impact(bgep->devinfo, DDI_SERVICE_LOST);
3246 goto attach_fail;
3247 }
3248
|