- add "ll" modifier to printf.
- be more conscious about int type propagation. - add missing version and newvers.sh
This commit is contained in:
parent
b75de01970
commit
8c432abc24
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dsk.c,v 1.1 2011/01/23 01:05:30 nisimura Exp $ */
|
||||
/* $NetBSD: dsk.c,v 1.2 2011/01/23 01:32:08 nisimura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
@ -82,9 +82,9 @@ static void drive_ident(struct disk *, char *);
|
||||
static char *mkident(char *, int);
|
||||
static void set_xfermode(struct dkdev_ata *, int);
|
||||
static void decode_dlabel(struct disk *, char *);
|
||||
static int lba_read(struct disk *, uint64_t, uint32_t, void *);
|
||||
static void issue48(struct dvata_chan *, uint64_t, uint32_t);
|
||||
static void issue28(struct dvata_chan *, uint64_t, uint32_t);
|
||||
static int lba_read(struct disk *, int64_t, int, void *);
|
||||
static void issue48(struct dvata_chan *, int64_t, int);
|
||||
static void issue28(struct dvata_chan *, int64_t, int);
|
||||
static struct disk *lookup_disk(int);
|
||||
|
||||
static struct disk ldisk[4];
|
||||
@ -368,11 +368,11 @@ set_xfermode(struct dkdev_ata *l, int n)
|
||||
}
|
||||
|
||||
static int
|
||||
lba_read(struct disk *d, uint64_t bno, uint32_t bcnt, void *buf)
|
||||
lba_read(struct disk *d, int64_t bno, int bcnt, void *buf)
|
||||
{
|
||||
struct dkdev_ata *l;
|
||||
struct dvata_chan *chan;
|
||||
void (*issue)(struct dvata_chan *, uint64_t, uint32_t);
|
||||
void (*issue)(struct dvata_chan *, int64_t, int);
|
||||
int n, rdcnt, i, k;
|
||||
uint16_t *p;
|
||||
const char *err;
|
||||
@ -389,8 +389,7 @@ lba_read(struct disk *d, uint64_t bno, uint32_t bcnt, void *buf)
|
||||
(*issue)(chan, bno, rdcnt);
|
||||
for (k = 0; k < rdcnt; k++) {
|
||||
if (spinwait_unbusy(l, n, 1000, &err) == 0) {
|
||||
printf("%s blk %d %s\n",
|
||||
d->xname, (int)bno, err);
|
||||
printf("%s blk %lld %s\n", d->xname, bno, err);
|
||||
error = EIO;
|
||||
break;
|
||||
}
|
||||
@ -406,7 +405,7 @@ lba_read(struct disk *d, uint64_t bno, uint32_t bcnt, void *buf)
|
||||
}
|
||||
|
||||
static void
|
||||
issue48(struct dvata_chan *chan, uint64_t bno, uint32_t nblk)
|
||||
issue48(struct dvata_chan *chan, int64_t bno, int nblk)
|
||||
{
|
||||
|
||||
CSR_WRITE_1(chan->cmd + _NSECT, 0); /* always less than 256 */
|
||||
@ -422,7 +421,7 @@ issue48(struct dvata_chan *chan, uint64_t bno, uint32_t nblk)
|
||||
}
|
||||
|
||||
static void
|
||||
issue28(struct dvata_chan *chan, uint64_t bno, uint32_t nblk)
|
||||
issue28(struct dvata_chan *chan, int64_t bno, int nblk)
|
||||
{
|
||||
|
||||
CSR_WRITE_1(chan->cmd + _NSECT, nblk);
|
||||
@ -511,10 +510,10 @@ dsk_strategy(void *devdata, int rw, daddr_t dblk, size_t size,
|
||||
{
|
||||
struct disk *d = devdata;
|
||||
struct disklabel *dlp;
|
||||
uint64_t bno;
|
||||
int64_t bno;
|
||||
|
||||
#if 0
|
||||
printf("%s %d %d\n", d->xname, (int)dblk, size);
|
||||
printf("%s %lld %d\n", d->xname, dblk, size);
|
||||
#endif
|
||||
if (size == 0)
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: globals.h,v 1.1 2011/01/23 01:05:30 nisimura Exp $ */
|
||||
/* $NetBSD: globals.h,v 1.2 2011/01/23 01:32:08 nisimura Exp $ */
|
||||
|
||||
/* clock feed */
|
||||
#ifndef EXT_CLK_FREQ
|
||||
@ -186,7 +186,7 @@ struct disk {
|
||||
void *dlabel;
|
||||
int part;
|
||||
void *fsops;
|
||||
int (*lba_read)(struct disk *, uint64_t, uint32_t, void *);
|
||||
int (*lba_read)(struct disk *, int64_t, int, void *);
|
||||
};
|
||||
|
||||
int spinwait_unbusy(struct dkdev_ata *, int, int, const char **);
|
||||
|
16
sys/arch/sandpoint/stand/altboot/newvers.sh
Normal file
16
sys/arch/sandpoint/stand/altboot/newvers.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
# Usage: newvers.sh <historyrecord>
|
||||
#
|
||||
while read vers comment
|
||||
do
|
||||
version=$vers
|
||||
done < $1
|
||||
developer=${USER:-"releng"}
|
||||
[ -f /bin/hostname ] && buildhost=@`/bin/hostname`
|
||||
date=`date`
|
||||
|
||||
cat <<EoF >vers.c
|
||||
const char bootprog_rev[] = "$version";
|
||||
const char bootprog_date[] = "$date";
|
||||
const char bootprog_maker[] = "$developer$buildhost";
|
||||
EoF
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: printf.c,v 1.1 2011/01/23 01:05:30 nisimura Exp $ */
|
||||
/* $NetBSD: printf.c,v 1.2 2011/01/23 01:32:08 nisimura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
@ -40,7 +40,7 @@
|
||||
#define MAXSTR 80
|
||||
|
||||
static int _doprnt(void (*)(int), const char *, va_list);
|
||||
static void pr_int(unsigned long, int, char *);
|
||||
static void mkdigit(unsigned long long, int, char *);
|
||||
static void sputchar(int);
|
||||
|
||||
static char *sbuf, *ebuf;
|
||||
@ -89,22 +89,14 @@ snprintf(char *buf, size_t size, const char *fmt, ...)
|
||||
}
|
||||
|
||||
static int
|
||||
_doprnt(func, fmt, ap)
|
||||
void (*func)(int); /* Function to put a character */
|
||||
const char *fmt; /* Format string for pr_int/pr_float */
|
||||
va_list ap; /* Arguments to pr_int/pr_float */
|
||||
_doprnt(void (*func)(int), const char *fmt, va_list ap)
|
||||
{
|
||||
int i;
|
||||
char *str;
|
||||
char string[20];
|
||||
int length;
|
||||
int leftjust;
|
||||
int longflag;
|
||||
int fmax, fmin;
|
||||
int leading;
|
||||
int outcnt;
|
||||
char fill;
|
||||
char sign;
|
||||
int i, outcnt;
|
||||
char buf[23], *str; /* requires 23 digits in octal at most */
|
||||
int length, fmax, fmin, leading;
|
||||
int leftjust, llflag;
|
||||
char fill, sign;
|
||||
long long v;
|
||||
|
||||
outcnt = 0;
|
||||
while ((i = *fmt++) != '\0') {
|
||||
@ -141,15 +133,17 @@ _doprnt(func, fmt, ap)
|
||||
fmax = fmax * 10 + *fmt++ - '0';
|
||||
}
|
||||
}
|
||||
longflag = (*fmt == 'l');
|
||||
if (longflag)
|
||||
fmt++;
|
||||
llflag = 0;
|
||||
if (*fmt == 'l' && *++fmt == 'l') {
|
||||
llflag = 1;
|
||||
fmt += 1;
|
||||
}
|
||||
if ((i = *fmt++) == '\0') {
|
||||
(*func)('%');
|
||||
outcnt += 1;
|
||||
break;
|
||||
}
|
||||
str = string;
|
||||
str = buf;
|
||||
sign = ' ';
|
||||
switch (i) {
|
||||
case 'c':
|
||||
@ -165,36 +159,52 @@ _doprnt(func, fmt, ap)
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
{
|
||||
long l = va_arg(ap, long);
|
||||
if (l < 0) { sign = '-' ; l = -l; }
|
||||
pr_int((unsigned long)l, 10, str);
|
||||
}
|
||||
if (llflag)
|
||||
v = va_arg(ap, long long);
|
||||
else
|
||||
v = va_arg(ap, int);
|
||||
if (v < 0) {
|
||||
sign = '-' ; v = -v;
|
||||
}
|
||||
mkdigit((unsigned long long)v, 10, str);
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
pr_int(va_arg(ap, unsigned long), 10, str);
|
||||
if (llflag)
|
||||
v = va_arg(ap, long long);
|
||||
else
|
||||
v = va_arg(ap, int);
|
||||
mkdigit((unsigned long long)v, 10, str);
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
pr_int(va_arg(ap, unsigned long), 8, str);
|
||||
if (llflag)
|
||||
v = va_arg(ap, long long);
|
||||
else
|
||||
v = va_arg(ap, int);
|
||||
mkdigit((unsigned long long)v, 8, str);
|
||||
fmax = 0;
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
case 'x':
|
||||
pr_int(va_arg(ap, unsigned long), 16, str);
|
||||
if (llflag)
|
||||
v = va_arg(ap, long long);
|
||||
else
|
||||
v = va_arg(ap, int);
|
||||
mkdigit((unsigned long long)v, 16, str);
|
||||
fmax = 0;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
pr_int(va_arg(ap, unsigned long), 16, str);
|
||||
mkdigit(va_arg(ap, unsigned int), 16, str);
|
||||
fill = '0';
|
||||
fmin = 8;
|
||||
fmax = 0;
|
||||
(*func)('0'); (*func)('x');
|
||||
outcnt += 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
(*func)(i);
|
||||
break;
|
||||
@ -232,23 +242,24 @@ _doprnt(func, fmt, ap)
|
||||
return outcnt;
|
||||
}
|
||||
|
||||
static void pr_int(lval, base, s)
|
||||
unsigned long lval;
|
||||
int base;
|
||||
char *s;
|
||||
|
||||
static void
|
||||
mkdigit(unsigned long long llval, int base, char *s)
|
||||
{
|
||||
char ptmp[12]; /* unsigned long requires 11 digit in octal form */
|
||||
int i;
|
||||
char *t = ptmp;
|
||||
char ptmp[23], *t; /* requires 22 digit in octal at most */
|
||||
int n;
|
||||
static const char hexdigit[] = "0123456789abcdef";
|
||||
|
||||
i = 1;
|
||||
n = 1;
|
||||
t = ptmp;
|
||||
*t++ = '\0';
|
||||
do {
|
||||
*t++ = hexdigit[lval % base];
|
||||
} while ((lval /= base) != 0 && ++i < sizeof(ptmp));
|
||||
int d = (int)llval % base;
|
||||
*t++ = hexdigit[d];
|
||||
llval /= base;
|
||||
} while (llval != 0 && ++n < sizeof(ptmp));
|
||||
while ((*s++ = *--t) != '\0')
|
||||
;
|
||||
/* copy reserved digits */ ;
|
||||
}
|
||||
|
||||
static void
|
||||
|
7
sys/arch/sandpoint/stand/altboot/version
Normal file
7
sys/arch/sandpoint/stand/altboot/version
Normal file
@ -0,0 +1,7 @@
|
||||
1.0 initial version
|
||||
1.1 PCI autoconf for multiple NIC device drivers
|
||||
1.2 Synology-DS support, Marvell-Yukon driver, fixed aligned alloc
|
||||
1.3 allow to have boot options, brdsetup.c cleanup to make brdtype
|
||||
maintainance more confortable
|
||||
1.4 load kernels from local disk
|
||||
1.5 altboot is the new name as this is capable of handling net & dsk.
|
Loading…
Reference in New Issue
Block a user