dimm_phys.h revision e4b86885570d77af552e9cf94f142f4d744fb8c8
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry/*
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * CDDL HEADER START
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry *
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * The contents of this file are subject to the terms of the
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * Common Development and Distribution License (the "License").
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * You may not use this file except in compliance with the License.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry *
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * or http://www.opensolaris.org/os/licensing.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * See the License for the specific language governing permissions
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * and limitations under the License.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry *
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * When distributing Covered Code, include this CDDL HEADER in each
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * If applicable, add the following below this CDDL HEADER, with the
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * fields enclosed by brackets "[]" replaced with your own identifying
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * information: Portions Copyright [yyyy] [name of copyright owner]
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry *
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * CDDL HEADER END
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry */
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry/*
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * Use is subject to license terms.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry */
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#ifndef _DIMM_PHYS_H
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#define _DIMM_PHYS_H
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#ifdef __cplusplus
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barryextern "C" {
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#endif
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#define OFFSET_ROW_BANK_COL 0x8000000000000000ULL
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#define OFFSET_RANK_SHIFT 52
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#define OFFSET_RAS_SHIFT 32
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#define OFFSET_BANK_SHIFT 24
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#define TCODE_OFFSET(rank, bank, ras, cas) (OFFSET_ROW_BANK_COL | \
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry ((uint64_t)(rank) << OFFSET_RANK_SHIFT) | \
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry ((uint64_t)(ras) << OFFSET_RAS_SHIFT) | \
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry ((uint64_t)(bank) << OFFSET_BANK_SHIFT) | (cas))
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#define TCODE_OFFSET_RANK(tcode) (((tcode) >> OFFSET_RANK_SHIFT) & RANK_MASK)
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#define TCODE_OFFSET_RAS(tcode) (((tcode) >> OFFSET_RAS_SHIFT) & RAS_MASK)
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#define TCODE_OFFSET_BANK(tcode) (((tcode) >> OFFSET_BANK_SHIFT) & BANK_MASK)
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#define TCODE_OFFSET_CAS(tcode) ((tcode) & CAS_MASK)
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barryextern void dimm_init(void);
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barryextern void dimm_fini(void);
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barryextern void dimm_add_rank(int, int, int, int, uint64_t, uint32_t, uint32_t,
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry int, uint64_t);
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barryextern void dimm_add_geometry(int, int, int, int, int, int);
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barryextern uint64_t dimm_getoffset(int, int, int, int, int);
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barryextern uint64_t dimm_getphys(int, int, int, int, int);
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#ifdef __cplusplus
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry}
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#endif
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#endif /* _DIMM_PHYS_H */
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry