2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _MEM_MDESC_H
2N/A#define _MEM_MDESC_H
2N/A
2N/A#include <fm/topo_mod.h>
2N/A#include <sys/fm/ldom.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#define MEM_DIMM_MAX 8 /* max FB DIMM depth */
2N/A
2N/A#ifndef MIN
2N/A#define MIN(x, y) ((x) < (y) ? (x) : (y))
2N/A#endif
2N/A
2N/A#ifndef MAX
2N/A#define MAX(x, y) ((x) > (y) ? (x) : (y))
2N/A#endif
2N/A
2N/Atypedef struct mem_dimm_map {
2N/A struct mem_dimm_map *dm_next; /* The next DIMM map */
2N/A char *dm_label; /* The UNUM for this DIMM */
2N/A char *dm_serid; /* Cached serial number */
2N/A char *dm_part; /* DIMM part number */
2N/A uint64_t dm_drgen; /* DR gen count for cached S/N */
2N/A} mem_dimm_map_t;
2N/A
2N/Atypedef struct mem_dimm_list {
2N/A struct mem_dimm_list *dl_next;
2N/A mem_dimm_map_t *dl_dimm;
2N/A} mem_dimm_list_t;
2N/A
2N/Atypedef struct mem_bank_map {
2N/A struct mem_bank_map *bm_next; /* the next bank map overall */
2N/A struct mem_bank_map *bm_grp; /* next bank map in group */
2N/A uint64_t bm_mask;
2N/A uint64_t bm_match;
2N/A uint16_t bm_shift; /* dimms-per-reference shift */
2N/A mem_dimm_list_t *bm_dlist;
2N/A} mem_bank_map_t;
2N/A
2N/Atypedef struct mem_grp {
2N/A struct mem_grp *mg_next;
2N/A size_t mg_size;
2N/A mem_bank_map_t *mg_bank;
2N/A} mem_grp_t;
2N/A
2N/Atypedef struct mem_seg_map {
2N/A struct mem_seg_map *sm_next; /* the next segment map */
2N/A uint64_t sm_base; /* base address for this segment */
2N/A uint64_t sm_size; /* size for this segment */
2N/A mem_grp_t *sm_grp;
2N/A} mem_seg_map_t;
2N/A
2N/Atypedef struct md_mem_info {
2N/A mem_dimm_map_t *mem_dm; /* List supported DIMMs */
2N/A/* uint64_t mem_memconfig; HV memory-configuration-id# */
2N/A mem_seg_map_t *mem_seg; /* list of defined segments */
2N/A mem_bank_map_t *mem_bank;
2N/A mem_grp_t *mem_group; /* groups of banks for a segment */
2N/A} md_mem_info_t;
2N/A
2N/Aextern int mem_mdesc_init(topo_mod_t *, md_mem_info_t *);
2N/Aextern void mem_mdesc_fini(topo_mod_t *, md_mem_info_t *);
2N/Aextern mem_dimm_map_t *mem_get_dimm_by_sn(char *, md_mem_info_t *);
2N/Aextern void *mem_alloc(size_t);
2N/Aextern void mem_free(void *, size_t);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _MEM_MDESC_H */