mcamd_api.h revision 7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fe
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MCAMD_API_H
#define _MCAMD_API_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* routines not implemented there are required to be implemented in the
* kernel or userland consumer of this interface (such as the mc-amd driver).
* The common code must use the wrapper functions provided by the consumer
* to navigate the MC tree, get properties etc.
*/
#if defined(_KERNEL)
#else
#include <string.h>
#include <assert.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Consumers of this common code must implement the following types.
*/
typedef struct mcamd_node mcamd_node_t;
struct mcamd_hdl;
/*
* If changing the properties below be sure to propogate to mcamd_misc.c
* in common code, mcamd_subr.c in the mc-amd driver, and mcamd_prop.c
* from libmcamd.
*/
#define MCAMD_PROP_NUM 0
#define MCAMD_PROP_BASE_ADDR 1
#define MCAMD_PROP_LIM_ADDR 2
#define MCAMD_PROP_MASK 3
#define MCAMD_PROP_DRAM_ILEN 4
#define MCAMD_PROP_DRAM_ILSEL 5
#define MCAMD_PROP_DRAM_HOLE 6
#define MCAMD_PROP_DRAM_CONFIG 7
#define MCAMD_PROP_ACCESS_WIDTH 8
#define MCAMD_PROP_LODIMM 9
#define MCAMD_PROP_UPDIMM 10
#define MCAMD_PROP_CSBANKMAP 11
#define MCAMD_PROP_SIZE 12
#define MCAMD_PROP_CSBANK_INTLV 13
#define MCAMD_PROP_CS1 15
#define MCAMD_PROP_CS2 16
#define MCAMD_PROP_CS3 17
#define MCAMD_PROP_REV 18
#define MCAMD_PROP_DISABLED_CS 19
#define MCAMD_NUMPROPS 20
#define MCAMD_PROPSTR_NUM "num"
#define MCAMD_PROPSTR_BASE_ADDR "base-addr"
#define MCAMD_PROPSTR_LIM_ADDR "lim-addr"
#define MCAMD_PROPSTR_MASK "mask"
#define MCAMD_PROPSTR_DRAM_ILEN "dram-ilen"
#define MCAMD_PROPSTR_DRAM_ILSEL "dram-ilsel"
#define MCAMD_PROPSTR_DRAM_HOLE "dram-hole"
#define MCAMD_PROPSTR_DRAM_CONFIG "dram-config"
#define MCAMD_PROPSTR_ACCESS_WIDTH "access-width"
#define MCAMD_PROPSTR_LODIMM "lodimm-num"
#define MCAMD_PROPSTR_UPDIMM "updimm-num"
#define MCAMD_PROPSTR_CSBANKMAP "bank-mapping"
#define MCAMD_PROPSTR_SIZE "size"
#define MCAMD_PROPSTR_CSBANK_INTLV "csbank-intlv"
#define MCAMD_PROPSTR_CS0 "csnum0"
#define MCAMD_PROPSTR_CS1 "csnum1"
#define MCAMD_PROPSTR_CS2 "csnum2"
#define MCAMD_PROPSTR_CS3 "csnum3"
#define MCAMD_PROPSTR_REV "revision"
#define MCAMD_PROPSTR_DISABLED_CS "disabled-cs"
/*
* Flags for mcamd_dprintf
*/
#define MCAMD_DBG_ERR 0x1
#define MCAMD_DBG_FLOW 0x2
typedef union mcamd_dimm_offset_un mcamd_dimm_offset_un_t;
/*
* Offset definition. Encode everything in a single uint64_t, allowing some
* Some consumers will handle this as an opaque uint64 to be passed around,
* while others will want to look inside via the union defined below.
*/
#define MCAMD_OFFSET_VERSION_0 0x0
union mcamd_dimm_offset_un {
struct {
struct {
} lo;
struct {
} hi;
} _dou_hilo;
};
#define do_offset _dou_offset
/*
* The following work on an offset treated as a uint64_t.
*/
/*
* Value to be used to indicate an invalid offset.
*/
#define MCAMD_RC_INVALID_OFFSET 0x0
/*
* Routines provided by the common mcamd code.
*/
extern const char *mcamd_get_propname(uint_t);
uint64_t *);
uint_t *);
int *, int *);
extern void *mcamd_set_errno_ptr(struct mcamd_hdl *, int);
extern const char *mcamd_strerror(int);
extern const char *mcamd_errmsg(struct mcamd_hdl *);
/*
* Routines to be provided by wrapper code.
*/
mcamd_node_t *);
mcamd_node_t *);
mcamd_node_t *);
uint64_t *);
extern int mcamd_errno(struct mcamd_hdl *);
extern int mcamd_set_errno(struct mcamd_hdl *, int);
extern void mcamd_dprintf(struct mcamd_hdl *, int, const char *, ...);
#ifdef __cplusplus
}
#endif
#endif /* _MCAMD_API_H */