10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*362Sbg159949 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 280Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ 290Sstevel@tonic-gate /* All Rights Reserved */ 300Sstevel@tonic-gate 310Sstevel@tonic-gate /* 320Sstevel@tonic-gate * Copyrighted as an unpublished work. 330Sstevel@tonic-gate * (c) Copyright INTERACTIVE Systems Corporation 1986, 1988, 1990 340Sstevel@tonic-gate * All rights reserved. 350Sstevel@tonic-gate */ 360Sstevel@tonic-gate 370Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 380Sstevel@tonic-gate 390Sstevel@tonic-gate #include <stdio.h> 400Sstevel@tonic-gate #include <fcntl.h> 410Sstevel@tonic-gate #include <memory.h> 420Sstevel@tonic-gate #include <sys/types.h> 430Sstevel@tonic-gate #include <sys/param.h> 440Sstevel@tonic-gate #include <sys/stat.h> 450Sstevel@tonic-gate #include <sys/mkdev.h> 460Sstevel@tonic-gate #include <sys/vtoc.h> 470Sstevel@tonic-gate #include <sys/dkio.h> 480Sstevel@tonic-gate #include <errno.h> 490Sstevel@tonic-gate #include <sys/scsi/generic/commands.h> 500Sstevel@tonic-gate #include <sys/scsi/impl/commands.h> 510Sstevel@tonic-gate #include <sys/scsi/impl/uscsi.h> 520Sstevel@tonic-gate #include "badsec.h" 530Sstevel@tonic-gate 540Sstevel@tonic-gate char *devname; /* name of device */ 550Sstevel@tonic-gate int devfd; /* device file descriptor */ 560Sstevel@tonic-gate struct dk_geom dkg; /* geometry */ 570Sstevel@tonic-gate struct vtoc vtoc; /* table of contents */ 580Sstevel@tonic-gate char *progname; 590Sstevel@tonic-gate 600Sstevel@tonic-gate extern struct badsec_lst *badsl_chain; 610Sstevel@tonic-gate extern int badsl_chain_cnt; 620Sstevel@tonic-gate extern struct badsec_lst *gbadsl_chain; 630Sstevel@tonic-gate extern int gbadsl_chain_cnt; 640Sstevel@tonic-gate 650Sstevel@tonic-gate int alts_fd; 660Sstevel@tonic-gate 67*362Sbg159949 static void giveusage(void); 68*362Sbg159949 static void rd_gbad(FILE *badsecfd); 69*362Sbg159949 static void add_gbad(int badsec_entry); 70*362Sbg159949 71*362Sbg159949 int 72*362Sbg159949 main(int argc, char *argv[]) 730Sstevel@tonic-gate { 740Sstevel@tonic-gate extern int optind; 750Sstevel@tonic-gate extern char *optarg; 760Sstevel@tonic-gate 770Sstevel@tonic-gate static char options[] = "Ipa:f:"; 780Sstevel@tonic-gate char numbuf[100]; 790Sstevel@tonic-gate char *nxtarg; 800Sstevel@tonic-gate char *alts_name; 810Sstevel@tonic-gate minor_t minor_val; 820Sstevel@tonic-gate struct stat statbuf; 830Sstevel@tonic-gate struct partition *part = NULL; 840Sstevel@tonic-gate int alts_slice = -1; 850Sstevel@tonic-gate int l; 860Sstevel@tonic-gate int p; 870Sstevel@tonic-gate int init_flag = 0; 880Sstevel@tonic-gate int print_flag = 0; 890Sstevel@tonic-gate int c; 900Sstevel@tonic-gate int i; 910Sstevel@tonic-gate FILE *badsecfd = NULL; 920Sstevel@tonic-gate struct badsec_lst *blc_p; 930Sstevel@tonic-gate 940Sstevel@tonic-gate progname = argv[0]; 950Sstevel@tonic-gate while ( (c=getopt(argc, argv, options)) != EOF ) { 960Sstevel@tonic-gate switch (c) { 970Sstevel@tonic-gate case 'I': 980Sstevel@tonic-gate init_flag = 1; 990Sstevel@tonic-gate break; 1000Sstevel@tonic-gate case 'p': 1010Sstevel@tonic-gate print_flag = 1; 1020Sstevel@tonic-gate break; 1030Sstevel@tonic-gate case 'a': 1040Sstevel@tonic-gate nxtarg = optarg; 1050Sstevel@tonic-gate for (;*nxtarg != '\0';) 1060Sstevel@tonic-gate add_gbad(strtol(nxtarg, &nxtarg, 0)); 1070Sstevel@tonic-gate break; 1080Sstevel@tonic-gate case 'f': 1090Sstevel@tonic-gate if ((badsecfd = fopen(optarg, "r")) == NULL) { 1100Sstevel@tonic-gate fprintf(stderr, "%s: unable to open %s file\n", progname, optarg); 1110Sstevel@tonic-gate exit(1); 1120Sstevel@tonic-gate } 1130Sstevel@tonic-gate break; 1140Sstevel@tonic-gate default: 1150Sstevel@tonic-gate giveusage(); 1160Sstevel@tonic-gate exit(2); 1170Sstevel@tonic-gate } 1180Sstevel@tonic-gate } 1190Sstevel@tonic-gate 1200Sstevel@tonic-gate /* get the last argument -- device stanza */ 1210Sstevel@tonic-gate if (argc != optind+1) { 1220Sstevel@tonic-gate fprintf(stderr, "Missing disk device name\n"); 1230Sstevel@tonic-gate giveusage(); 1240Sstevel@tonic-gate exit(3); 1250Sstevel@tonic-gate } 1260Sstevel@tonic-gate devname = argv[optind]; 1270Sstevel@tonic-gate 1280Sstevel@tonic-gate if (stat(devname, &statbuf)) { 1290Sstevel@tonic-gate fprintf(stderr, "%s: invalid device %s, stat failed\n", progname, devname); 1300Sstevel@tonic-gate giveusage(); 1310Sstevel@tonic-gate exit(4); 1320Sstevel@tonic-gate } 1330Sstevel@tonic-gate if ((statbuf.st_mode & S_IFMT) != S_IFCHR) { 1340Sstevel@tonic-gate fprintf(stderr, "%s: device %s is not character special\n", progname, devname); 1350Sstevel@tonic-gate giveusage(); 1360Sstevel@tonic-gate exit(5); 1370Sstevel@tonic-gate } 1380Sstevel@tonic-gate minor_val = minor(statbuf.st_rdev); 1390Sstevel@tonic-gate /* 1400Sstevel@tonic-gate * NEED A DEFINE FOR THE PHYSICAL BIT (0x10) 1410Sstevel@tonic-gate */ 1420Sstevel@tonic-gate if ((minor_val & 0x10) == 0) { 1430Sstevel@tonic-gate fprintf(stderr, "%s: device %s is not a physical slice\n", progname, devname); 1440Sstevel@tonic-gate giveusage(); 1450Sstevel@tonic-gate exit(6); 1460Sstevel@tonic-gate } 1470Sstevel@tonic-gate if ((minor_val % V_NUMPAR) != 0) { 1480Sstevel@tonic-gate fprintf(stderr, "%s: device %s is not a slice 0 device\n", progname, devname); 1490Sstevel@tonic-gate giveusage(); 1500Sstevel@tonic-gate exit(7); 1510Sstevel@tonic-gate } 1520Sstevel@tonic-gate if ((devfd=open(devname, O_RDWR)) == -1) { 1530Sstevel@tonic-gate fprintf(stderr, "%s: open of %s failed\n", progname ,devname); 1540Sstevel@tonic-gate perror(""); 1550Sstevel@tonic-gate exit(8); 1560Sstevel@tonic-gate } 1570Sstevel@tonic-gate if ((ioctl (devfd, DKIOCGGEOM, &dkg)) == -1) { 1580Sstevel@tonic-gate fprintf(stderr, "%s: unable to get disk geometry.\n", progname); 1590Sstevel@tonic-gate perror(""); 1600Sstevel@tonic-gate exit(9); 1610Sstevel@tonic-gate } 1620Sstevel@tonic-gate 1630Sstevel@tonic-gate if (ioctl(devfd, DKIOCGVTOC, &vtoc) == -1) 1640Sstevel@tonic-gate { 1650Sstevel@tonic-gate fprintf(stderr, "%s: could not get VTOC.\n", progname); 1660Sstevel@tonic-gate giveusage(); 1670Sstevel@tonic-gate exit(14); 1680Sstevel@tonic-gate } 1690Sstevel@tonic-gate 1700Sstevel@tonic-gate if ((vtoc.v_sanity != VTOC_SANE) || (vtoc.v_version != V_VERSION)) { 1710Sstevel@tonic-gate fprintf(stderr, "%s: invalid VTOC found.\n", progname); 1720Sstevel@tonic-gate giveusage(); 1730Sstevel@tonic-gate exit(15); 1740Sstevel@tonic-gate } 1750Sstevel@tonic-gate if (badsecfd) 1760Sstevel@tonic-gate rd_gbad(badsecfd); 1770Sstevel@tonic-gate 1780Sstevel@tonic-gate #ifdef ADDBAD_DEBUG 1790Sstevel@tonic-gate printf("\n main: Total bad sectors found= %d\n", gbadsl_chain_cnt); 1800Sstevel@tonic-gate for (blc_p=gbadsl_chain; blc_p; blc_p=blc_p->bl_nxt) { 1810Sstevel@tonic-gate for (i=0; i<blc_p->bl_cnt; i++) 1820Sstevel@tonic-gate printf(" badsec=%d ", blc_p->bl_sec[i]); 1830Sstevel@tonic-gate } 1840Sstevel@tonic-gate printf("\n"); 1850Sstevel@tonic-gate #endif 1860Sstevel@tonic-gate #ifdef PPP 1870Sstevel@tonic-gate /* 1880Sstevel@tonic-gate * If init_flag is set, run to completion. 1890Sstevel@tonic-gate */ 1900Sstevel@tonic-gate if (gbadsl_chain_cnt == 0 && init_flag == 0) 1910Sstevel@tonic-gate /* 1920Sstevel@tonic-gate * No defects and not initializing 1930Sstevel@tonic-gate */ 1940Sstevel@tonic-gate exit (0); 1950Sstevel@tonic-gate #endif 1960Sstevel@tonic-gate if (gbadsl_chain_cnt != 0) 1970Sstevel@tonic-gate { 1980Sstevel@tonic-gate if (try_hw_remap () == SUCCESS) 1990Sstevel@tonic-gate exit (0); 2000Sstevel@tonic-gate } 2010Sstevel@tonic-gate /* 2020Sstevel@tonic-gate * get ALTS slice 2030Sstevel@tonic-gate */ 2040Sstevel@tonic-gate for (i = 0; i < V_NUMPAR && alts_slice == -1; i++) 2050Sstevel@tonic-gate { 2060Sstevel@tonic-gate if (vtoc.v_part[i].p_tag == V_ALTSCTR) 2070Sstevel@tonic-gate { 2080Sstevel@tonic-gate alts_slice = i; 2090Sstevel@tonic-gate part = &vtoc.v_part[i]; 2100Sstevel@tonic-gate } 2110Sstevel@tonic-gate } 2120Sstevel@tonic-gate if (alts_slice == -1) 2130Sstevel@tonic-gate { 2140Sstevel@tonic-gate fprintf(stderr, "%s: No alternates slice.\n", progname); 2150Sstevel@tonic-gate exit(16); 2160Sstevel@tonic-gate } 2170Sstevel@tonic-gate l = strlen (devname); 2180Sstevel@tonic-gate sprintf (numbuf, "%d", alts_slice); 2190Sstevel@tonic-gate p = strlen (numbuf); 2200Sstevel@tonic-gate alts_name = (char *)malloc (l + p); 2210Sstevel@tonic-gate strcpy (alts_name, devname); 2220Sstevel@tonic-gate alts_name[l - 2] = 's'; 2230Sstevel@tonic-gate strcpy (&alts_name[l - 1], numbuf); 2240Sstevel@tonic-gate alts_name[l + p - 1] = '\0'; 2250Sstevel@tonic-gate if ((alts_fd=open(alts_name, O_RDWR)) == -1) { 2260Sstevel@tonic-gate fprintf(stderr, "%s: open of %s failed\n", progname ,alts_name); 2270Sstevel@tonic-gate perror(""); 2280Sstevel@tonic-gate exit(9); 2290Sstevel@tonic-gate } 2300Sstevel@tonic-gate if (print_flag) 2310Sstevel@tonic-gate { 2320Sstevel@tonic-gate print_altsec (part); 2330Sstevel@tonic-gate exit (0); 2340Sstevel@tonic-gate } 2350Sstevel@tonic-gate updatebadsec(part, init_flag); 2360Sstevel@tonic-gate wr_altsctr(); 2370Sstevel@tonic-gate 2380Sstevel@tonic-gate if (ioctl(devfd, DKIOCADDBAD, NULL) == -1) { 2390Sstevel@tonic-gate fprintf(stderr, "Warning: DKIOCADDBAD io control failed. System must be re-booted\n"); 2400Sstevel@tonic-gate fprintf(stderr, "for alternate sectors to be usable.\n"); 2410Sstevel@tonic-gate exit(17); 2420Sstevel@tonic-gate } 2430Sstevel@tonic-gate sync(); 2440Sstevel@tonic-gate 2450Sstevel@tonic-gate fclose(badsecfd); 2460Sstevel@tonic-gate close (alts_fd); 2470Sstevel@tonic-gate close (devfd); 248*362Sbg159949 return(0); 2490Sstevel@tonic-gate } 2500Sstevel@tonic-gate 2510Sstevel@tonic-gate /* 2520Sstevel@tonic-gate * Giveusage () 2530Sstevel@tonic-gate * Give a (not so) concise message on how to use this program. 2540Sstevel@tonic-gate */ 255*362Sbg159949 static 256*362Sbg159949 void giveusage(void) 2570Sstevel@tonic-gate { 2580Sstevel@tonic-gate fprintf(stderr, "%s [-p] [-a sector] [-f filename] raw-device\n", progname); 2590Sstevel@tonic-gate fprintf(stderr, " p - Print existing bad block map\n"); 2600Sstevel@tonic-gate fprintf(stderr, " a - Add the given sectors to the bad block list\n"); 2610Sstevel@tonic-gate fprintf(stderr, " f - Add the sectors from <filename> to the bad block list\n"); 2620Sstevel@tonic-gate if (devfd) 2630Sstevel@tonic-gate close(devfd); 2640Sstevel@tonic-gate } 2650Sstevel@tonic-gate 2660Sstevel@tonic-gate 2670Sstevel@tonic-gate /* 2680Sstevel@tonic-gate * read in the additional growing bad sectors 2690Sstevel@tonic-gate */ 270*362Sbg159949 static void 271*362Sbg159949 rd_gbad(FILE *badsecfd) 2720Sstevel@tonic-gate { 2730Sstevel@tonic-gate int badsec_entry; 2740Sstevel@tonic-gate int status; 2750Sstevel@tonic-gate 2760Sstevel@tonic-gate status = fscanf(badsecfd, "%d", &badsec_entry); 2770Sstevel@tonic-gate while (status!=EOF) { 2780Sstevel@tonic-gate add_gbad(badsec_entry); 2790Sstevel@tonic-gate status = fscanf(badsecfd, "%d", &badsec_entry); 2800Sstevel@tonic-gate } 2810Sstevel@tonic-gate } 2820Sstevel@tonic-gate 283*362Sbg159949 static void 284*362Sbg159949 add_gbad(int badsec_entry) 2850Sstevel@tonic-gate { 2860Sstevel@tonic-gate struct badsec_lst *blc_p; 2870Sstevel@tonic-gate 2880Sstevel@tonic-gate if (!gbadsl_chain) { 2890Sstevel@tonic-gate blc_p = (struct badsec_lst *)malloc(BADSLSZ); 2900Sstevel@tonic-gate if (!blc_p) { 2910Sstevel@tonic-gate fprintf(stderr, "Unable to allocate memory for additional bad sectors\n"); 2920Sstevel@tonic-gate exit(18); 2930Sstevel@tonic-gate } 2940Sstevel@tonic-gate gbadsl_chain = blc_p; 2950Sstevel@tonic-gate blc_p->bl_cnt = 0; 2960Sstevel@tonic-gate blc_p->bl_nxt = 0; 2970Sstevel@tonic-gate } 2980Sstevel@tonic-gate for (blc_p = gbadsl_chain; blc_p->bl_nxt; ) 2990Sstevel@tonic-gate blc_p = blc_p->bl_nxt; 3000Sstevel@tonic-gate 3010Sstevel@tonic-gate if (blc_p->bl_cnt == MAXBLENT) { 3020Sstevel@tonic-gate blc_p->bl_nxt = (struct badsec_lst *)malloc(BADSLSZ); 3030Sstevel@tonic-gate if (!blc_p->bl_nxt) { 3040Sstevel@tonic-gate fprintf(stderr, "Unable to allocate memory for additional bad sectors\n"); 3050Sstevel@tonic-gate exit(19); 3060Sstevel@tonic-gate } 3070Sstevel@tonic-gate blc_p = blc_p->bl_nxt; 3080Sstevel@tonic-gate blc_p->bl_cnt = 0; 3090Sstevel@tonic-gate blc_p->bl_nxt = 0; 3100Sstevel@tonic-gate } 3110Sstevel@tonic-gate blc_p->bl_sec[blc_p->bl_cnt++] = badsec_entry; 3120Sstevel@tonic-gate gbadsl_chain_cnt++; 3130Sstevel@tonic-gate } 3140Sstevel@tonic-gate 3150Sstevel@tonic-gate /* 3160Sstevel@tonic-gate * Map a block using hardware (SCSI) techniques. 3170Sstevel@tonic-gate */ 3180Sstevel@tonic-gate /*ARGSUSED*/ 3190Sstevel@tonic-gate int 3200Sstevel@tonic-gate hardware_remap (bn) 3210Sstevel@tonic-gate int bn; 3220Sstevel@tonic-gate { 3230Sstevel@tonic-gate u_int byte_swap_32 (u_int); 3240Sstevel@tonic-gate u_short byte_swap_16 (u_short); 3250Sstevel@tonic-gate 3260Sstevel@tonic-gate struct uscsi_cmd ucmd; 3270Sstevel@tonic-gate union scsi_cdb cdb; 3280Sstevel@tonic-gate struct scsi_reassign_blk defect_list; 3290Sstevel@tonic-gate 3300Sstevel@tonic-gate /* 3310Sstevel@tonic-gate * Build and execute the uscsi ioctl 3320Sstevel@tonic-gate */ 3330Sstevel@tonic-gate (void) memset((char *)&ucmd, 0, sizeof (ucmd)); 3340Sstevel@tonic-gate (void) memset((char *)&cdb, 0, sizeof (union scsi_cdb)); 3350Sstevel@tonic-gate (void) memset((char *)&defect_list, 0, 3360Sstevel@tonic-gate sizeof (struct scsi_reassign_blk)); 3370Sstevel@tonic-gate cdb.scc_cmd = SCMD_REASSIGN_BLOCK; 3380Sstevel@tonic-gate ucmd.uscsi_cdb = (caddr_t) &cdb; 3390Sstevel@tonic-gate ucmd.uscsi_cdblen = CDB_GROUP0; 3400Sstevel@tonic-gate ucmd.uscsi_bufaddr = (caddr_t) &defect_list; 3410Sstevel@tonic-gate ucmd.uscsi_buflen = sizeof (struct scsi_reassign_blk); 3420Sstevel@tonic-gate defect_list.length = byte_swap_16 (sizeof (defect_list.defect)); 3430Sstevel@tonic-gate defect_list.defect = byte_swap_32 (bn); 3440Sstevel@tonic-gate /* 3450Sstevel@tonic-gate printf ("length - %x %x\n", sizeof (defect_list.defect), defect_list.length); 3460Sstevel@tonic-gate printf ("defect - %x %x\n", bn, defect_list.defect); 3470Sstevel@tonic-gate */ 3480Sstevel@tonic-gate /* 3490Sstevel@tonic-gate * Set function flags for driver. 3500Sstevel@tonic-gate */ 3510Sstevel@tonic-gate ucmd.uscsi_flags = USCSI_ISOLATE | USCSI_DIAGNOSE | USCSI_SILENT; 3520Sstevel@tonic-gate ucmd.uscsi_timeout = 30; /* 30 seconds */ 3530Sstevel@tonic-gate 3540Sstevel@tonic-gate /* 3550Sstevel@tonic-gate * Execute the ioctl 3560Sstevel@tonic-gate */ 3570Sstevel@tonic-gate if (ioctl(devfd, USCSICMD, &ucmd) == -1) 3580Sstevel@tonic-gate { 3590Sstevel@tonic-gate if (errno != ENOTTY) 3600Sstevel@tonic-gate { 3610Sstevel@tonic-gate perror ("SCSI hardware re-assign failed"); 3620Sstevel@tonic-gate /* 3630Sstevel@tonic-gate * It looks like a failure but by returning success 3640Sstevel@tonic-gate * the upper layer will not try to do 3650Sstevel@tonic-gate * software remapping. 3660Sstevel@tonic-gate */ 3670Sstevel@tonic-gate return (SUCCESS); 3680Sstevel@tonic-gate } 3690Sstevel@tonic-gate return (FAILURE); 3700Sstevel@tonic-gate } 3710Sstevel@tonic-gate return (SUCCESS); 3720Sstevel@tonic-gate } 3730Sstevel@tonic-gate 3740Sstevel@tonic-gate u_int 3750Sstevel@tonic-gate byte_swap_32 (u_int nav) 3760Sstevel@tonic-gate { 3770Sstevel@tonic-gate u_int rc; 3780Sstevel@tonic-gate rc = ((nav & 0xff000000) >> 24) | ((nav & 0x00ff0000) >> 8) | 3790Sstevel@tonic-gate ((nav & 0x0000ff00) << 8) | ((nav & 0x000000ff) << 24); 3800Sstevel@tonic-gate return (rc); 3810Sstevel@tonic-gate } 3820Sstevel@tonic-gate 3830Sstevel@tonic-gate u_short 3840Sstevel@tonic-gate byte_swap_16 (u_short niv) 3850Sstevel@tonic-gate { 3860Sstevel@tonic-gate u_short rc; 3870Sstevel@tonic-gate rc = (u_short)((int)(niv & 0xff00) >> 8) | ((niv & 0x00ff) << 8); 3880Sstevel@tonic-gate return (rc); 3890Sstevel@tonic-gate } 3900Sstevel@tonic-gate 391*362Sbg159949 int 3920Sstevel@tonic-gate try_hw_remap () 3930Sstevel@tonic-gate { 3940Sstevel@tonic-gate struct badsec_lst *blc_p; 3950Sstevel@tonic-gate int i; 3960Sstevel@tonic-gate 3970Sstevel@tonic-gate for (blc_p = gbadsl_chain; blc_p != 0; blc_p = blc_p->bl_nxt) 3980Sstevel@tonic-gate { 3990Sstevel@tonic-gate 4000Sstevel@tonic-gate for (i = 0; i < blc_p->bl_cnt; i++) 4010Sstevel@tonic-gate if (hardware_remap (blc_p->bl_sec[i]) == FAILURE) 4020Sstevel@tonic-gate return (FAILURE); 4030Sstevel@tonic-gate } 4040Sstevel@tonic-gate return (SUCCESS); 4050Sstevel@tonic-gate } 406