18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This file is part of the Chelsio T4 PCI-E SR-IOV Virtual Function Ethernet 38c2ecf20Sopenharmony_ci * driver for Linux. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2009-2010 Chelsio Communications, Inc. All rights reserved. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two 88c2ecf20Sopenharmony_ci * licenses. You may choose to be licensed under the terms of the GNU 98c2ecf20Sopenharmony_ci * General Public License (GPL) Version 2, available from the file 108c2ecf20Sopenharmony_ci * COPYING in the main directory of this source tree, or the 118c2ecf20Sopenharmony_ci * OpenIB.org BSD license below: 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or 148c2ecf20Sopenharmony_ci * without modification, are permitted provided that the following 158c2ecf20Sopenharmony_ci * conditions are met: 168c2ecf20Sopenharmony_ci * 178c2ecf20Sopenharmony_ci * - Redistributions of source code must retain the above 188c2ecf20Sopenharmony_ci * copyright notice, this list of conditions and the following 198c2ecf20Sopenharmony_ci * disclaimer. 208c2ecf20Sopenharmony_ci * 218c2ecf20Sopenharmony_ci * - Redistributions in binary form must reproduce the above 228c2ecf20Sopenharmony_ci * copyright notice, this list of conditions and the following 238c2ecf20Sopenharmony_ci * disclaimer in the documentation and/or other materials 248c2ecf20Sopenharmony_ci * provided with the distribution. 258c2ecf20Sopenharmony_ci * 268c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 278c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 288c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 298c2ecf20Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 308c2ecf20Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 318c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 328c2ecf20Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 338c2ecf20Sopenharmony_ci * SOFTWARE. 348c2ecf20Sopenharmony_ci */ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#ifndef __T4VF_DEFS_H__ 378c2ecf20Sopenharmony_ci#define __T4VF_DEFS_H__ 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#include "../cxgb4/t4_regs.h" 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* 428c2ecf20Sopenharmony_ci * The VF Register Map. 438c2ecf20Sopenharmony_ci * 448c2ecf20Sopenharmony_ci * The Scatter Gather Engine (SGE), Multiport Support module (MPS), PIO Local 458c2ecf20Sopenharmony_ci * bus module (PL) and CPU Interface Module (CIM) components are mapped via 468c2ecf20Sopenharmony_ci * the Slice to Module Map Table (see below) in the Physical Function Register 478c2ecf20Sopenharmony_ci * Map. The Mail Box Data (MBDATA) range is mapped via the PCI-E Mailbox Base 488c2ecf20Sopenharmony_ci * and Offset registers in the PF Register Map. The MBDATA base address is 498c2ecf20Sopenharmony_ci * quite constrained as it determines the Mailbox Data addresses for both PFs 508c2ecf20Sopenharmony_ci * and VFs, and therefore must fit in both the VF and PF Register Maps without 518c2ecf20Sopenharmony_ci * overlapping other registers. 528c2ecf20Sopenharmony_ci */ 538c2ecf20Sopenharmony_ci#define T4VF_SGE_BASE_ADDR 0x0000 548c2ecf20Sopenharmony_ci#define T4VF_MPS_BASE_ADDR 0x0100 558c2ecf20Sopenharmony_ci#define T4VF_PL_BASE_ADDR 0x0200 568c2ecf20Sopenharmony_ci#define T4VF_MBDATA_BASE_ADDR 0x0240 578c2ecf20Sopenharmony_ci#define T6VF_MBDATA_BASE_ADDR 0x0280 588c2ecf20Sopenharmony_ci#define T4VF_CIM_BASE_ADDR 0x0300 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define T4VF_REGMAP_START 0x0000 618c2ecf20Sopenharmony_ci#define T4VF_REGMAP_SIZE 0x0400 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci/* 648c2ecf20Sopenharmony_ci * There's no hardware limitation which requires that the addresses of the 658c2ecf20Sopenharmony_ci * Mailbox Data in the fixed CIM PF map and the programmable VF map must 668c2ecf20Sopenharmony_ci * match. However, it's a useful convention ... 678c2ecf20Sopenharmony_ci */ 688c2ecf20Sopenharmony_ci#if T4VF_MBDATA_BASE_ADDR != CIM_PF_MAILBOX_DATA_A 698c2ecf20Sopenharmony_ci#error T4VF_MBDATA_BASE_ADDR must match CIM_PF_MAILBOX_DATA_A! 708c2ecf20Sopenharmony_ci#endif 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* 738c2ecf20Sopenharmony_ci * Virtual Function "Slice to Module Map Table" definitions. 748c2ecf20Sopenharmony_ci * 758c2ecf20Sopenharmony_ci * This table allows us to map subsets of the various module register sets 768c2ecf20Sopenharmony_ci * into the T4VF Register Map. Each table entry identifies the index of the 778c2ecf20Sopenharmony_ci * module whose registers are being mapped, the offset within the module's 788c2ecf20Sopenharmony_ci * register set that the mapping should start at, the limit of the mapping, 798c2ecf20Sopenharmony_ci * and the offset within the T4VF Register Map to which the module's registers 808c2ecf20Sopenharmony_ci * are being mapped. All addresses and qualtities are in terms of 32-bit 818c2ecf20Sopenharmony_ci * words. The "limit" value is also in terms of 32-bit words and is equal to 828c2ecf20Sopenharmony_ci * the last address mapped in the T4VF Register Map 1 (i.e. it's a "<=" 838c2ecf20Sopenharmony_ci * relation rather than a "<"). 848c2ecf20Sopenharmony_ci */ 858c2ecf20Sopenharmony_ci#define T4VF_MOD_MAP(module, index, first, last) \ 868c2ecf20Sopenharmony_ci T4VF_MOD_MAP_##module##_INDEX = (index), \ 878c2ecf20Sopenharmony_ci T4VF_MOD_MAP_##module##_FIRST = (first), \ 888c2ecf20Sopenharmony_ci T4VF_MOD_MAP_##module##_LAST = (last), \ 898c2ecf20Sopenharmony_ci T4VF_MOD_MAP_##module##_OFFSET = ((first)/4), \ 908c2ecf20Sopenharmony_ci T4VF_MOD_MAP_##module##_BASE = \ 918c2ecf20Sopenharmony_ci (T4VF_##module##_BASE_ADDR/4 + (first)/4), \ 928c2ecf20Sopenharmony_ci T4VF_MOD_MAP_##module##_LIMIT = \ 938c2ecf20Sopenharmony_ci (T4VF_##module##_BASE_ADDR/4 + (last)/4), 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci#define SGE_VF_KDOORBELL 0x0 968c2ecf20Sopenharmony_ci#define SGE_VF_GTS 0x4 978c2ecf20Sopenharmony_ci#define MPS_VF_CTL 0x0 988c2ecf20Sopenharmony_ci#define MPS_VF_STAT_RX_VF_ERR_FRAMES_H 0xfc 998c2ecf20Sopenharmony_ci#define PL_VF_WHOAMI 0x0 1008c2ecf20Sopenharmony_ci#define CIM_VF_EXT_MAILBOX_CTRL 0x0 1018c2ecf20Sopenharmony_ci#define CIM_VF_EXT_MAILBOX_STATUS 0x4 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_cienum { 1048c2ecf20Sopenharmony_ci T4VF_MOD_MAP(SGE, 2, SGE_VF_KDOORBELL, SGE_VF_GTS) 1058c2ecf20Sopenharmony_ci T4VF_MOD_MAP(MPS, 0, MPS_VF_CTL, MPS_VF_STAT_RX_VF_ERR_FRAMES_H) 1068c2ecf20Sopenharmony_ci T4VF_MOD_MAP(PL, 3, PL_VF_WHOAMI, PL_VF_WHOAMI) 1078c2ecf20Sopenharmony_ci T4VF_MOD_MAP(CIM, 1, CIM_VF_EXT_MAILBOX_CTRL, CIM_VF_EXT_MAILBOX_STATUS) 1088c2ecf20Sopenharmony_ci}; 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci/* 1118c2ecf20Sopenharmony_ci * There isn't a Slice to Module Map Table entry for the Mailbox Data 1128c2ecf20Sopenharmony_ci * registers, but it's convenient to use similar names as above. There are 8 1138c2ecf20Sopenharmony_ci * little-endian 64-bit Mailbox Data registers. Note that the "instances" 1148c2ecf20Sopenharmony_ci * value below is in terms of 32-bit words which matches the "word" addressing 1158c2ecf20Sopenharmony_ci * space we use above for the Slice to Module Map Space. 1168c2ecf20Sopenharmony_ci */ 1178c2ecf20Sopenharmony_ci#define NUM_CIM_VF_MAILBOX_DATA_INSTANCES 16 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#define T4VF_MBDATA_FIRST 0 1208c2ecf20Sopenharmony_ci#define T4VF_MBDATA_LAST ((NUM_CIM_VF_MAILBOX_DATA_INSTANCES-1)*4) 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci#endif /* __T4T4VF_DEFS_H__ */ 123