/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DRMACH_H_
#define _SYS_DRMACH_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASM
#include <sys/processor.h>
#include <sys/sbd_ioctl.h>
#include <sys/sysevent.h>
#include <sys/ddi_impldefs.h>
#endif
/*
* DR uses MAX_CORES_PER_CMP as number of virtual CPU within a CMP
*/
/* returned with drmach_board_find_devices callback */
/*
* dynamic memory blocks cannot be added back to phys_install
* safely if the alignment is smaller than the largest
* physical page size the OS supports. The VM subsystem
* will try to coalesce smaller pages together and
* it assumes that the page structures are contiguous.
* That assumption does not hold so we have to work around it.
* On OPL, the largest page size is 256MB so we can just
* add such memory block back. For everything else,
* we round them up to 4MB boundaries and make sure
* they are disjoint from phys_install.
*/
#ifndef _ASM
/*
* OPL platform specific routines currently only defined
* in opl.c and referenced by DR.
*/
typedef void *drmachid_t;
/*
* There are several requirements to do copy rename:
* once the copying has begun.
* 2 There should be no external memory access by the CPU
* during the memory rename programming.
*
* All data and instruction pages used in the copy rename
* procedure are kept in locked pages to satisfy 1 and 2.
* However that is not enough. To satisfy 2, we must keep
* all the data and instructions in the 2 assembly routines
* drmach_fmem_loop_script and drmach_fmem_exec_script
* in the same contiguous page. They are packed into
* the 2nd 8K page of the buffer as shown in the diagram
* below.
*
* Note that it is important to keep the "critical"
* data in one 8K page to avoid any cache line
* contention. The assembly routines read all the
* critical data into the cache so that there is no
* external memory access during FMEM operation.
*
* layout of the FMEM buffers:
* They are all locked in TLB and the critical data
* used in drmach_fmem_xxx assembly code are all
* packed in the second page.
*
* 1st 8k page
* +--------------------------------+
* |drmach_copy_rename_program_t |
* +--------------------------------+
* |drmach_copy_rename_data_t |
* | |
* +--------------------------------+
*
* 2nd 8k page
* +--------------------------------+
* |drmach_copy_rename_critical_t |
* | |
* +--------------------------------+
* |run (drmach_copy_rename_prog__relocatable)
* |(roundup boundary to 1K) |
* +--------------------------------+
* | fmem_script |
* |(roundup boundary to 1K) |
* +--------------------------------+
* |loop_script |
* | |
* +--------------------------------+
* |at least 1K NOP/0's |
* | |
* +--------------------------------+
*
* 3rd 8k page
* +--------------------------------+
* |memlist_buffer (free_mlist) |
* | |
* +--------------------------------+
*
* 4th 8k page - drmach_cr_stat_t.
*
*/
typedef struct {
typedef struct {
int op;
typedef struct {
int fmem_issued;
typedef struct {
void (*mc_resume)(void);
int (*scf_fmem_end)(void);
int (*scf_fmem_cancel)(void);
int copy_rename_count;
typedef struct {
typedef struct drmach_copy_rename_program {
#define DRMACH_FMEM_DATA_PAGE 0
typedef struct {
typedef struct {
int size;
char *copts;
typedef struct {
extern int drmach_board_is_floating(drmachid_t);
extern sbd_error_t *drmach_copy_rename_init(
drmachid_t *pgm_id);
int force);
extern void drmach_cpu_flush_ecache_sync(void);
int verbose);
extern void drmach_suspend_last();
extern void drmach_resume_first();
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DRMACH_H_ */