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.
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.
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]
23 * Copyright 2008 NetXen, Inc. All rights reserved.
24 * Use is subject to license terms.
36 /* Hardware memory size of 128 meg */
37 #define BAR0_SIZE (128 * 1024 * 1024)
39 * It can be calculated by looking at the first 1 bit of the BAR0 addr after
40 * bit 4 For us lets assume that BAR0 is D8000008, then the size is 0x8000000,
41 * 8 represents first bit containing 1. FSL temp notes....pg 162 of PCI
45 #define UNM_NIC_HW_BLOCK_WRITE_64(DATA_PTR, ADDR, NUM_WORDS) \
48 u64 *a = (u64 *) (DATA_PTR); \
49 u64 *b = (u64 *) (ADDR); \
51 for (i = 0; i < (NUM_WORDS); i++, a++, b++) { \
52 tmp = UNM_NIC_PCI_READ_64(a); \
53 UNM_NIC_PCI_WRITE_64(tmp, b); \
57 #define UNM_NIC_HW_BLOCK_READ_64(DATA_PTR, ADDR, NUM_WORDS) \
60 u64 *a = (u64 *) (DATA_PTR); \
61 u64 *b = (u64 *) (ADDR); \
63 for (i = 0; i < (NUM_WORDS); i++, a++, b++) { \
64 tmp = UNM_NIC_PCI_READ_64(b); \
65 UNM_NIC_PCI_WRITE_64(tmp, a); \
69 #define UNM_PCI_MAPSIZE_BYTES (UNM_PCI_MAPSIZE << 20)
71 #define UNM_NIC_LOCKED_READ_REG(X, Y) \
72 addr = (void *)(pci_base_offset(adapter, (X))); \
73 *(uint32_t *)(Y) = UNM_NIC_PCI_READ_32(addr);
75 #define UNM_NIC_LOCKED_WRITE_REG(X, Y) \
76 addr = (void *)(pci_base_offset(adapter, (X))); \
77 UNM_NIC_PCI_WRITE_32(*(uint32_t *)(Y), addr);
79 /* For Multicard support */
80 #define UNM_CRB_READ_VAL_ADAPTER(ADDR, ADAPTER) \
81 unm_crb_read_val_adapter((ADDR), (struct unm_adapter_s *)ADAPTER)
83 #define UNM_CRB_READ_CHECK_ADAPTER(ADDR, VALUE, ADAPTER) \
85 if (unm_crb_read_adapter(ADDR, VALUE, \
86 (struct unm_adapter_s *)ADAPTER)) return -1; \
89 #define UNM_CRB_WRITELIT_ADAPTER(ADDR, VALUE, ADAPTER) \
91 adapter->unm_crb_writelit_adapter( \
92 (struct unm_adapter_s *)ADAPTER, \
93 (unsigned long)ADDR, (int)VALUE); \
97 void unm_nic_set_link_parameters(struct unm_adapter_s
*adapter
);
98 long xge_mdio_init(struct unm_adapter_s
*adapter
);
99 void unm_nic_flash_print(struct unm_adapter_s
*adapter
);
100 void unm_nic_get_serial_num(struct unm_adapter_s
*adapter
);
107 } crb_128M_2M_sub_block_map_t
;
110 crb_128M_2M_sub_block_map_t sub_block
[16];
111 } crb_128M_2M_block_map_t
;
117 #endif /* _UNM_NIC_HW_ */