29949e866e40b95795203f3ee46f44a197c946e4stevel * CDDL HEADER START
29949e866e40b95795203f3ee46f44a197c946e4stevel * The contents of this file are subject to the terms of the
29949e866e40b95795203f3ee46f44a197c946e4stevel * Common Development and Distribution License (the "License").
29949e866e40b95795203f3ee46f44a197c946e4stevel * You may not use this file except in compliance with the License.
29949e866e40b95795203f3ee46f44a197c946e4stevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
29949e866e40b95795203f3ee46f44a197c946e4stevel * See the License for the specific language governing permissions
29949e866e40b95795203f3ee46f44a197c946e4stevel * and limitations under the License.
29949e866e40b95795203f3ee46f44a197c946e4stevel * When distributing Covered Code, include this CDDL HEADER in each
29949e866e40b95795203f3ee46f44a197c946e4stevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
29949e866e40b95795203f3ee46f44a197c946e4stevel * If applicable, add the following below this CDDL HEADER, with the
29949e866e40b95795203f3ee46f44a197c946e4stevel * fields enclosed by brackets "[]" replaced with your own identifying
29949e866e40b95795203f3ee46f44a197c946e4stevel * information: Portions Copyright [yyyy] [name of copyright owner]
29949e866e40b95795203f3ee46f44a197c946e4stevel * CDDL HEADER END
85f5803819bea86c07827a9544494e4ad327d95ddp * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
29949e866e40b95795203f3ee46f44a197c946e4stevel * Use is subject to license terms.
29949e866e40b95795203f3ee46f44a197c946e4stevel#pragma ident "%Z%%M% %I% %E% SMI"
29949e866e40b95795203f3ee46f44a197c946e4stevel * Default to always clean memory on add to reduce chance
29949e866e40b95795203f3ee46f44a197c946e4stevel * of uncorrectable errors.
29949e866e40b95795203f3ee46f44a197c946e4stevel * Cannot add interleaved banks at the moment.
29949e866e40b95795203f3ee46f44a197c946e4stevel * Determine the physical location of the selected bank
29949e866e40b95795203f3ee46f44a197c946e4stevel if (ac_add_clean || mem_info->condition != SYSC_CFGA_COND_OK) {
29949e866e40b95795203f3ee46f44a197c946e4stevel * We need a page_va and a fill buffer for this operation
29949e866e40b95795203f3ee46f44a197c946e4stevel base_va = vmem_alloc(heap_arena, PAGESIZE, VM_SLEEP);
29949e866e40b95795203f3ee46f44a197c946e4stevel * zero fill the memory -- indirectly initializes the ECC
29949e866e40b95795203f3ee46f44a197c946e4stevel /* map current pa */
29949e866e40b95795203f3ee46f44a197c946e4stevel /* fill the target page */
29949e866e40b95795203f3ee46f44a197c946e4stevel /* tear down translation */
29949e866e40b95795203f3ee46f44a197c946e4stevel * clean up temporary resources
29949e866e40b95795203f3ee46f44a197c946e4stevel * give the memory to Solaris
29949e866e40b95795203f3ee46f44a197c946e4stevel errs = kphysm_add_memory_dynamic(base_pa >> PAGESHIFT,
29949e866e40b95795203f3ee46f44a197c946e4stevel * Add the board to the cage growth list.
85f5803819bea86c07827a9544494e4ad327d95ddp errs = kcage_range_add(btop(base_pa), btop(bank_size), KCAGE_DOWN);
29949e866e40b95795203f3ee46f44a197c946e4stevel /* TODO: deal with error return. */
29949e866e40b95795203f3ee46f44a197c946e4stevel cmn_err(CE_NOTE, "ac_add_bank(): board %d, bank %d, "
29949e866e40b95795203f3ee46f44a197c946e4stevel "kcage_range_add() returned %d",
29949e866e40b95795203f3ee46f44a197c946e4stevel return (0);
29949e866e40b95795203f3ee46f44a197c946e4stevel /* verify the board is of the correct type */
29949e866e40b95795203f3ee46f44a197c946e4stevel /* verify the memory condition is acceptable */
29949e866e40b95795203f3ee46f44a197c946e4stevel (!force && mem_info->condition != SYSC_CFGA_COND_OK)) {
29949e866e40b95795203f3ee46f44a197c946e4stevel * at this point, we have an available bank to add.
29949e866e40b95795203f3ee46f44a197c946e4stevel * mark it busy and initiate the add function.
29949e866e40b95795203f3ee46f44a197c946e4stevel * We made it! Update the status and get out of here.
29949e866e40b95795203f3ee46f44a197c946e4stevel if (retval == 0) {
29949e866e40b95795203f3ee46f44a197c946e4stevel if (retval != 0) {