080575042aba2197b425ebfd52061dea061a9aa1xy * This file is provided under a CDDLv1 license. When using or
080575042aba2197b425ebfd52061dea061a9aa1xy * redistributing this file, you may do so under this license.
080575042aba2197b425ebfd52061dea061a9aa1xy * In redistributing this file this license must be included
080575042aba2197b425ebfd52061dea061a9aa1xy * and no other modification of this header file is permitted.
080575042aba2197b425ebfd52061dea061a9aa1xy * CDDL LICENSE SUMMARY
d5c3073dbbd835e1e9b7dca0c6c770cf3cc20afachenlu chen - Sun Microsystems - Beijing China * Copyright(c) 1999 - 2009 Intel Corporation. All rights reserved.
080575042aba2197b425ebfd52061dea061a9aa1xy * The contents of this file are subject to the terms of Version
080575042aba2197b425ebfd52061dea061a9aa1xy * 1.0 of the Common Development and Distribution License (the "License").
080575042aba2197b425ebfd52061dea061a9aa1xy * You should have received a copy of the License with this software.
080575042aba2197b425ebfd52061dea061a9aa1xy * You can obtain a copy of the License at
080575042aba2197b425ebfd52061dea061a9aa1xy * See the License for the specific language governing permissions
080575042aba2197b425ebfd52061dea061a9aa1xy * and limitations under the License.
3f64cd552fee350c8075ec62765e9a6f9caef1a8guoqing zhu - Sun Microsystems - Beijing China * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
080575042aba2197b425ebfd52061dea061a9aa1xy * Use is subject to license terms of the CDDLv1.
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi * Copyright 2016 Joyent, Inc.
080575042aba2197b425ebfd52061dea061a9aa1xyextern "C" {
4d7379630d53d9992780329b674af8c85935e858xiangtao you - Sun Microsystems - Beijing China#define msec_delay_irq msec_delay
4d7379630d53d9992780329b674af8c85935e858xiangtao you - Sun Microsystems - Beijing China#define false 0
4d7379630d53d9992780329b674af8c85935e858xiangtao you - Sun Microsystems - Beijing China#define true 1
4d7379630d53d9992780329b674af8c85935e858xiangtao you - Sun Microsystems - Beijing China#define ADAPTER_REG_SET 1 /* solaris mapping of adapter registers */
25f2d433de915875c8393f0b0dc14aa155997ad0xy#define ICH_FLASH_REG_SET 2 /* solaris mapping of flash memory */
ede5269ebe7fa3787cc9b58c3781b639c578f93dchenlu chen - Sun Microsystems - Beijing China#define E1000_MDALIGN_82546 65536
25f2d433de915875c8393f0b0dc14aa155997ad0xy/* PHY Extended Status Register */
25f2d433de915875c8393f0b0dc14aa155997ad0xy#define IEEE_ESR_1000T_HD_CAPS 0x1000 /* 1000T HD capable */
25f2d433de915875c8393f0b0dc14aa155997ad0xy#define IEEE_ESR_1000T_FD_CAPS 0x2000 /* 1000T FD capable */
25f2d433de915875c8393f0b0dc14aa155997ad0xy#define IEEE_ESR_1000X_HD_CAPS 0x4000 /* 1000X HD capable */
25f2d433de915875c8393f0b0dc14aa155997ad0xy#define IEEE_ESR_1000X_FD_CAPS 0x8000 /* 1000X FD capable */
592a4d85662412bade15f3d9e9e0cbcf8514348ccc * required by shared code
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu#define E1000_WRITE_FLUSH(a) (void)E1000_READ_REG(a, E1000_STATUS)
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi * Note, for all of the following register defines, it's important that these be
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi * in do {} while loops that only run a single time. Previously they were formed
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi * as normal blocks. Unfortunately this would fail in the following form which
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi * is used in the common code:
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi * E1000_WRITE_REG
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi * When the E1000_WRITE_REG macros was missing the do keyword, the compiler
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi * would end up associating the outer brace of the block with the if statement
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi * and thus the else clause would get left behind.
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu (uint32_t *)((uintptr_t)(hw)->hw_addr + reg), \
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu (uint32_t *)((uintptr_t)(hw)->hw_addr + reg)) : \
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu (uint32_t *)((uintptr_t)(hw)->hw_addr + reg + \
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu#define E1000_WRITE_REG_ARRAY_DWORD(a, reg, offset, value) \
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu#define E1000_READ_REG_ARRAY_DWORD(a, reg, offset) \
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu (uint32_t *)((uintptr_t)(hw)->flash_address + (reg)))
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu (uint16_t *)((uintptr_t)(hw)->flash_address + (reg)))
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu (uint32_t *)((uintptr_t)(hw)->flash_address + (reg)), (value))
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu (uint16_t *)((uintptr_t)(hw)->flash_address + (reg)), (value))
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu#define UNREFERENCED_1PARAMETER(_p) _NOTE(ARGUNUSED(_p))
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu#define UNREFERENCED_2PARAMETER(_p, _q) _NOTE(ARGUNUSED(_p, _q))
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu#define UNREFERENCED_3PARAMETER(_p, _q, _r) _NOTE(ARGUNUSED(_p, _q, _r))
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) _NOTE(ARGUNUSED(_p, _q, _r, _s))
fe62dec3a38f1f79ffe68417df75dbbb58135bb7Chen-Liang Xu#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) \
4d7379630d53d9992780329b674af8c85935e858xiangtao you - Sun Microsystems - Beijing Chinatypedef boolean_t bool;
d5c3073dbbd835e1e9b7dca0c6c770cf3cc20afachenlu chen - Sun Microsystems - Beijing China#define __le16 u16
d5c3073dbbd835e1e9b7dca0c6c770cf3cc20afachenlu chen - Sun Microsystems - Beijing China#define __le32 u32
d5c3073dbbd835e1e9b7dca0c6c770cf3cc20afachenlu chen - Sun Microsystems - Beijing China#define __le64 u64
3f64cd552fee350c8075ec62765e9a6f9caef1a8guoqing zhu - Sun Microsystems - Beijing China ddi_acc_handle_t io_reg_handle;
caf05df5c10c960028f122b1b02a3f7d8f892c31Miles Xu, Sun Microsystems/* Shared Code Mutex Defines */
caf05df5c10c960028f122b1b02a3f7d8f892c31Miles Xu, Sun Microsystems#define E1000_MUTEX_INIT(mutex) mutex_init(mutex, NULL, \
caf05df5c10c960028f122b1b02a3f7d8f892c31Miles Xu, Sun Microsystems#define E1000_MUTEX_DESTROY(mutex) mutex_destroy(mutex)
caf05df5c10c960028f122b1b02a3f7d8f892c31Miles Xu, Sun Microsystems#define E1000_MUTEX_LOCK(mutex) mutex_enter(mutex)
caf05df5c10c960028f122b1b02a3f7d8f892c31Miles Xu, Sun Microsystems#define E1000_MUTEX_TRYLOCK(mutex) mutex_tryenter(mutex)
caf05df5c10c960028f122b1b02a3f7d8f892c31Miles Xu, Sun Microsystems#define E1000_MUTEX_UNLOCK(mutex) mutex_exit(mutex)
080575042aba2197b425ebfd52061dea061a9aa1xy#ifdef __sparc /* on SPARC, use only memory-mapped routines */
080575042aba2197b425ebfd52061dea061a9aa1xy#else /* on x86, use port io routines */
3f64cd552fee350c8075ec62765e9a6f9caef1a8guoqing zhu - Sun Microsystems - Beijing China ddi_put32((OS_DEP(a))->io_reg_handle, \
3f64cd552fee350c8075ec62765e9a6f9caef1a8guoqing zhu - Sun Microsystems - Beijing China (uint32_t *)(a)->io_base, \
3f64cd552fee350c8075ec62765e9a6f9caef1a8guoqing zhu - Sun Microsystems - Beijing China ddi_put32((OS_DEP(a))->io_reg_handle, \
3f64cd552fee350c8075ec62765e9a6f9caef1a8guoqing zhu - Sun Microsystems - Beijing China (uint32_t *)((a)->io_base + 4), \
080575042aba2197b425ebfd52061dea061a9aa1xy#endif /* __sparc */
080575042aba2197b425ebfd52061dea061a9aa1xy#endif /* _E1000_OSDEP_H */