1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 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 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 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _NPI_ESPC_H 27 #define _NPI_ESPC_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 #include <npi.h> 36 #include <nxge_espc_hw.h> 37 38 #define EPC_WAIT_RW_COMP(handle, val_p, comp_bit) {\ 39 uint32_t cnt = MAX_PIO_RETRIES;\ 40 do {\ 41 NXGE_DELAY(EPC_RW_WAIT);\ 42 NXGE_REG_RD64(handle, ESPC_REG_ADDR(ESPC_PIO_STATUS_REG),\ 43 val_p); cnt--;\ 44 } while (((val & comp_bit) == 0) && (cnt > 0));\ 45 } 46 47 /* ESPC specific errors */ 48 49 #define ESPC_EEPROM_ADDR_INVALID 0x51 50 #define ESPC_STR_LEN_INVALID 0x91 51 52 /* ESPC error return macros */ 53 54 #define NPI_ESPC_EEPROM_ADDR_INVALID ((ESPC_BLK_ID << 8) |\ 55 ESPC_EEPROM_ADDR_INVALID) 56 #define NPI_ESPC_EEPROM_WRITE_FAILED ((ESPC_BLK_ID << 8) | WRITE_FAILED) 57 #define NPI_ESPC_EEPROM_READ_FAILED ((ESPC_BLK_ID << 8) | READ_FAILED) 58 #define NPI_ESPC_OPCODE_INVALID ((ESPC_BLK_ID << 8) | OPCODE_INVALID) 59 #define NPI_ESPC_STR_LEN_INVALID ((ESPC_BLK_ID << 8) |\ 60 ESPC_STR_LEN_INVALID) 61 #define NPI_ESPC_PORT_INVALID ((ESPC_BLK_ID << 8) | PORT_INVALID) 62 63 npi_status_t npi_espc_pio_enable(npi_handle_t); 64 npi_status_t npi_espc_pio_disable(npi_handle_t); 65 npi_status_t npi_espc_eeprom_entry(npi_handle_t, io_op_t, 66 uint32_t, uint8_t *); 67 npi_status_t npi_espc_mac_addr_get(npi_handle_t, uint8_t *); 68 npi_status_t npi_espc_num_ports_get(npi_handle_t, uint8_t *); 69 npi_status_t npi_espc_num_macs_get(npi_handle_t, uint8_t *); 70 npi_status_t npi_espc_model_str_get(npi_handle_t, char *); 71 npi_status_t npi_espc_bd_model_str_get(npi_handle_t, char *); 72 npi_status_t npi_espc_phy_type_get(npi_handle_t, uint8_t *); 73 npi_status_t npi_espc_port_phy_type_get(npi_handle_t, uint8_t *, 74 uint8_t); 75 npi_status_t npi_espc_max_frame_get(npi_handle_t, uint16_t *); 76 npi_status_t npi_espc_version_get(npi_handle_t, uint16_t *); 77 npi_status_t npi_espc_img_sz_get(npi_handle_t, uint16_t *); 78 npi_status_t npi_espc_chksum_get(npi_handle_t, uint8_t *); 79 npi_status_t npi_espc_intr_num_get(npi_handle_t, uint8_t *); 80 uint32_t npi_espc_reg_get(npi_handle_t, int); 81 void npi_espc_dump(npi_handle_t); 82 83 #ifdef __cplusplus 84 } 85 #endif 86 87 #endif /* _NPI_ESPC_H */ 88