/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2002-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* send_file.c: to support firmware download (get fw S-records from the
* user-specified file and send S-records string down to the service processor
*/
#include <libintl.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "librsc.h"
#include "adm.h"
int
{
int LinesWritten;
int Status;
int BootRetry;
int LastRecord;
long FileLength = 0L;
long FilePos;
/*
* Determine the length of the file
*/
}
LinesWritten = 0;
LastRecord = 0;
(LastRecord == 0)) {
if ((ADM_Line[0] == 'S') &&
LastRecord = 1;
}
while (BootRetry > 0) {
if ((Status =
return (Status);
}
/*
* Initialize Timeout each time just to be robust.
* Since this operation is not time critical, this is
* not a concern.
*/
/* If we timeout, decrement BootRetry and try again */
/* We got a timeout */
continue;
} else {
/* we got a message back, see what it is */
LastRecord = 1;
break;
}
continue;
}
exit(-1);
}
/*
* We got a valid acknowledge, break out of
* loop and start to download next s-record
*/
break;
}
}
/* See if we ever got a response */
if (BootRetry <= 0) {
gettext("scadm: SC failed to respond during "
"download"));
exit(-1);
}
LinesWritten++;
if ((LinesWritten % 100) == 0) {
(void) printf(".");
}
if ((LinesWritten % 4000) == 0) {
if (FileLength) {
/* Show % progress */
(void) printf(" (%ld%%)",
}
(void) printf("\n");
}
}
/* Show final % progress (should normally be 100%) */
(void) printf(" (%ld%%)",
}
(void) printf("\n");
return (0);
}
void
{
if (cmd == BP_RSC_BOOTFAIL) {
if (dat1 == BP_DAT1_REJECTED) {
gettext("scadm: download rejected"));
} else if (dat1 == BP_DAT1_RANGE_ERR) {
gettext("scadm: download failed, "
"SC reported range error"));
} else if (dat1 == BP_DAT1_VERIFY_ERR) {
gettext("scadm: download failed, "
"SC reported verify error"));
} else if (dat1 == BP_DAT1_ERASE_ERR) {
gettext("scadm: download failed, "
"SC reported erase error"));
} else if (dat1 == BP_DAT1_INT_WP_ERR) {
gettext("scadm: download failed, "
"SC reported int_wp error"));
} else if (dat1 == BP_DAT1_WP_ERR) {
gettext("scadm: download failed, "
"SC reported wp error"));
} else if (dat1 == BP_DAT1_VPP_ERR) {
gettext("scadm: download failed, "
"SC reported vpp error"));
} else {
}
} else if (cmd == BP_RSC_BOOTACK) {
if (dat1 == BP_DAT1_SRECORD_ACK) {
gettext("scadm: download failed"));
} else {
}
} else {
}
}