mc-us3.h revision d00f0155af9a9a671eb08a0dc30f5ea0a379c36c
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_MC_US3_H
#define _SYS_MC_US3_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_KERNEL)
#define NBANKS 4
#define NDGRPS 2
#define NDIMMS 4
#define MAX_DEVLEN 8
#define TRANSFER_SIZE 64
#ifndef _ASM
struct mc_soft_state {
int portid;
int size;
void *memlayoutp;
};
struct dimm_info {
char sym_flag; /* 1: symmetric 0: asymmetric */
char data[1];
};
typedef char dimm_sid_t[DIMM_SERIAL_ID_LEN];
struct pin_info {
};
/* This struct is included at the following structs to set up list */
typedef struct mc_dlist {
int id;
} mc_dlist_t;
/* unique segment id */
struct seg_info {
int nbanks; /* The number of banks at this segment */
};
/* id = mc_id * nbanks + bank_no */
struct bank_info {
int local_id; /* unique local bank id per segment */
int seg_id; /* unique segment id */
int devgrp_id; /* unique device group id */
};
/* id = mc_id * ndevgrps + devgrp_no */
struct dgrp_info {
int ndevices; /* The number of available devices on this dev group */
};
/* id = id of dgrp_info * ndevices + device_no */
struct device_info {
char label[MAX_DEVLEN];
};
/* id = portid */
struct mctrl_info {
int ndevgrps; /* The number of dimm groups */
};
typedef struct dimm_sid_cache {
int mcid; /* mc portid */
int seg_id; /* segment these DIMMs are in */
int state; /* state of cache for this mc */
/* values for the state field of a dimm_sid_cache_t */
#define MC_DIMM_SIDS_INVALID 0
#define MC_DIMM_SIDS_REQUESTED 1
#define MC_DIMM_SIDS_AVAILABLE 2
extern int (*p2get_mem_unum)(int, uint64_t, char *, int, int *);
uint64_t *, int *, int *, int *);
extern int (*p2get_mem_sid)(int, int, char *, int, int *);
extern int (*p2init_sid_cache)(void);
extern void plat_add_mem_unum_label(char *, int, int, int);
extern dimm_sid_cache_t *plat_alloc_sid_cache(int *);
extern int plat_populate_sid_cache(dimm_sid_cache_t *, int);
#ifdef DEBUG
/* useful debugging level of DPRINTF */
#define MC_ATTACH_DEBUG 0x00000001
#define MC_DETACH_DEBUG 0x00000002
#define MC_CMD_DEBUG 0x00000004
#define MC_REG_DEBUG 0x00000008
#define MC_GUNUM_DEBUG 0x00000010
#define MC_CNSTRC_DEBUG 0x00000020
#define MC_DESTRC_DEBUG 0x00000040
#define MC_LIST_DEBUG 0x00000080
#define _PRINTF prom_printf
#else
#endif /* DEBUG */
#endif /* !_ASM */
/* Memory Address Decoding Registers */
#define ASI_MCU_CTRL 0x72
#define REGOFFSET 8
#define MADR0OFFSET 0x10
/* Mask and shift constants for Memory Address Decoding */
#define MADR_UPA_SHIFT 26
#define MADR_LPA_SHIFT 6
#define MADR_LK_SHIFT 14
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_MC_US3_H */