fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Private functions from libsd.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_nvclean(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_gmem_data(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int nsc_gmem_sizes(int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Local functions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int _nsc_gmem(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void show_maps(char *, int);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext("usage: nscadm [-h] command\n"));
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext("valid commands:\n"));
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext(" freeze <device>\n"));
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext(" unfreeze <device>\n"));
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext(" isfrozen <device>\n"));
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext("nscadm: %s: not a valid device "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcoll(argv[optind], gettext("freeze")) == 0 ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (rc != 0) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext("nscadm: device <%s> is "
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(gettext("nscadm: device <%s> frozen\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (strcoll(argv[optind], gettext("unfreeze")) == 0 ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (rc == 0) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(gettext("nscadm: device <%s> unfrozen\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (strcoll(argv[optind], gettext("isfrozen")) == 0 ||
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(gettext("nscadm: device <%s> is %sfrozen\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (strcoll(argv[optind], gettext("nvclean")) == 0 ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (strcoll(argv[optind], gettext("nvclean_force")) == 0 ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* DEBUG */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (strcoll(argv[optind], gettext("gmem")) == 0 ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(gettext("Global map entries:\n"));
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(gettext("\nGlobal NVMEM map entries:\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED alignment of cast ok */
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki gettext("magic 0x%x ver %d size %d dirty (nvmem systems): %d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED alignment of cast ok */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rmap < (nsc_rmmap_t *)(addr + len); ++i, ++rmap) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncpy(tname, rmap->name, _NSC_MAXNAME);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%d:\tname %s\toffset 0x%x size 0x%x inuse 0x%x\n"),