summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-05-09 16:03:58 +0300
committerToomas Soome <tsoome@me.com>2019-05-15 10:54:00 +0300
commit7efc4ab5dcfd200d52afe798e576fd15b3ffad2d (patch)
tree0d03135c86c0b9459e365f80786b0932de7ceb69 /usr/src
parentfe20e172e8a2aff4961cf65d6975729eb3582b82 (diff)
downloadillumos-joyent-7efc4ab5dcfd200d52afe798e576fd15b3ffad2d.tar.gz
10934 loader: improve some debugging experience
Reviewed by: Gergő Doma <domag02@gmail.com> Reviewed by: Andy Fiddaman <andy@omniosce.org> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/boot/sys/boot/common/bcache.c10
-rw-r--r--usr/src/boot/sys/boot/common/disk.c20
-rw-r--r--usr/src/boot/sys/boot/common/interp_forth.c8
-rw-r--r--usr/src/boot/sys/boot/common/part.c84
-rw-r--r--usr/src/boot/sys/boot/i386/libi386/biosdisk.c24
-rw-r--r--usr/src/boot/sys/boot/userboot/userboot/elf64_freebsd.c5
6 files changed, 77 insertions, 74 deletions
diff --git a/usr/src/boot/sys/boot/common/bcache.c b/usr/src/boot/sys/boot/common/bcache.c
index 9d8e385ab4..3d509efc1a 100644
--- a/usr/src/boot/sys/boot/common/bcache.c
+++ b/usr/src/boot/sys/boot/common/bcache.c
@@ -43,9 +43,9 @@
/* #define BCACHE_DEBUG */
#ifdef BCACHE_DEBUG
-#define DEBUG(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
+#define DPRINTF(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
#else
-#define DEBUG(fmt, args...) ((void)0)
+#define DPRINTF(fmt, args...) ((void)0)
#endif
struct bcachectl
@@ -372,7 +372,7 @@ bcache_strategy(void *devdata, int rw, daddr_t blk, size_t size,
/* bypass large requests, or when the cache is inactive */
if (bc == NULL ||
((size * 2 / bcache_blksize) > bcache_nblks)) {
- DEBUG("bypass %zu from %qu", size / bcache_blksize, blk);
+ DPRINTF("bypass %zu from %qu", size / bcache_blksize, blk);
bcache_bypasses++;
rw &= F_MASK;
return (dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf,
@@ -449,7 +449,7 @@ bcache_insert(struct bcache *bc, daddr_t blkno)
cand = BHASH(bc, blkno);
- DEBUG("insert blk %llu -> %u # %d", blkno, cand, bcache_bcount);
+ DPRINTF("insert blk %llu -> %u # %d", blkno, cand, bcache_bcount);
bc->bcache_ctl[cand].bc_blkno = blkno;
bc->bcache_ctl[cand].bc_count = bcache_bcount++;
}
@@ -466,7 +466,7 @@ bcache_invalidate(struct bcache *bc, daddr_t blkno)
if (bc->bcache_ctl[i].bc_blkno == blkno) {
bc->bcache_ctl[i].bc_count = -1;
bc->bcache_ctl[i].bc_blkno = -1;
- DEBUG("invalidate blk %llu", blkno);
+ DPRINTF("invalidate blk %llu", blkno);
}
}
diff --git a/usr/src/boot/sys/boot/common/disk.c b/usr/src/boot/sys/boot/common/disk.c
index e04974270e..a33dbcc26d 100644
--- a/usr/src/boot/sys/boot/common/disk.c
+++ b/usr/src/boot/sys/boot/common/disk.c
@@ -37,9 +37,9 @@
#include "disk.h"
#ifdef DISK_DEBUG
-#define DEBUG(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
+#define DPRINTF(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
#else
-#define DEBUG(fmt, args...)
+#define DPRINTF(fmt, args...) ((void)0)
#endif
struct open_disk {
@@ -230,7 +230,7 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize, uint_t sectorsize)
int rc, slice, partition;
if (sectorsize == 0) {
- DEBUG("unknown sector size");
+ DPRINTF("unknown sector size");
return (ENXIO);
}
rc = 0;
@@ -244,21 +244,21 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize, uint_t sectorsize)
partition = dev->d_partition;
od = (struct open_disk *)malloc(sizeof (struct open_disk));
if (od == NULL) {
- DEBUG("no memory");
+ DPRINTF("no memory");
return (ENOMEM);
}
dev->dd.d_opendata = od;
od->entrysize = 0;
od->mediasize = mediasize;
od->sectorsize = sectorsize;
- DEBUG("%s unit %d, slice %d, partition %d => %p", disk_fmtdev(dev),
+ DPRINTF("%s unit %d, slice %d, partition %d => %p", disk_fmtdev(dev),
dev->dd.d_unit, dev->d_slice, dev->d_partition, od);
/* Determine disk layout. */
od->table = ptable_open(dev, mediasize / sectorsize, sectorsize,
ptblread);
if (od->table == NULL) {
- DEBUG("Can't read partition table");
+ DPRINTF("Can't read partition table");
rc = ENXIO;
goto out;
}
@@ -314,7 +314,7 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize, uint_t sectorsize)
table = ptable_open(dev, part.end - part.start + 1,
od->sectorsize, ptblread);
if (table == NULL) {
- DEBUG("Can't read BSD/VTOC label");
+ DPRINTF("Can't read BSD/VTOC label");
rc = ENXIO;
goto out;
}
@@ -343,12 +343,12 @@ out:
if (od->table != NULL)
ptable_close(od->table);
free(od);
- DEBUG("%s could not open", disk_fmtdev(dev));
+ DPRINTF("%s could not open", disk_fmtdev(dev));
} else {
/* Save the slice and partition number to the dev */
dev->d_slice = slice;
dev->d_partition = partition;
- DEBUG("%s offset %" PRIu64 " => %p", disk_fmtdev(dev),
+ DPRINTF("%s offset %" PRIu64 " => %p", disk_fmtdev(dev),
dev->d_offset, od);
}
return (rc);
@@ -360,7 +360,7 @@ disk_close(struct disk_devdesc *dev)
struct open_disk *od;
od = (struct open_disk *)dev->dd.d_opendata;
- DEBUG("%s closed => %p", disk_fmtdev(dev), od);
+ DPRINTF("%s closed => %p", disk_fmtdev(dev), od);
ptable_close(od->table);
free(od);
return (0);
diff --git a/usr/src/boot/sys/boot/common/interp_forth.c b/usr/src/boot/sys/boot/common/interp_forth.c
index 0151c52b49..1f3a92bcb4 100644
--- a/usr/src/boot/sys/boot/common/interp_forth.c
+++ b/usr/src/boot/sys/boot/common/interp_forth.c
@@ -37,9 +37,9 @@ extern unsigned bootprog_rev;
/* #define BFORTH_DEBUG */
#ifdef BFORTH_DEBUG
-#define DEBUG(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
+#define DPRINTF(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
#else
-#define DEBUG(fmt, args...)
+#define DPRINTF(fmt, args...) ((void)0)
#endif
/*
@@ -135,7 +135,7 @@ bf_command(ficlVm *vm)
ficlVmUpdateTib(vm, tail + len);
}
}
- DEBUG("cmd '%s'", line);
+ DPRINTF("cmd '%s'", line);
command_errmsg = command_errbuf;
command_errbuf[0] = 0;
@@ -342,7 +342,7 @@ bf_run(char *line)
FICL_STRING_SET_FROM_CSTRING(s, line);
result = ficlVmExecuteString(bf_vm, s);
- DEBUG("ficlExec '%s' = %d", line, result);
+ DPRINTF("ficlExec '%s' = %d", line, result);
switch (result) {
case FICL_VM_STATUS_OUT_OF_TEXT:
case FICL_VM_STATUS_ABORTQ:
diff --git a/usr/src/boot/sys/boot/common/part.c b/usr/src/boot/sys/boot/common/part.c
index 53589f865f..fa3ec75e0f 100644
--- a/usr/src/boot/sys/boot/common/part.c
+++ b/usr/src/boot/sys/boot/common/part.c
@@ -43,9 +43,9 @@
#include <uuid.h>
#ifdef PART_DEBUG
-#define DEBUG(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
+#define DPRINTF(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
#else
-#define DEBUG(fmt, args...)
+#define DPRINTF(fmt, args...) ((void)0)
#endif
#ifdef LOADER_GPT_SUPPORT
@@ -178,34 +178,34 @@ gpt_checkhdr(struct gpt_hdr *hdr, uint64_t lba_self,
uint32_t sz, crc;
if (memcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof (hdr->hdr_sig)) != 0) {
- DEBUG("no GPT signature");
+ DPRINTF("no GPT signature");
return (NULL);
}
sz = le32toh(hdr->hdr_size);
if (sz < 92 || sz > sectorsize) {
- DEBUG("invalid GPT header size: %u", sz);
+ DPRINTF("invalid GPT header size: %u", sz);
return (NULL);
}
crc = le32toh(hdr->hdr_crc_self);
hdr->hdr_crc_self = crc32(0, Z_NULL, 0);
if (crc32(hdr->hdr_crc_self, (const Bytef *)hdr, sz) != crc) {
- DEBUG("GPT header's CRC doesn't match");
+ DPRINTF("GPT header's CRC doesn't match");
return (NULL);
}
hdr->hdr_crc_self = crc;
hdr->hdr_revision = le32toh(hdr->hdr_revision);
if (hdr->hdr_revision < GPT_HDR_REVISION) {
- DEBUG("unsupported GPT revision %u", hdr->hdr_revision);
+ DPRINTF("unsupported GPT revision %u", hdr->hdr_revision);
return (NULL);
}
hdr->hdr_lba_self = le64toh(hdr->hdr_lba_self);
if (hdr->hdr_lba_self != lba_self) {
- DEBUG("self LBA doesn't match");
+ DPRINTF("self LBA doesn't match");
return (NULL);
}
hdr->hdr_lba_alt = le64toh(hdr->hdr_lba_alt);
if (hdr->hdr_lba_alt == hdr->hdr_lba_self) {
- DEBUG("invalid alternate LBA");
+ DPRINTF("invalid alternate LBA");
return (NULL);
}
hdr->hdr_entries = le32toh(hdr->hdr_entries);
@@ -213,7 +213,7 @@ gpt_checkhdr(struct gpt_hdr *hdr, uint64_t lba_self,
if (hdr->hdr_entries == 0 ||
hdr->hdr_entsz < sizeof (struct gpt_ent) ||
sectorsize % hdr->hdr_entsz != 0) {
- DEBUG("invalid entry size or number of entries");
+ DPRINTF("invalid entry size or number of entries");
return (NULL);
}
hdr->hdr_lba_start = le64toh(hdr->hdr_lba_start);
@@ -237,7 +237,7 @@ gpt_checktbl(const struct gpt_hdr *hdr, uint8_t *tbl, size_t size,
/* Check CRC only when buffer size is enough for table. */
if (hdr->hdr_crc_table !=
crc32(0, tbl, hdr->hdr_entries * hdr->hdr_entsz)) {
- DEBUG("GPT table's CRC doesn't match");
+ DPRINTF("GPT table's CRC doesn't match");
return (-1);
}
}
@@ -332,7 +332,7 @@ ptable_gptread(struct ptable *table, void *dev, diskread_t dread)
table->type = PTABLE_NONE;
goto out;
}
- DEBUG("GPT detected");
+ DPRINTF("GPT detected");
size = MIN(hdr.hdr_entries * hdr.hdr_entsz,
MAXTBLSZ * table->sectorsize);
@@ -368,7 +368,7 @@ ptable_gptread(struct ptable *table, void *dev, diskread_t dread)
entry->flags = le64toh(ent->ent_attr);
memcpy(&entry->type.gpt, &ent->ent_type, sizeof (uuid_t));
STAILQ_INSERT_TAIL(&table->entries, entry, entry);
- DEBUG("new GPT partition added");
+ DPRINTF("new GPT partition added");
}
out:
free(buf);
@@ -426,7 +426,7 @@ ptable_ebrread(struct ptable *table, void *dev, diskread_t dread)
buf = malloc(table->sectorsize);
if (buf == NULL)
return (table);
- DEBUG("EBR detected");
+ DPRINTF("EBR detected");
for (i = 0; i < MAXEBRENTRIES; i++) {
#if 0 /* Some BIOSes return an incorrect number of sectors */
if (offset >= table->sectors)
@@ -454,7 +454,7 @@ ptable_ebrread(struct ptable *table, void *dev, diskread_t dread)
entry->flags = dp[0].dp_flag;
entry->type.mbr = dp[0].dp_typ;
STAILQ_INSERT_TAIL(&table->entries, entry, entry);
- DEBUG("new EBR partition added");
+ DPRINTF("new EBR partition added");
if (dp[1].dp_typ == 0)
break;
offset = e1->part.start + le32toh(dp[1].dp_start);
@@ -494,14 +494,14 @@ ptable_bsdread(struct ptable *table, void *dev, diskread_t dread)
int i;
if (table->sectorsize < sizeof (struct disklabel)) {
- DEBUG("Too small sectorsize");
+ DPRINTF("Too small sectorsize");
return (table);
}
buf = malloc(table->sectorsize);
if (buf == NULL)
return (table);
if (dread(dev, buf, 1, 1) != 0) {
- DEBUG("read failed");
+ DPRINTF("read failed");
ptable_close(table);
table = NULL;
goto out;
@@ -511,15 +511,15 @@ ptable_bsdread(struct ptable *table, void *dev, diskread_t dread)
le32toh(dl->d_magic2) != DISKMAGIC)
goto out;
if (le32toh(dl->d_secsize) != table->sectorsize) {
- DEBUG("unsupported sector size");
+ DPRINTF("unsupported sector size");
goto out;
}
dl->d_npartitions = le16toh(dl->d_npartitions);
if (dl->d_npartitions > 20 || dl->d_npartitions < 8) {
- DEBUG("invalid number of partitions");
+ DPRINTF("invalid number of partitions");
goto out;
}
- DEBUG("BSD detected");
+ DPRINTF("BSD detected");
part = &dl->d_partitions[0];
raw_offset = le32toh(part[RAW_PART].p_offset);
for (i = 0; i < dl->d_npartitions; i++, part++) {
@@ -537,7 +537,7 @@ ptable_bsdread(struct ptable *table, void *dev, diskread_t dread)
entry->part.index = i; /* starts from zero */
entry->type.bsd = part->p_fstype;
STAILQ_INSERT_TAIL(&table->entries, entry, entry);
- DEBUG("new BSD partition added");
+ DPRINTF("new BSD partition added");
}
table->type = PTABLE_BSD;
out:
@@ -580,7 +580,7 @@ ptable_vtoc8read(struct ptable *table, void *dev, diskread_t dread)
if (buf == NULL)
return (table);
if (dread(dev, buf, 1, 0) != 0) {
- DEBUG("read failed");
+ DPRINTF("read failed");
ptable_close(table);
table = NULL;
goto out;
@@ -590,20 +590,20 @@ ptable_vtoc8read(struct ptable *table, void *dev, diskread_t dread)
for (i = sum = 0; i < sizeof (struct vtoc8); i += sizeof (sum))
sum ^= be16dec(buf + i);
if (sum != 0) {
- DEBUG("incorrect checksum");
+ DPRINTF("incorrect checksum");
goto out;
}
if (be16toh(dl->nparts) != VTOC8_NPARTS) {
- DEBUG("invalid number of entries");
+ DPRINTF("invalid number of entries");
goto out;
}
sectors = be16toh(dl->nsecs);
heads = be16toh(dl->nheads);
if (sectors * heads == 0) {
- DEBUG("invalid geometry");
+ DPRINTF("invalid geometry");
goto out;
}
- DEBUG("VTOC8 detected");
+ DPRINTF("VTOC8 detected");
for (i = 0; i < VTOC8_NPARTS; i++) {
dl->part[i].tag = be16toh(dl->part[i].tag);
if (i == VTOC_RAW_PART ||
@@ -619,7 +619,7 @@ ptable_vtoc8read(struct ptable *table, void *dev, diskread_t dread)
entry->part.index = i; /* starts from zero */
entry->type.vtoc8 = dl->part[i].tag;
STAILQ_INSERT_TAIL(&table->entries, entry, entry);
- DEBUG("new VTOC8 partition added");
+ DPRINTF("new VTOC8 partition added");
}
table->type = PTABLE_VTOC8;
out:
@@ -663,14 +663,14 @@ ptable_dklabelread(struct ptable *table, void *dev, diskread_t dread)
int i;
if (table->sectorsize < sizeof (struct dk_label)) {
- DEBUG("Too small sectorsize");
+ DPRINTF("Too small sectorsize");
return (table);
}
buf = malloc(table->sectorsize);
if (buf == NULL)
return (table);
if (dread(dev, buf, 1, DK_LABEL_LOC) != 0) {
- DEBUG("read failed");
+ DPRINTF("read failed");
ptable_close(table);
table = NULL;
goto out;
@@ -679,18 +679,18 @@ ptable_dklabelread(struct ptable *table, void *dev, diskread_t dread)
dv = (struct dk_vtoc *)&dl->dkl_vtoc;
if (dl->dkl_magic != VTOC_MAGIC) {
- DEBUG("dk_label magic error");
+ DPRINTF("dk_label magic error");
goto out;
}
if (dv->v_sanity != VTOC_SANITY) {
- DEBUG("this vtoc is not sane");
+ DPRINTF("this vtoc is not sane");
goto out;
}
if (dv->v_nparts != NDKMAP) {
- DEBUG("invalid number of entries");
+ DPRINTF("invalid number of entries");
goto out;
}
- DEBUG("VTOC detected");
+ DPRINTF("VTOC detected");
for (i = 0; i < NDKMAP; i++) {
if (i == VTOC_RAW_PART || /* skip slice 2 and empty */
dv->v_part[i].p_size == 0)
@@ -705,7 +705,7 @@ ptable_dklabelread(struct ptable *table, void *dev, diskread_t dread)
entry->part.index = i; /* starts from zero */
entry->type.vtoc = dv->v_part[i].p_tag;
STAILQ_INSERT_TAIL(&table->entries, entry, entry);
- DEBUG("new VTOC partition added");
+ DPRINTF("new VTOC partition added");
}
table->type = PTABLE_VTOC;
out:
@@ -727,7 +727,7 @@ ptable_iso9660read(struct ptable *table, void *dev, diskread_t dread)
return (table);
if (dread(dev, buf, 1, cdb2devb(16)) != 0) {
- DEBUG("read failed");
+ DPRINTF("read failed");
ptable_close(table);
table = NULL;
goto out;
@@ -770,7 +770,7 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize, diskread_t *dread)
return (NULL);
/* First, read the MBR. */
if (dread(dev, buf, 1, DOSBBSECTOR) != 0) {
- DEBUG("read failed");
+ DPRINTF("read failed");
goto out;
}
@@ -816,7 +816,7 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize, diskread_t *dread)
/* Check the MBR magic. */
if (buf[DOSMAGICOFFSET] != 0x55 ||
buf[DOSMAGICOFFSET + 1] != 0xaa) {
- DEBUG("magic sequence not found");
+ DPRINTF("magic sequence not found");
#if defined(LOADER_GPT_SUPPORT)
/* There is no PMBR, check that we have backup GPT */
table->type = PTABLE_GPT;
@@ -828,13 +828,13 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize, diskread_t *dread)
dp = (struct dos_partition *)(buf + DOSPARTOFF);
for (i = 0, count = 0; i < NDOSPART; i++) {
if (dp[i].dp_flag != 0 && dp[i].dp_flag != 0x80) {
- DEBUG("invalid partition flag %x", dp[i].dp_flag);
+ DPRINTF("invalid partition flag %x", dp[i].dp_flag);
goto out;
}
#ifdef LOADER_GPT_SUPPORT
if (dp[i].dp_typ == DOSPTYP_PMBR) {
table->type = PTABLE_GPT;
- DEBUG("PMBR detected");
+ DPRINTF("PMBR detected");
}
#endif
if (dp[i].dp_typ != 0)
@@ -844,9 +844,9 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize, diskread_t *dread)
if (table->type == PTABLE_GPT && count > 1) {
if (dp[1].dp_typ != DOSPTYP_HFS) {
table->type = PTABLE_NONE;
- DEBUG("Incorrect PMBR, ignore it");
+ DPRINTF("Incorrect PMBR, ignore it");
} else {
- DEBUG("Bootcamp detected");
+ DPRINTF("Bootcamp detected");
}
}
#ifdef LOADER_GPT_SUPPORT
@@ -857,7 +857,7 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize, diskread_t *dread)
#endif
#ifdef LOADER_MBR_SUPPORT
/* Read MBR. */
- DEBUG("MBR detected");
+ DPRINTF("MBR detected");
table->type = PTABLE_MBR;
for (i = has_ext = 0; i < NDOSPART; i++) {
if (dp[i].dp_typ == 0)
@@ -883,7 +883,7 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize, diskread_t *dread)
entry->flags = dp[i].dp_flag;
entry->type.mbr = dp[i].dp_typ;
STAILQ_INSERT_TAIL(&table->entries, entry, entry);
- DEBUG("new MBR partition added");
+ DPRINTF("new MBR partition added");
}
if (has_ext) {
table = ptable_ebrread(table, dev, dread);
diff --git a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
index 08d7ac2ffe..0b8e90c4d7 100644
--- a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
+++ b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
@@ -64,9 +64,9 @@
#define CDMAJOR 15
#ifdef DISK_DEBUG
-#define DEBUG(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
+#define DPRINTF(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
#else
-#define DEBUG(fmt, args...)
+#define DPRINTF(fmt, args...) ((void)0)
#endif
struct specification_packet {
@@ -217,12 +217,12 @@ bd_bios2unit(int biosdev)
bdinfo_t *bd;
int i, unit;
- DEBUG("looking for bios device 0x%x", biosdev);
+ DPRINTF("looking for bios device 0x%x", biosdev);
for (i = 0; bdi[i] != NULL; i++) {
unit = 0;
STAILQ_FOREACH(bd, bdi[i], bd_link) {
if (bd->bd_unit == biosdev) {
- DEBUG("bd unit %d is BIOS device 0x%x", unit,
+ DPRINTF("bd unit %d is BIOS device 0x%x", unit,
bd->bd_unit);
return (unit);
}
@@ -615,7 +615,7 @@ bd_int13probe(bdinfo_t *bd)
if (bd->bd_sectors == 0)
bd->bd_sectors = (uint64_t)bd->bd_cyl * bd->bd_hds * bd->bd_sec;
- DEBUG("unit 0x%x geometry %d/%d/%d\n", bd->bd_unit, bd->bd_cyl,
+ DPRINTF("unit 0x%x geometry %d/%d/%d\n", bd->bd_unit, bd->bd_cyl,
bd->bd_hds, bd->bd_sec);
return (true);
@@ -914,7 +914,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
return (EIO);
}
- DEBUG("open_disk %p", dev);
+ DPRINTF("open_disk %p", dev);
offset = dblk * BIOSDISK_SECSIZE;
dblk = offset / bd->bd_sectorsize;
@@ -927,7 +927,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
* while translating block count to bytes.
*/
if (size > INT_MAX) {
- DEBUG("too large I/O: %zu bytes", size);
+ DPRINTF("too large I/O: %zu bytes", size);
return (EIO);
}
@@ -967,7 +967,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
if (dblk + blks >= d_offset + disk_blocks) {
blks = d_offset + disk_blocks - dblk;
size = blks * bd->bd_sectorsize;
- DEBUG("short I/O %d", blks);
+ DPRINTF("short I/O %d", blks);
}
bio_size = min(BIO_BUFFER_SIZE, size);
@@ -992,7 +992,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
switch (rw & F_MASK) {
case F_READ:
- DEBUG("read %d from %lld to %p", x, dblk, buf);
+ DPRINTF("read %d from %lld to %p", x, dblk, buf);
bsize = bd->bd_sectorsize * x - blkoff;
if (rest < bsize)
bsize = rest;
@@ -1005,7 +1005,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
bcopy(bbuf + blkoff, buf, bsize);
break;
case F_WRITE :
- DEBUG("write %d from %lld to %p", x, dblk, buf);
+ DPRINTF("write %d from %lld to %p", x, dblk, buf);
if (blkoff != 0) {
/*
* We got offset to sector, read 1 sector to
@@ -1253,7 +1253,7 @@ bd_getdev(struct i386_devdesc *d)
return (-1);
biosdev = bd_unit2bios(d);
- DEBUG("unit %d BIOS device %d", dev->dd.d_unit, biosdev);
+ DPRINTF("unit %d BIOS device %d", dev->dd.d_unit, biosdev);
if (biosdev == -1) /* not a BIOS device */
return (-1);
@@ -1306,6 +1306,6 @@ bd_getdev(struct i386_devdesc *d)
}
rootdev = MAKEBOOTDEV(major, slice, unit, partition);
- DEBUG("dev is 0x%x\n", rootdev);
+ DPRINTF("dev is 0x%x\n", rootdev);
return (rootdev);
}
diff --git a/usr/src/boot/sys/boot/userboot/userboot/elf64_freebsd.c b/usr/src/boot/sys/boot/userboot/userboot/elf64_freebsd.c
index 36129ef6b7..f7c3984f27 100644
--- a/usr/src/boot/sys/boot/userboot/userboot/elf64_freebsd.c
+++ b/usr/src/boot/sys/boot/userboot/userboot/elf64_freebsd.c
@@ -31,6 +31,9 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/exec.h>
#include <sys/linker.h>
+#ifdef DEBUG
+#include <machine/_inttypes.h>
+#endif
#include <string.h>
#include <i386/include/bootinfo.h>
#include <machine/elf.h>
@@ -136,7 +139,7 @@ elf64_exec(struct preloaded_file *fp)
}
#ifdef DEBUG
- printf("Start @ %#llx ...\n", ehdr->e_entry);
+ printf("Start @ %#" PRIx64 " ...\n", ehdr->e_entry);
#endif
dev_cleanup();