/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "cprboot.h"
/*
* check if any cpd_t pages clash with the statefile buffer and shuffle
* buf pages to free space; since kpages are saved in ascending order,
* any buf pages preceding the current statefile buffer offset can be
* written because those pages have already been read and restored
*/
static void
{
/*
* set the lowest source buf ppn for the (precede) comparison
* below; the ORIG macro is used for the case where the src buf
* page had already been moved - and would confuse the compare
*/
/*
* if the dst page is outside the range of statefile
* buffer phys pages, it's OK to write that page;
* buf pages may have been moved outside the range,
* but only to locations isolated from any dst page
*/
continue;
}
/*
* the dst page is inside the range of buf ppns;
* dont need to move the buf page if the dst page
* precedes the lowest src buf page
*/
if (dst_ppn < low_src_ppn) {
continue;
}
/*
* the dst page clashes with the statefile buffer;
* move the buf page to a free location and update
* the buffer map
*/
new_ppn = find_apage();
}
}
/*
* map-in source statefile buffer pages (read-only) at CB_SRC_VIRT;
* sets the starting source vaddr with correct page offset
*/
static void
{
dtlb_index--;
off += MMU_PAGESIZE;
}
}
/*
*/
static void
{
dtlb_index--;
vaddr += MMU_PAGESIZE;
dst_ppn++;
}
}
/*
* run a checksum on un/compressed data when flag is set
*/
static int
{
return (0);
} else {
}
prom_printf("\n%scompressed data checksum error, "
return (ERR);
}
return (0);
}
/*
* primary kpage restoration routine
*/
static int
{
int raw;
#if defined(lint)
(void) compress(0, 0, 0);
#endif
/*
* move any source buf pages that clash with dst kernel pages;
* the dst kpages
*/
/*
* for compressed pages, run a checksum at the src vaddr and
* decompress to the mapped-in dst kpages; for uncompressed pages,
* just copy direct; uncompressed checksums are used for either
* uncompressed src data or decompressed result data
*/
return (ERR);
prom_printf("\nbad decompressed len %lu, size %lu\n",
return (ERR);
}
raw = 0;
} else {
raw = 1;
}
return (ERR);
if (raw)
/*
* advance past the kdata for this cpd_t
*/
return (0);
}
/*
* mapin part of the statefile buffer, copy to the virt destination,
* and advance the statefile buffer offset. this is used primarily
* to copy thousands of tiny cpd_t into aligned struct space.
*/
static void
{
}
/*
* clear leftover locked dtlb entries
*/
static void
dtlb_cleanup(void)
{
int dtlb_index;
if (TTE_IS_LOCKED(&tte)) {
}
}
}
/*
* before calling this routine, all cprboot phys pages
* are isolated from kernel pages; now we can restore
* kpages from the statefile buffer
*/
int
cb_restore_kpages(void)
{
char *str;
str = "cb_restore_kpages";
prom_printf("\nbad page magic 0x%x, expect 0x%x\n",
return (ERR);
}
if (restore_page_group(&desc))
return (ERR);
else
/*
* display a spin char for every 32 page groups
* (a full spin <= each MB restored)
*/
cb_spin();
}
dtlb_cleanup();
if (verbose) {
prom_printf("\npage stats: total %d, outside %d, "
prom_printf("page stats: ngroups %d, recycle %d\n",
}
"%s: total=%d, npages=%d, compressed=%d, regular=%d\n",
/*
* sanity check
*/
prom_printf("\n%s: page count mismatch, expect %d, got %d\n",
return (ERR);
}
return (0);
}
/*
* check and update the statefile terminator;
* on exit there will be a leftover tlb entry,
* but it will soon get replaced by restore_tlb()
*/
int
cb_terminator(void)
{
prom_printf("\nbad term magic 0x%x, expect 0x%x\n",
return (ERR);
}
return (0);
}