/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/plat_ecc_dimm.h>
extern int plat_max_mc_units_per_board(void);
extern int plat_ecc_dispatch_task(plat_ecc_message_t *);
/* Platform specific function to get DIMM offset information */
/* Platform specific function to get dimm serial id information */
int (*p2get_mem_sid)(int, int, char *, int, int *);
/*
* offset into a physical address.
*/
/*
* Timeouts variable for determining when to give up waiting for a
* response from the SC. The value is in seconds and the default is
* based on the current default mailbox timeout used for Serengeti
* mailbox requests which is 30 seconds (Starcat uses a smaller value).
*/
/* Number of times to retries DIMM serial id requests */
static void plat_request_all_mem_sids(uint32_t);
int
{
int mcid;
if (p2get_mem_sid == NULL ||
return (ENOTSUP);
&jnumber) != 0)
return (EINVAL);
if (dimm < 0)
return (EINVAL);
}
int
{
if (p2get_mem_offset != NULL) {
} else
return (ENOTSUP);
}
int
{
int mcid;
if (p2get_mem_addr == NULL ||
return (ENOTSUP);
&jnumber) != 0)
return (EINVAL);
}
{
int i, bd, p;
*max_entries, KM_SLEEP);
for (i = 0; i < *max_entries; i++) {
bd = i / max_mc_per_bd;
p = i % max_mc_per_bd;
}
return (cache);
}
static void
{
int i, j;
/*
* There must be at least one dimm on the board for this
* code to be called.
*/
for (i = 0; i < max_mc_per_bd; i++) {
/*
* Each entry in the cache represents one mc.
* If state is not MC_DIMM_SIDS_REQUESTED, then that mc
* either has no DIMMs, is not present, or already has
* DIMM serial ids available from a previous call to this
* function.
*/
continue;
0xff;
/*
* Copy the valid DIMM serial ids. Each mc can have up to
* eight DIMMs.
*/
for (j = 0; j < 8; j++) {
if (((1 << j) & valid) == 0)
continue;
}
}
}
int
{
int i;
int bd;
for (i = 0; i < max_entries; i++) {
bd = i / max_mc_per_bd;
}
}
/*
* Wait for mailbox messages from SC.
* Keep track of elapsed time in order to avoid getting
* stuck here if something is wrong with the SC.
*/
"than the minimum value (%d secs). Resetting to "
"minimum.", plat_dimm_req_timeout,
}
start_lbolt = ddi_get_lbolt();
while (bds) {
continue;
/* Check elapsed time for possible timeout. */
if (elapsed_sec > plat_dimm_req_timeout) {
}
continue;
/* Record board# for possible retry */
break;
case PDSB_STATE_STORED:
/* Success! */
break;
default:
"domain_dimm_sids[%d]",
}
}
/*
* If there are still outstanding requests, delay for one half
* second to avoid excessive busy waiting.
*/
if (bds != 0)
}
if (max_retries-- && retry_bds) {
retry_bds = 0;
goto retry;
} else if (!max_retries && retry_bds) {
"boards 0x%x", retry_bds);
return (ETIMEDOUT);
}
return (0);
}
/*
* Functions for requesting DIMM serial id information from the SC and
* updating and storing it on the domain for use by the Memory Controller
* driver.
*/
/*
* Adds DIMM serial id data received from the SC to the domain_dimm_sids[]
* array. Called by the Serengeti and Starcat mailbox code that handles the
* reply message from the SC containing a plat_dimm_sid_board_data_t.
*/
int
{
int bd;
int i;
if (data->pdsbd_errno) {
data->pdsbd_errno);
return (data->pdsbd_errno);
}
for (i = 0; i < PLAT_MAX_DIMMS_PER_BOARD; i++) {
}
}
return (0);
}
/*
* Calls plat_request_mem_sids(bd) for each board number present in the domain.
* Called the first time the capability exchange is successful and the SC
* capability indicates support for providing DIMM serial ids.
*
* have at least one memory controller configured.
*/
static void
{
int bd;
int ret;
continue;
if (ret) {
}
}
}
/*
* Initiates a mailbox request to SC for DIMM serial ids for the specified
* called by plat_request_all_mem_sids().
*/
int
{
return (0);
/* Initialize the wrapper */
/* Fill the header */
/* Set board number DIMM serial ids are requested for */
/*
* Send the data on to the queuing function
*/
return (plat_ecc_dispatch_task(wrapperp));
}
/*
* Discards DIMM serial id information from domain_dimm_sids[]
* for a particular board.
*/
int
{
return (0);
}