summaryrefslogtreecommitdiffstats
path: root/stand
diff options
context:
space:
mode:
authorkevans <kevans@FreeBSD.org>2018-04-06 21:37:25 +0000
committerkevans <kevans@FreeBSD.org>2018-04-06 21:37:25 +0000
commit883f323de4b8a7c082d104c900d77da04fb6869c (patch)
tree8883a8e2e75a488b83da075775f097a0edb434a1 /stand
parent8b6d58da477582eaf6b2510f34d30b581ad2b6b5 (diff)
downloadFreeBSD-src-883f323de4b8a7c082d104c900d77da04fb6869c.zip
FreeBSD-src-883f323de4b8a7c082d104c900d77da04fb6869c.tar.gz
MFC r330806-r330815, r330837, r330864, r330883
pc98 changes associated with the named commits are also included in this commit, despite not having been made with the original commits due to its removal in head. r330806: Minor cosmetic changes. Make sure { on the same line as struct for all struct *devdesc. Move some type definitions to next to the dv_type define, since that's what sets the d_type. r330807: We can't use d_opendata for blkio storage. open_disk uses d_opendata for it's own purpse. We can't store blkio there. Fortunately, blkio is stored elsewhere and we never actually retrieve blkio from d_opendata. Eliminate it as a source of confusion. Eliminate all stores of d_opendata in efi since this layer doesn't own that field. r330808: Make struct libi386_devdesc match the struct devdesc better Move data to top and call it d_opendata. r330809: Use the actual struct devdesc at the start of all *_devdesc structs The current system is fragile and requires very careful layout of all *_devdesc structures. It also makes it hard to change the base devdesc. Take a page from CAM and put the 'header' in all the derived classes and adjust the code to match. For OFW, move the iHandle h_handle out of a slot conflicting with d_opendata. Due to quirks in the alignment rules, this worked. However changing the code to use d_opendata storage now that it's a pointer is hard, so just have a separate field for it. All other cleanups were to make the *_devdesc structures match where they'd taken some liberties that were none-the-less compatible enough to work. r330810: Remove d_type from devdesc. It's not needed as we can fetch it from d_dev->dv_type when we need it. r330811: GC unused routines. Sponsored by: Netflix r330812: Use the one-line-per-file pattern here, and sort the file names. Sponsored by: Netflix r330813: Move the env convenience routines out of boot1.c. These routines are more generally useful. Even though boot1 is on its way out, it's better to make these common during the transition than copy them. r330814: Star BootCurrent entry when booting. Sponsored by: Netflix r330815: Print the load and device path as well as BootCurrent and BootOrder Sponsored by: Netflix r330837: biosdisk.c should not set d_opendata. Same as 330807, d_opendata is owned by open_disk and we should not set it. M stand/i386/libi386/biosdisk.c r330864: Prefer uintXX_t to u_intXX_t A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines. With consistency a great soul has simply nothing to do. -- Ralph Waldo Emerson r330883: Fix typo that misteriously passes compilation.
Diffstat (limited to 'stand')
-rw-r--r--stand/common/bootstrap.h16
-rw-r--r--stand/common/disk.c30
-rw-r--r--stand/common/disk.h9
-rw-r--r--stand/common/isapnp.c8
-rw-r--r--stand/common/load_elf.c22
-rw-r--r--stand/common/load_elf_obj.c10
-rw-r--r--stand/common/metadata.c2
-rw-r--r--stand/common/misc.c4
-rw-r--r--stand/common/pnp.c2
-rw-r--r--stand/efi/boot1/boot1.c45
-rw-r--r--stand/efi/boot1/ufs_module.c2
-rw-r--r--stand/efi/include/efilib.h11
-rw-r--r--stand/efi/libefi/Makefile17
-rw-r--r--stand/efi/libefi/devicename.c3
-rw-r--r--stand/efi/libefi/efienv.c87
-rw-r--r--stand/efi/libefi/efipart.c15
-rw-r--r--stand/efi/libefi/efizfs.c3
-rw-r--r--stand/efi/libefi/env.c29
-rw-r--r--stand/efi/loader/arch/arm/exec.c2
-rw-r--r--stand/efi/loader/main.c52
-rw-r--r--stand/ficl/aarch64/sysdep.c10
-rw-r--r--stand/ficl/amd64/sysdep.c10
-rw-r--r--stand/ficl/arm/sysdep.c10
-rw-r--r--stand/ficl/i386/sysdep.c14
-rw-r--r--stand/ficl/mips/sysdep.c10
-rw-r--r--stand/ficl/mips64/sysdep.c10
-rw-r--r--stand/ficl/powerpc/sysdep.c10
-rw-r--r--stand/ficl/riscv/sysdep.c10
-rw-r--r--stand/ficl/sparc64/sysdep.c10
-rw-r--r--stand/i386/btx/lib/btxv86.h8
-rw-r--r--stand/i386/libi386/biosacpi.c4
-rw-r--r--stand/i386/libi386/bioscd.c8
-rw-r--r--stand/i386/libi386/biosdisk.c55
-rw-r--r--stand/i386/libi386/biospnp.c92
-rw-r--r--stand/i386/libi386/bootinfo32.c11
-rw-r--r--stand/i386/libi386/bootinfo64.c16
-rw-r--r--stand/i386/libi386/devicename.c9
-rw-r--r--stand/i386/libi386/elf64_freebsd.c10
-rw-r--r--stand/i386/libi386/libi386.h18
-rw-r--r--stand/i386/libi386/multiboot.c14
-rw-r--r--stand/i386/libi386/pxe.c8
-rw-r--r--stand/i386/loader/chain.c2
-rw-r--r--stand/i386/loader/main.c25
-rw-r--r--stand/libsa/arp.c2
-rw-r--r--stand/libsa/bootp.c2
-rw-r--r--stand/libsa/bootparam.c16
-rw-r--r--stand/libsa/dosfs.h12
-rw-r--r--stand/libsa/ext2fs.c138
-rw-r--r--stand/libsa/net.h2
-rw-r--r--stand/libsa/rpc.c24
-rw-r--r--stand/libsa/stand.h16
-rw-r--r--stand/mips/beri/loader/beri_disk_cfi.c6
-rw-r--r--stand/mips/beri/loader/beri_disk_sdcard.c6
-rw-r--r--stand/mips/beri/loader/devicename.c11
-rw-r--r--stand/ofw/libofw/devicename.c5
-rw-r--r--stand/ofw/libofw/libofw.h11
-rw-r--r--stand/ofw/libofw/openfirm.c2
-rw-r--r--stand/pc98/libpc98/bioscd.c8
-rw-r--r--stand/pc98/libpc98/biosdisk.c18
-rw-r--r--stand/pc98/loader/main.c18
-rw-r--r--stand/powerpc/boot1.chrp/boot1.c12
-rw-r--r--stand/powerpc/kboot/ppc64_elf_freebsd.c2
-rw-r--r--stand/powerpc/ofw/elf_freebsd.c2
-rw-r--r--stand/powerpc/ofw/main.c4
-rw-r--r--stand/powerpc/ofw/ppc64_elf_freebsd.c2
-rw-r--r--stand/sparc64/boot1/boot1.c12
-rw-r--r--stand/sparc64/loader/main.c5
-rw-r--r--stand/uboot/common/main.c17
-rw-r--r--stand/uboot/lib/devicename.c9
-rw-r--r--stand/uboot/lib/disk.c10
-rw-r--r--stand/uboot/lib/elf_freebsd.c2
-rw-r--r--stand/uboot/lib/libuboot.h9
-rw-r--r--stand/userboot/userboot/bootinfo32.c2
-rw-r--r--stand/userboot/userboot/bootinfo64.c14
-rw-r--r--stand/userboot/userboot/devicename.c13
-rw-r--r--stand/userboot/userboot/elf64_freebsd.c6
-rw-r--r--stand/userboot/userboot/main.c16
-rw-r--r--stand/userboot/userboot/userboot_disk.c32
-rw-r--r--stand/zfs/libzfs.h14
-rw-r--r--stand/zfs/zfs.c9
80 files changed, 634 insertions, 598 deletions
diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h
index 2808117..56d399e 100644
--- a/stand/common/bootstrap.h
+++ b/stand/common/bootstrap.h
@@ -150,7 +150,7 @@ void pnp_addident(struct pnpinfo *pi, char *ident);
struct pnpinfo *pnp_allocinfo(void);
void pnp_freeinfo(struct pnpinfo *pi);
void pnp_addinfo(struct pnpinfo *pi);
-char *pnp_eisaformat(u_int8_t *data);
+char *pnp_eisaformat(uint8_t *data);
/*
* < 0 - No ISA in system
@@ -168,7 +168,7 @@ extern int isapnp_readport;
struct file_metadata
{
size_t md_size;
- u_int16_t md_type;
+ uint16_t md_type;
struct file_metadata *md_next;
char md_data[1]; /* data are immediately appended */
};
@@ -210,7 +210,7 @@ struct preloaded_file
struct file_format
{
/* Load function must return EFTYPE if it can't handle the module supplied */
- int (* l_load)(char *filename, u_int64_t dest, struct preloaded_file **result);
+ int (* l_load)(char *filename, uint64_t dest, struct preloaded_file **result);
/* Only a loader that will load a kernel (first module) should have an exec handler */
int (* l_exec)(struct preloaded_file *mp);
};
@@ -239,20 +239,20 @@ void file_removemetadata(struct preloaded_file *fp);
#define ELF_RELOC_RELA 2
/* Relocation offset for some architectures */
-extern u_int64_t __elfN(relocation_offset);
+extern uint64_t __elfN(relocation_offset);
struct elf_file;
typedef Elf_Addr (symaddr_fn)(struct elf_file *ef, Elf_Size symidx);
-int __elfN(loadfile)(char *filename, u_int64_t dest, struct preloaded_file **result);
-int __elfN(obj_loadfile)(char *filename, u_int64_t dest,
+int __elfN(loadfile)(char *filename, uint64_t dest, struct preloaded_file **result);
+int __elfN(obj_loadfile)(char *filename, uint64_t dest,
struct preloaded_file **result);
int __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr,
const void *reldata, int reltype, Elf_Addr relbase,
Elf_Addr dataaddr, void *data, size_t len);
-int __elfN(loadfile_raw)(char *filename, u_int64_t dest,
+int __elfN(loadfile_raw)(char *filename, uint64_t dest,
struct preloaded_file **result, int multiboot);
-int __elfN(load_modmetadata)(struct preloaded_file *fp, u_int64_t dest);
+int __elfN(load_modmetadata)(struct preloaded_file *fp, uint64_t dest);
#endif
/*
diff --git a/stand/common/disk.c b/stand/common/disk.c
index 4cb57d4..57cb206 100644
--- a/stand/common/disk.c
+++ b/stand/common/disk.c
@@ -86,7 +86,7 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t offset)
struct open_disk *od;
dev = (struct disk_devdesc *)d;
- od = (struct open_disk *)dev->d_opendata;
+ od = (struct open_disk *)dev->dd.d_opendata;
/*
* The strategy function assumes the offset is in units of 512 byte
@@ -98,7 +98,7 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t offset)
* As the GPT backup partition is located at the end of the disk,
* to avoid reading past disk end, flag bcache not to use RA.
*/
- return (dev->d_dev->dv_strategy(dev, F_READ | F_NORA, offset,
+ return (dev->dd.d_dev->dv_strategy(dev, F_READ | F_NORA, offset,
blocks * od->sectorsize, (char *)buf, NULL));
}
@@ -114,7 +114,7 @@ ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
int res;
pa = (struct print_args *)arg;
- od = (struct open_disk *)pa->dev->d_opendata;
+ od = (struct open_disk *)pa->dev->dd.d_opendata;
sprintf(line, " %s%s: %s", pa->prefix, pname,
parttype2str(part->type));
if (pa->verbose)
@@ -127,8 +127,8 @@ ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
res = 0;
if (part->type == PART_FREEBSD) {
/* Open slice with BSD label */
- dev.d_dev = pa->dev->d_dev;
- dev.d_unit = pa->dev->d_unit;
+ dev.dd.d_dev = pa->dev->dd.d_dev;
+ dev.dd.d_unit = pa->dev->dd.d_unit;
dev.d_slice = part->index;
dev.d_partition = -1;
if (disk_open(&dev, part->end - part->start + 1,
@@ -158,7 +158,7 @@ disk_print(struct disk_devdesc *dev, char *prefix, int verbose)
struct print_args pa;
/* Disk should be opened */
- od = (struct open_disk *)dev->d_opendata;
+ od = (struct open_disk *)dev->dd.d_opendata;
pa.dev = dev;
pa.prefix = prefix;
pa.verbose = verbose;
@@ -171,8 +171,8 @@ disk_read(struct disk_devdesc *dev, void *buf, uint64_t offset, u_int blocks)
struct open_disk *od;
int ret;
- od = (struct open_disk *)dev->d_opendata;
- ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset,
+ od = (struct open_disk *)dev->dd.d_opendata;
+ ret = dev->dd.d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset,
blocks * od->sectorsize, buf, NULL);
return (ret);
@@ -184,8 +184,8 @@ disk_write(struct disk_devdesc *dev, void *buf, uint64_t offset, u_int blocks)
struct open_disk *od;
int ret;
- od = (struct open_disk *)dev->d_opendata;
- ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset,
+ od = (struct open_disk *)dev->dd.d_opendata;
+ ret = dev->dd.d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset,
blocks * od->sectorsize, buf, NULL);
return (ret);
@@ -194,7 +194,7 @@ disk_write(struct disk_devdesc *dev, void *buf, uint64_t offset, u_int blocks)
int
disk_ioctl(struct disk_devdesc *dev, u_long cmd, void *data)
{
- struct open_disk *od = dev->d_opendata;
+ struct open_disk *od = dev->dd.d_opendata;
if (od == NULL)
return (ENOTTY);
@@ -238,7 +238,7 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize, u_int sectorsize)
DEBUG("no memory");
return (ENOMEM);
}
- dev->d_opendata = od;
+ dev->dd.d_opendata = od;
od->entrysize = 0;
od->mediasize = mediasize;
od->sectorsize = sectorsize;
@@ -348,7 +348,7 @@ disk_close(struct disk_devdesc *dev)
{
struct open_disk *od;
- od = (struct open_disk *)dev->d_opendata;
+ od = (struct open_disk *)dev->dd.d_opendata;
DEBUG("%s closed => %p", disk_fmtdev(dev), od);
ptable_close(od->table);
free(od);
@@ -361,7 +361,7 @@ disk_fmtdev(struct disk_devdesc *dev)
static char buf[128];
char *cp;
- cp = buf + sprintf(buf, "%s%d", dev->d_dev->dv_name, dev->d_unit);
+ cp = buf + sprintf(buf, "%s%d", dev->dd.d_dev->dv_name, dev->dd.d_unit);
if (dev->d_slice >= 0) {
#ifdef LOADER_GPT_SUPPORT
if (dev->d_partition == 255) {
@@ -423,7 +423,7 @@ disk_parsedev(struct disk_devdesc *dev, const char *devspec, const char **path)
if (*cp != '\0' && *cp != ':')
return (EINVAL);
- dev->d_unit = unit;
+ dev->dd.d_unit = unit;
dev->d_slice = slice;
dev->d_partition = partition;
if (path != NULL)
diff --git a/stand/common/disk.h b/stand/common/disk.h
index 51e1498..8396c27 100644
--- a/stand/common/disk.h
+++ b/stand/common/disk.h
@@ -81,12 +81,9 @@
#ifndef _DISK_H
#define _DISK_H
-struct disk_devdesc
-{
- struct devsw *d_dev;
- int d_type;
- int d_unit;
- void *d_opendata;
+/* Note: Must match the 'struct devdesc' in stand.h */
+struct disk_devdesc {
+ struct devdesc dd;
int d_slice;
int d_partition;
uint64_t d_offset;
diff --git a/stand/common/isapnp.c b/stand/common/isapnp.c
index 5867600..16eb0b9 100644
--- a/stand/common/isapnp.c
+++ b/stand/common/isapnp.c
@@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
static void isapnp_write(int d, int r);
static void isapnp_send_Initiation_LFSR(void);
-static int isapnp_get_serial(u_int8_t *p);
+static int isapnp_get_serial(uint8_t *p);
static int isapnp_isolation_protocol(void);
static void isapnp_enumerate(void);
@@ -90,7 +90,7 @@ isapnp_send_Initiation_LFSR(void)
* Get the device's serial number. Returns 1 if the serial is valid.
*/
static int
-isapnp_get_serial(u_int8_t *data)
+isapnp_get_serial(uint8_t *data)
{
int i, bit, valid = 0, sum = 0x6a;
@@ -123,7 +123,7 @@ isapnp_get_serial(u_int8_t *data)
* Returns nonzero if the device fails to report
*/
static int
-isapnp_get_resource_info(u_int8_t *buffer, int len)
+isapnp_get_resource_info(uint8_t *buffer, int len)
{
int i, j;
u_char temp;
@@ -229,7 +229,7 @@ isapnp_isolation_protocol(void)
{
int csn;
struct pnpinfo *pi;
- u_int8_t cardid[_PNP_ID_LEN];
+ uint8_t cardid[_PNP_ID_LEN];
int ndevs;
isapnp_send_Initiation_LFSR();
diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c
index 572f062..695eec6 100644
--- a/stand/common/load_elf.c
+++ b/stand/common/load_elf.c
@@ -70,11 +70,11 @@ typedef struct elf_file {
caddr_t firstpage;
size_t firstlen;
int kernel;
- u_int64_t off;
+ uint64_t off;
} *elf_file_t;
static int __elfN(loadimage)(struct preloaded_file *mp, elf_file_t ef,
- u_int64_t loadaddr);
+ uint64_t loadaddr);
static int __elfN(lookup_symbol)(struct preloaded_file *mp, elf_file_t ef,
const char* name, Elf_Sym* sym);
static int __elfN(reloc_ptr)(struct preloaded_file *mp, elf_file_t ef,
@@ -87,7 +87,7 @@ static char *fake_modname(const char *name);
const char *__elfN(kerneltype) = "elf kernel";
const char *__elfN(moduletype) = "elf module";
-u_int64_t __elfN(relocation_offset) = 0;
+uint64_t __elfN(relocation_offset) = 0;
extern void elf_wrong_field_size(void);
#define CONVERT_FIELD(b, f, e) \
@@ -265,13 +265,13 @@ error:
* will be saved in (result).
*/
int
-__elfN(loadfile)(char *filename, u_int64_t dest, struct preloaded_file **result)
+__elfN(loadfile)(char *filename, uint64_t dest, struct preloaded_file **result)
{
return (__elfN(loadfile_raw)(filename, dest, result, 0));
}
int
-__elfN(loadfile_raw)(char *filename, u_int64_t dest,
+__elfN(loadfile_raw)(char *filename, uint64_t dest,
struct preloaded_file **result, int multiboot)
{
struct preloaded_file *fp, *kfp;
@@ -419,7 +419,7 @@ out:
* the Elf header, load the image at (off)
*/
static int
-__elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off)
+__elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off)
{
int i;
u_int j;
@@ -883,21 +883,21 @@ fake_modname(const char *name)
struct mod_metadata64 {
int md_version; /* structure version MDTV_* */
int md_type; /* type of entry MDT_* */
- u_int64_t md_data; /* specific data */
- u_int64_t md_cval; /* common string label */
+ uint64_t md_data; /* specific data */
+ uint64_t md_cval; /* common string label */
};
#endif
#if defined(__amd64__) && __ELF_WORD_SIZE == 32
struct mod_metadata32 {
int md_version; /* structure version MDTV_* */
int md_type; /* type of entry MDT_* */
- u_int32_t md_data; /* specific data */
- u_int32_t md_cval; /* common string label */
+ uint32_t md_data; /* specific data */
+ uint32_t md_cval; /* common string label */
};
#endif
int
-__elfN(load_modmetadata)(struct preloaded_file *fp, u_int64_t dest)
+__elfN(load_modmetadata)(struct preloaded_file *fp, uint64_t dest)
{
struct elf_file ef;
int err, i, j;
diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c
index 57df57a..d4955e7 100644
--- a/stand/common/load_elf_obj.c
+++ b/stand/common/load_elf_obj.c
@@ -63,7 +63,7 @@ typedef struct elf_file {
} *elf_file_t;
static int __elfN(obj_loadimage)(struct preloaded_file *mp, elf_file_t ef,
- u_int64_t loadaddr);
+ uint64_t loadaddr);
static int __elfN(obj_lookup_set)(struct preloaded_file *mp, elf_file_t ef,
const char *name, Elf_Addr *startp, Elf_Addr *stopp, int *countp);
static int __elfN(obj_reloc_ptr)(struct preloaded_file *mp, elf_file_t ef,
@@ -81,7 +81,7 @@ const char *__elfN(obj_moduletype) = "elf obj module";
* will be saved in (result).
*/
int
-__elfN(obj_loadfile)(char *filename, u_int64_t dest,
+__elfN(obj_loadfile)(char *filename, uint64_t dest,
struct preloaded_file **result)
{
struct preloaded_file *fp, *kfp;
@@ -186,7 +186,7 @@ out:
* the Elf header, load the image at (off)
*/
static int
-__elfN(obj_loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off)
+__elfN(obj_loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off)
{
Elf_Ehdr *hdr;
Elf_Shdr *shdr, *cshdr, *lshdr;
@@ -345,8 +345,8 @@ out:
struct mod_metadata64 {
int md_version; /* structure version MDTV_* */
int md_type; /* type of entry MDT_* */
- u_int64_t md_data; /* specific data */
- u_int64_t md_cval; /* common string label */
+ uint64_t md_data; /* specific data */
+ uint64_t md_cval; /* common string label */
};
#endif
diff --git a/stand/common/metadata.c b/stand/common/metadata.c
index 31ba2fb..16f8c58 100644
--- a/stand/common/metadata.c
+++ b/stand/common/metadata.c
@@ -217,7 +217,7 @@ md_copyenv(vm_offset_t addr)
static int align;
#define COPY32(v, a, c) { \
- u_int32_t x = (v); \
+ uint32_t x = (v); \
if (c) \
archsw.arch_copyin(&x, a, sizeof(x)); \
a += sizeof(x); \
diff --git a/stand/common/misc.c b/stand/common/misc.c
index 4c0273f..2ad9afa 100644
--- a/stand/common/misc.c
+++ b/stand/common/misc.c
@@ -185,7 +185,7 @@ hexdump(caddr_t region, size_t len)
for (x = 0; x < 16; x++) {
if ((line + x) < (region + len)) {
- emit("%02x ", *(u_int8_t *)(line + x));
+ emit("%02x ", *(uint8_t *)(line + x));
} else {
emit("-- ");
}
@@ -195,7 +195,7 @@ hexdump(caddr_t region, size_t len)
emit(" |");
for (x = 0; x < 16; x++) {
if ((line + x) < (region + len)) {
- c = *(u_int8_t *)(line + x);
+ c = *(uint8_t *)(line + x);
if ((c < ' ') || (c > '~')) /* !isprint(c) */
c = '.';
emit("%c", c);
diff --git a/stand/common/pnp.c b/stand/common/pnp.c
index 31a0de9..4759c44 100644
--- a/stand/common/pnp.c
+++ b/stand/common/pnp.c
@@ -169,7 +169,7 @@ pnp_addinfo(struct pnpinfo *pi)
* where 'AAA' is the EISA vendor ID, II is the product ID and RR the revision ID.
*/
char *
-pnp_eisaformat(u_int8_t *data)
+pnp_eisaformat(uint8_t *data)
{
static char idbuf[8];
const char hextoascii[] = "0123456789abcdef";
diff --git a/stand/efi/boot1/boot1.c b/stand/efi/boot1/boot1.c
index 35f3332d..887370d 100644
--- a/stand/efi/boot1/boot1.c
+++ b/stand/efi/boot1/boot1.c
@@ -54,8 +54,6 @@ static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL;
static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL;
static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL;
static EFI_GUID ConsoleControlGUID = EFI_CONSOLE_CONTROL_PROTOCOL_GUID;
-static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID;
-static EFI_GUID GlobalBootVarGUID = UEFI_BOOT_VAR_GUID;
/*
* Provide Malloc / Free backed by EFIs AllocatePool / FreePool which ensures
@@ -80,42 +78,6 @@ Free(void *buf, const char *file __unused, int line __unused)
(void)BS->FreePool(buf);
}
-static EFI_STATUS
-efi_getenv(EFI_GUID *g, const char *v, void *data, size_t *len)
-{
- size_t ul;
- CHAR16 *uv;
- UINT32 attr;
- UINTN dl;
- EFI_STATUS rv;
-
- uv = NULL;
- if (utf8_to_ucs2(v, &uv, &ul) != 0)
- return (EFI_OUT_OF_RESOURCES);
- dl = *len;
- rv = RS->GetVariable(uv, g, &attr, &dl, data);
- if (rv == EFI_SUCCESS)
- *len = dl;
- free(uv);
- return (rv);
-}
-
-static EFI_STATUS
-efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr)
-{
- CHAR16 *var = NULL;
- size_t len;
- EFI_STATUS rv;
-
- if (utf8_to_ucs2(varname, &var, &len) != 0)
- return (EFI_OUT_OF_RESOURCES);
- rv = RS->SetVariable(var, &FreeBSDBootVarGUID,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- (ucs2len(valstr) + 1) * sizeof(efi_char), valstr);
- free(var);
- return (rv);
-}
-
/*
* nodes_match returns TRUE if the imgpath isn't NULL and the nodes match,
* FALSE otherwise.
@@ -505,14 +467,15 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab)
boot_current = 0;
sz = sizeof(boot_current);
- efi_getenv(&GlobalBootVarGUID, "BootCurrent", &boot_current, &sz);
+ efi_global_getenv("BootCurrent", &boot_current, &sz);
printf(" BootCurrent: %04x\n", boot_current);
sz = sizeof(boot_order);
- efi_getenv(&GlobalBootVarGUID, "BootOrder", &boot_order, &sz);
+ efi_global_getenv("BootOrder", &boot_order, &sz);
printf(" BootOrder:");
for (i = 0; i < sz / sizeof(boot_order[0]); i++)
- printf(" %04x", boot_order[i]);
+ printf(" %04x%s", boot_order[i],
+ boot_order[i] == boot_current ? "[*]" : "");
printf("\n");
#ifdef TEST_FAILURE
diff --git a/stand/efi/boot1/ufs_module.c b/stand/efi/boot1/ufs_module.c
index 4a8016f..76c15e4 100644
--- a/stand/efi/boot1/ufs_module.c
+++ b/stand/efi/boot1/ufs_module.c
@@ -44,7 +44,7 @@ static dev_info_t *devinfo;
static dev_info_t *devices;
static int
-dskread(void *buf, u_int64_t lba, int nblk)
+dskread(void *buf, uint64_t lba, int nblk)
{
int size;
EFI_STATUS status;
diff --git a/stand/efi/include/efilib.h b/stand/efi/include/efilib.h
index 2a07ec4..f2ca9ca 100644
--- a/stand/efi/include/efilib.h
+++ b/stand/efi/include/efilib.h
@@ -106,6 +106,17 @@ int wcscmp(CHAR16 *, CHAR16 *);
void cpy8to16(const char *, CHAR16 *, size_t);
void cpy16to8(const CHAR16 *, char *, size_t);
+/*
+ * Routines for interacting with EFI's env vars in a more unix-like
+ * way than the standard APIs. In addition, convenience routines for
+ * the loader setting / getting FreeBSD specific variables.
+ */
+
+EFI_STATUS efi_freebsd_getenv(const char *v, void *data, __size_t *len);
+EFI_STATUS efi_getenv(EFI_GUID *g, const char *v, void *data, __size_t *len);
+EFI_STATUS efi_global_getenv(const char *v, void *data, __size_t *len);
+EFI_STATUS efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr);
+
/* efipart.c */
int efipart_inithandles(void);
diff --git a/stand/efi/libefi/Makefile b/stand/efi/libefi/Makefile
index c88eb4d..f45f3a7 100644
--- a/stand/efi/libefi/Makefile
+++ b/stand/efi/libefi/Makefile
@@ -5,8 +5,21 @@
LIB= efi
WARNS?= 2
-SRCS= delay.c devpath.c efi_console.c efichar.c efinet.c efipart.c env.c errno.c \
- handles.c wchar.c libefi.c efi_driver_utils.c efizfs.c devicename.c
+SRCS= delay.c \
+ devicename.c \
+ devpath.c \
+ efi_console.c \
+ efi_driver_utils.c \
+ efichar.c \
+ efienv.c \
+ efinet.c \
+ efipart.c \
+ efizfs.c \
+ env.c \
+ errno.c \
+ handles.c \
+ libefi.c \
+ wchar.c
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
SRCS+= time.c
diff --git a/stand/efi/libefi/devicename.c b/stand/efi/libefi/devicename.c
index 52e4799..e5d11a1 100644
--- a/stand/efi/libefi/devicename.c
+++ b/stand/efi/libefi/devicename.c
@@ -161,7 +161,6 @@ efi_parsedev(struct devdesc **dev, const char *devspec, const char **path)
}
idev->d_dev = dv;
- idev->d_type = dv->dv_type;
if (dev != NULL)
*dev = idev;
@@ -180,7 +179,7 @@ efi_fmtdev(void *vdev)
struct devdesc *dev = (struct devdesc *)vdev;
static char buf[SPECNAMELEN + 1];
- switch(dev->d_type) {
+ switch(dev->d_dev->dv_type) {
case DEVT_NONE:
strcpy(buf, "(no device)");
break;
diff --git a/stand/efi/libefi/efienv.c b/stand/efi/libefi/efienv.c
new file mode 100644
index 0000000..cc9f370
--- /dev/null
+++ b/stand/efi/libefi/efienv.c
@@ -0,0 +1,87 @@
+/*-
+ * Copyright (c) 2018 Netflix, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stand.h>
+#include <efi.h>
+#include <efichar.h>
+#include <efilib.h>
+
+static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID;
+static EFI_GUID GlobalBootVarGUID = UEFI_BOOT_VAR_GUID;
+
+EFI_STATUS
+efi_getenv(EFI_GUID *g, const char *v, void *data, size_t *len)
+{
+ size_t ul;
+ CHAR16 *uv;
+ UINT32 attr;
+ UINTN dl;
+ EFI_STATUS rv;
+
+ uv = NULL;
+ if (utf8_to_ucs2(v, &uv, &ul) != 0)
+ return (EFI_OUT_OF_RESOURCES);
+ dl = *len;
+ rv = RS->GetVariable(uv, g, &attr, &dl, data);
+ if (rv == EFI_SUCCESS)
+ *len = dl;
+ free(uv);
+ return (rv);
+}
+
+EFI_STATUS
+efi_global_getenv(const char *v, void *data, size_t *len)
+{
+
+ return (efi_getenv(&GlobalBootVarGUID, v, data, len));
+}
+
+EFI_STATUS
+efi_freebsd_getenv(const char *v, void *data, size_t *len)
+{
+
+ return (efi_getenv(&FreeBSDBootVarGUID, v, data, len));
+}
+
+EFI_STATUS
+efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr)
+{
+ CHAR16 *var = NULL;
+ size_t len;
+ EFI_STATUS rv;
+
+ if (utf8_to_ucs2(varname, &var, &len) != 0)
+ return (EFI_OUT_OF_RESOURCES);
+ rv = RS->SetVariable(var, &FreeBSDBootVarGUID,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ (ucs2len(valstr) + 1) * sizeof(efi_char), valstr);
+ free(var);
+ return (rv);
+}
+
diff --git a/stand/efi/libefi/efipart.c b/stand/efi/libefi/efipart.c
index f40fbd2..6838693 100644
--- a/stand/efi/libefi/efipart.c
+++ b/stand/efi/libefi/efipart.c
@@ -744,11 +744,10 @@ efipart_print_common(struct devsw *dev, pdinfo_list_t *pdlist, int verbose)
continue;
pd->pd_blkio = blkio;
- pd_dev.d_dev = dev;
- pd_dev.d_unit = pd->pd_unit;
+ pd_dev.dd.d_dev = dev;
+ pd_dev.dd.d_unit = pd->pd_unit;
pd_dev.d_slice = -1;
pd_dev.d_partition = -1;
- pd_dev.d_opendata = blkio;
ret = disk_open(&pd_dev, blkio->Media->BlockSize *
(blkio->Media->LastBlock + 1),
blkio->Media->BlockSize);
@@ -821,7 +820,7 @@ efipart_open(struct open_file *f, ...)
if (pd->pd_bcache == NULL)
pd->pd_bcache = bcache_allocate();
- if (dev->d_dev->dv_type == DEVT_DISK) {
+ if (dev->dd.d_dev->dv_type == DEVT_DISK) {
int rc;
rc = disk_open(dev,
@@ -860,7 +859,7 @@ efipart_close(struct open_file *f)
bcache_free(pd->pd_bcache);
pd->pd_bcache = NULL;
}
- if (dev->d_dev->dv_type == DEVT_DISK)
+ if (dev->dd.d_dev->dv_type == DEVT_DISK)
return (disk_close(dev));
return (0);
}
@@ -880,7 +879,7 @@ efipart_ioctl(struct open_file *f, u_long cmd, void *data)
if (pd == NULL)
return (EINVAL);
- if (dev->d_dev->dv_type == DEVT_DISK) {
+ if (dev->dd.d_dev->dv_type == DEVT_DISK) {
rc = disk_ioctl(dev, cmd, data);
if (rc != ENOTTY)
return (rc);
@@ -967,7 +966,7 @@ efipart_strategy(void *devdata, int rw, daddr_t blk, size_t size,
bcd.dv_devdata = devdata;
bcd.dv_cache = pd->pd_bcache;
- if (dev->d_dev->dv_type == DEVT_DISK) {
+ if (dev->dd.d_dev->dv_type == DEVT_DISK) {
daddr_t offset;
offset = dev->d_offset * pd->pd_blkio->Media->BlockSize;
@@ -1011,7 +1010,7 @@ efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t size,
* partition.
*/
disk_blocks = 0;
- if (dev->d_dev->dv_type == DEVT_DISK) {
+ if (dev->dd.d_dev->dv_type == DEVT_DISK) {
if (disk_ioctl(dev, DIOCGMEDIASIZE, &disk_blocks) == 0) {
/* DIOCGMEDIASIZE does return bytes. */
disk_blocks /= blkio->Media->BlockSize;
diff --git a/stand/efi/libefi/efizfs.c b/stand/efi/libefi/efizfs.c
index 58a0d66..3d5400f 100644
--- a/stand/efi/libefi/efizfs.c
+++ b/stand/efi/libefi/efizfs.c
@@ -29,8 +29,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/disk.h>
-#include <stdint.h>
+#include <stand.h>
#ifdef EFI_ZFS_BOOT
#include <libzfs.h>
diff --git a/stand/efi/libefi/env.c b/stand/efi/libefi/env.c
index 6b2d176..0008232 100644
--- a/stand/efi/libefi/env.c
+++ b/stand/efi/libefi/env.c
@@ -35,35 +35,6 @@ __FBSDID("$FreeBSD$");
#include <stdbool.h>
#include "bootstrap.h"
-/*
- * Simple wrappers to the underlying UEFI functions.
- * See http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES
- * for details.
- */
-EFI_STATUS
-efi_get_next_variable_name(UINTN *variable_name_size, CHAR16 *variable_name,
- EFI_GUID *vendor_guid)
-{
- return (RS->GetNextVariableName(variable_name_size, variable_name,
- vendor_guid));
-}
-
-EFI_STATUS
-efi_get_variable(CHAR16 *variable_name, EFI_GUID *vendor_guid,
- UINT32 *attributes, UINTN *data_size, void *data)
-{
- return (RS->GetVariable(variable_name, vendor_guid, attributes,
- data_size, data));
-}
-
-EFI_STATUS
-efi_set_variable(CHAR16 *variable_name, EFI_GUID *vendor_guid,
- UINT32 attributes, UINTN data_size, void *data)
-{
- return (RS->SetVariable(variable_name, vendor_guid, attributes,
- data_size, data));
-}
-
void
efi_init_environment(void)
{
diff --git a/stand/efi/loader/arch/arm/exec.c b/stand/efi/loader/arch/arm/exec.c
index 83d3f2b..2de99a0 100644
--- a/stand/efi/loader/arch/arm/exec.c
+++ b/stand/efi/loader/arch/arm/exec.c
@@ -47,7 +47,7 @@ extern vm_offset_t md_load(char *, vm_offset_t *);
extern int bi_load(char *, vm_offset_t *, vm_offset_t *);
static int
-__elfN(arm_load)(char *filename, u_int64_t dest,
+__elfN(arm_load)(char *filename, uint64_t dest,
struct preloaded_file **result)
{
int r;
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index cd831c4..d313cb8 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -175,9 +175,7 @@ set_devdesc_currdev(struct devsw *dev, int unit)
char *devname;
currdev.d_dev = dev;
- currdev.d_type = currdev.d_dev->dv_type;
currdev.d_unit = unit;
- currdev.d_opendata = NULL;
devname = efi_fmtdev(&currdev);
env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev,
@@ -202,10 +200,8 @@ find_currdev(EFI_LOADED_IMAGE *img)
if (pool_guid != 0) {
struct zfs_devdesc currdev;
- currdev.d_dev = &zfs_dev;
- currdev.d_unit = 0;
- currdev.d_type = currdev.d_dev->dv_type;
- currdev.d_opendata = NULL;
+ currdev.dd.d_dev = &zfs_dev;
+ currdev.dd.d_unit = 0;
currdev.pool_guid = pool_guid;
currdev.root_guid = 0;
devname = efi_fmtdev(&currdev);
@@ -224,10 +220,8 @@ find_currdev(EFI_LOADED_IMAGE *img)
STAILQ_FOREACH(dp, pdi_list, pd_link) {
struct disk_devdesc currdev;
- currdev.d_dev = &efipart_hddev;
- currdev.d_type = currdev.d_dev->dv_type;
- currdev.d_unit = dp->pd_unit;
- currdev.d_opendata = NULL;
+ currdev.dd.d_dev = &efipart_hddev;
+ currdev.dd.d_unit = dp->pd_unit;
currdev.d_slice = -1;
currdev.d_partition = -1;
@@ -318,6 +312,12 @@ main(int argc, CHAR16 *argv[])
int i, j, vargood, howto;
UINTN k;
int has_kbd;
+ CHAR16 *text;
+ UINT16 boot_current;
+ size_t sz;
+ UINT16 boot_order[100];
+ EFI_DEVICE_PATH *imgpath;
+ EFI_STATUS status;
#if !defined(__arm__)
char buf[40];
#endif
@@ -479,6 +479,36 @@ main(int argc, CHAR16 *argv[])
printf("\n%s", bootprog_info);
+ text = efi_devpath_name(img->FilePath);
+ if (text != NULL) {
+ printf(" Load Path: %S\n", text);
+ efi_setenv_freebsd_wcs("LoaderPath", text);
+ efi_free_devpath_name(text);
+ }
+
+ status = BS->HandleProtocol(img->DeviceHandle, &devid, (void **)&imgpath);
+ if (status == EFI_SUCCESS) {
+ text = efi_devpath_name(imgpath);
+ if (text != NULL) {
+ printf(" Load Device: %S\n", text);
+ efi_setenv_freebsd_wcs("LoaderDev", text);
+ efi_free_devpath_name(text);
+ }
+ }
+
+ boot_current = 0;
+ sz = sizeof(boot_current);
+ efi_global_getenv("BootCurrent", &boot_current, &sz);
+ printf(" BootCurrent: %04x\n", boot_current);
+
+ sz = sizeof(boot_order);
+ efi_global_getenv("BootOrder", &boot_order, &sz);
+ printf(" BootOrder:");
+ for (i = 0; i < sz / sizeof(boot_order[0]); i++)
+ printf(" %04x%s", boot_order[i],
+ boot_order[i] == boot_current ? "[*]" : "");
+ printf("\n");
+
/*
* Disable the watchdog timer. By default the boot manager sets
* the timer to 5 minutes before invoking a boot option. If we
@@ -848,7 +878,7 @@ command_chain(int argc, char *argv[])
struct disk_devdesc *d_dev;
pdinfo_t *hd, *pd;
- switch (dev->d_type) {
+ switch (dev->d_dev->dv_type) {
#ifdef EFI_ZFS_BOOT
case DEVT_ZFS:
z_dev = (struct zfs_devdesc *)dev;
diff --git a/stand/ficl/aarch64/sysdep.c b/stand/ficl/aarch64/sysdep.c
index ad38660..43e7c3c 100644
--- a/stand/ficl/aarch64/sysdep.c
+++ b/stand/ficl/aarch64/sysdep.c
@@ -25,12 +25,12 @@
DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
{
DPUNS q;
- u_int64_t qx;
+ uint64_t qx;
- qx = (u_int64_t)x * (u_int64_t) y;
+ qx = (uint64_t)x * (uint64_t) y;
- q.hi = (u_int32_t)( qx >> 32 );
- q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
+ q.hi = (uint32_t)( qx >> 32 );
+ q.lo = (uint32_t)( qx & 0xFFFFFFFFL);
return q;
}
@@ -38,7 +38,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
{
UNSQR result;
- u_int64_t qx, qh;
+ uint64_t qx, qh;
qh = q.hi;
qx = (qh << 32) | q.lo;
diff --git a/stand/ficl/amd64/sysdep.c b/stand/ficl/amd64/sysdep.c
index 5957b71..68661c4 100644
--- a/stand/ficl/amd64/sysdep.c
+++ b/stand/ficl/amd64/sysdep.c
@@ -25,12 +25,12 @@
DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
{
DPUNS q;
- u_int64_t qx;
+ uint64_t qx;
- qx = (u_int64_t)x * (u_int64_t) y;
+ qx = (uint64_t)x * (uint64_t) y;
- q.hi = (u_int32_t)( qx >> 32 );
- q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
+ q.hi = (uint32_t)( qx >> 32 );
+ q.lo = (uint32_t)( qx & 0xFFFFFFFFL);
return q;
}
@@ -38,7 +38,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
{
UNSQR result;
- u_int64_t qx, qh;
+ uint64_t qx, qh;
qh = q.hi;
qx = (qh << 32) | q.lo;
diff --git a/stand/ficl/arm/sysdep.c b/stand/ficl/arm/sysdep.c
index ad38660..43e7c3c 100644
--- a/stand/ficl/arm/sysdep.c
+++ b/stand/ficl/arm/sysdep.c
@@ -25,12 +25,12 @@
DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
{
DPUNS q;
- u_int64_t qx;
+ uint64_t qx;
- qx = (u_int64_t)x * (u_int64_t) y;
+ qx = (uint64_t)x * (uint64_t) y;
- q.hi = (u_int32_t)( qx >> 32 );
- q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
+ q.hi = (uint32_t)( qx >> 32 );
+ q.lo = (uint32_t)( qx & 0xFFFFFFFFL);
return q;
}
@@ -38,7 +38,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
{
UNSQR result;
- u_int64_t qx, qh;
+ uint64_t qx, qh;
qh = q.hi;
qx = (qh << 32) | q.lo;
diff --git a/stand/ficl/i386/sysdep.c b/stand/ficl/i386/sysdep.c
index ea594e6..685c45b 100644
--- a/stand/ficl/i386/sysdep.c
+++ b/stand/ficl/i386/sysdep.c
@@ -28,12 +28,12 @@
DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
{
DPUNS q;
- u_int64_t qx;
+ uint64_t qx;
- qx = (u_int64_t)x * (u_int64_t) y;
+ qx = (uint64_t)x * (uint64_t) y;
- q.hi = (u_int32_t)( qx >> 32 );
- q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
+ q.hi = (uint32_t)( qx >> 32 );
+ q.lo = (uint32_t)( qx & 0xFFFFFFFFL);
return q;
}
@@ -41,7 +41,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
{
UNSQR result;
- u_int64_t qx, qh;
+ uint64_t qx, qh;
qh = q.hi;
qx = (qh << 32) | q.lo;
@@ -89,7 +89,7 @@ void
ficlOutb(FICL_VM *pVM)
{
u_char c;
- u_int32_t port;
+ uint32_t port;
port=stackPopUNS(pVM->pStack);
c=(u_char)stackPopINT(pVM->pStack);
@@ -104,7 +104,7 @@ void
ficlInb(FICL_VM *pVM)
{
u_char c;
- u_int32_t port;
+ uint32_t port;
port=stackPopUNS(pVM->pStack);
c=inb(port);
diff --git a/stand/ficl/mips/sysdep.c b/stand/ficl/mips/sysdep.c
index ad38660..43e7c3c 100644
--- a/stand/ficl/mips/sysdep.c
+++ b/stand/ficl/mips/sysdep.c
@@ -25,12 +25,12 @@
DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
{
DPUNS q;
- u_int64_t qx;
+ uint64_t qx;
- qx = (u_int64_t)x * (u_int64_t) y;
+ qx = (uint64_t)x * (uint64_t) y;
- q.hi = (u_int32_t)( qx >> 32 );
- q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
+ q.hi = (uint32_t)( qx >> 32 );
+ q.lo = (uint32_t)( qx & 0xFFFFFFFFL);
return q;
}
@@ -38,7 +38,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
{
UNSQR result;
- u_int64_t qx, qh;
+ uint64_t qx, qh;
qh = q.hi;
qx = (qh << 32) | q.lo;
diff --git a/stand/ficl/mips64/sysdep.c b/stand/ficl/mips64/sysdep.c
index ad38660..43e7c3c 100644
--- a/stand/ficl/mips64/sysdep.c
+++ b/stand/ficl/mips64/sysdep.c
@@ -25,12 +25,12 @@
DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
{
DPUNS q;
- u_int64_t qx;
+ uint64_t qx;
- qx = (u_int64_t)x * (u_int64_t) y;
+ qx = (uint64_t)x * (uint64_t) y;
- q.hi = (u_int32_t)( qx >> 32 );
- q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
+ q.hi = (uint32_t)( qx >> 32 );
+ q.lo = (uint32_t)( qx & 0xFFFFFFFFL);
return q;
}
@@ -38,7 +38,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
{
UNSQR result;
- u_int64_t qx, qh;
+ uint64_t qx, qh;
qh = q.hi;
qx = (qh << 32) | q.lo;
diff --git a/stand/ficl/powerpc/sysdep.c b/stand/ficl/powerpc/sysdep.c
index ad38660..43e7c3c 100644
--- a/stand/ficl/powerpc/sysdep.c
+++ b/stand/ficl/powerpc/sysdep.c
@@ -25,12 +25,12 @@
DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
{
DPUNS q;
- u_int64_t qx;
+ uint64_t qx;
- qx = (u_int64_t)x * (u_int64_t) y;
+ qx = (uint64_t)x * (uint64_t) y;
- q.hi = (u_int32_t)( qx >> 32 );
- q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
+ q.hi = (uint32_t)( qx >> 32 );
+ q.lo = (uint32_t)( qx & 0xFFFFFFFFL);
return q;
}
@@ -38,7 +38,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
{
UNSQR result;
- u_int64_t qx, qh;
+ uint64_t qx, qh;
qh = q.hi;
qx = (qh << 32) | q.lo;
diff --git a/stand/ficl/riscv/sysdep.c b/stand/ficl/riscv/sysdep.c
index ad38660..43e7c3c 100644
--- a/stand/ficl/riscv/sysdep.c
+++ b/stand/ficl/riscv/sysdep.c
@@ -25,12 +25,12 @@
DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
{
DPUNS q;
- u_int64_t qx;
+ uint64_t qx;
- qx = (u_int64_t)x * (u_int64_t) y;
+ qx = (uint64_t)x * (uint64_t) y;
- q.hi = (u_int32_t)( qx >> 32 );
- q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
+ q.hi = (uint32_t)( qx >> 32 );
+ q.lo = (uint32_t)( qx & 0xFFFFFFFFL);
return q;
}
@@ -38,7 +38,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
{
UNSQR result;
- u_int64_t qx, qh;
+ uint64_t qx, qh;
qh = q.hi;
qx = (qh << 32) | q.lo;
diff --git a/stand/ficl/sparc64/sysdep.c b/stand/ficl/sparc64/sysdep.c
index ad38660..43e7c3c 100644
--- a/stand/ficl/sparc64/sysdep.c
+++ b/stand/ficl/sparc64/sysdep.c
@@ -25,12 +25,12 @@
DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
{
DPUNS q;
- u_int64_t qx;
+ uint64_t qx;
- qx = (u_int64_t)x * (u_int64_t) y;
+ qx = (uint64_t)x * (uint64_t) y;
- q.hi = (u_int32_t)( qx >> 32 );
- q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
+ q.hi = (uint32_t)( qx >> 32 );
+ q.lo = (uint32_t)( qx & 0xFFFFFFFFL);
return q;
}
@@ -38,7 +38,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
{
UNSQR result;
- u_int64_t qx, qh;
+ uint64_t qx, qh;
qh = q.hi;
qx = (qh << 32) | q.lo;
diff --git a/stand/i386/btx/lib/btxv86.h b/stand/i386/btx/lib/btxv86.h
index f04ce5e..0dca768 100644
--- a/stand/i386/btx/lib/btxv86.h
+++ b/stand/i386/btx/lib/btxv86.h
@@ -58,13 +58,13 @@ void __v86int(void);
#define v86 __v86
#define v86int __v86int
-extern u_int32_t __base;
-extern u_int32_t __args;
+extern uint32_t __base;
+extern uint32_t __args;
#define PTOV(pa) ((caddr_t)(pa) - __base)
#define VTOP(va) ((vm_offset_t)(va) + __base)
-#define VTOPSEG(va) (u_int16_t)(VTOP((caddr_t)va) >> 4)
-#define VTOPOFF(va) (u_int16_t)(VTOP((caddr_t)va) & 0xf)
+#define VTOPSEG(va) (uint16_t)(VTOP((caddr_t)va) >> 4)
+#define VTOPOFF(va) (uint16_t)(VTOP((caddr_t)va) & 0xf)
#define V86_CY(x) ((x) & PSL_C)
#define V86_ZR(x) ((x) & PSL_Z)
diff --git a/stand/i386/libi386/biosacpi.c b/stand/i386/libi386/biosacpi.c
index 8167fca..236c3fc 100644
--- a/stand/i386/libi386/biosacpi.c
+++ b/stand/i386/libi386/biosacpi.c
@@ -122,7 +122,7 @@ static ACPI_TABLE_RSDP *
biosacpi_search_rsdp(char *base, int length)
{
ACPI_TABLE_RSDP *rsdp;
- u_int8_t *cp, sum;
+ uint8_t *cp, sum;
int ofs, idx;
/* search on 16-byte boundaries */
@@ -131,7 +131,7 @@ biosacpi_search_rsdp(char *base, int length)
/* compare signature, validate checksum */
if (!strncmp(rsdp->Signature, ACPI_SIG_RSDP, strlen(ACPI_SIG_RSDP))) {
- cp = (u_int8_t *)rsdp;
+ cp = (uint8_t *)rsdp;
sum = 0;
for (idx = 0; idx < RSDP_CHECKSUM_LENGTH; idx++)
sum += *(cp + idx);
diff --git a/stand/i386/libi386/bioscd.c b/stand/i386/libi386/bioscd.c
index 2e8fc3b..a451f16 100644
--- a/stand/i386/libi386/bioscd.c
+++ b/stand/i386/libi386/bioscd.c
@@ -90,7 +90,7 @@ static struct bcinfo {
} bcinfo [MAXBCDEV];
static int nbcinfo = 0;
-#define BC(dev) (bcinfo[(dev)->d_unit])
+#define BC(dev) (bcinfo[(dev)->dd.d_unit])
static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest);
static int bc_init(void);
@@ -211,7 +211,7 @@ bc_open(struct open_file *f, ...)
va_start(ap, f);
dev = va_arg(ap, struct i386_devdesc *);
va_end(ap);
- if (dev->d_unit >= nbcinfo) {
+ if (dev->dd.d_unit >= nbcinfo) {
DEBUG("attempt to open nonexistent disk");
return(ENXIO);
}
@@ -271,7 +271,7 @@ bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
if ((rw & F_MASK) != F_READ)
return(EROFS);
dev = (struct i386_devdesc *)devdata;
- unit = dev->d_unit;
+ unit = dev->dd.d_unit;
blks = size / BIOSCD_SECSIZE;
if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0)
return (EINVAL);
@@ -427,7 +427,7 @@ bc_getdev(struct i386_devdesc *dev)
int major;
int rootdev;
- unit = dev->d_unit;
+ unit = dev->dd.d_unit;
biosdev = bc_unit2bios(unit);
DEBUG("unit %d BIOS device %d", unit, biosdev);
if (biosdev == -1) /* not a BIOS device */
diff --git a/stand/i386/libi386/biosdisk.c b/stand/i386/libi386/biosdisk.c
index 9c54d43..eb1f688 100644
--- a/stand/i386/libi386/biosdisk.c
+++ b/stand/i386/libi386/biosdisk.c
@@ -120,7 +120,7 @@ static struct bdinfo
} bdinfo [MAXBDDEV];
static int nbdinfo = 0;
-#define BD(dev) (bdinfo[(dev)->d_unit])
+#define BD(dev) (bdinfo[(dev)->dd.d_unit])
static void bd_io_workaround(struct disk_devdesc *dev);
@@ -351,8 +351,8 @@ bd_print(int verbose)
bdinfo[i].bd_sectorsize);
if ((ret = pager_output(line)) != 0)
break;
- dev.d_dev = &biosdisk;
- dev.d_unit = i;
+ dev.dd.d_dev = &biosdisk;
+ dev.dd.d_unit = i;
dev.d_slice = -1;
dev.d_partition = -1;
if (disk_open(&dev,
@@ -391,7 +391,7 @@ bd_open(struct open_file *f, ...)
dev = va_arg(ap, struct disk_devdesc *);
va_end(ap);
- if (dev->d_unit < 0 || dev->d_unit >= nbdinfo)
+ if (dev->dd.d_unit < 0 || dev->dd.d_unit >= nbdinfo)
return (EIO);
BD(dev).bd_open++;
if (BD(dev).bd_bcache == NULL)
@@ -404,10 +404,8 @@ bd_open(struct open_file *f, ...)
* During bd_probe() we tested if the mulitplication of bd_sectors
* would overflow so it should be safe to perform here.
*/
- disk.d_dev = dev->d_dev;
- disk.d_type = dev->d_type;
- disk.d_unit = dev->d_unit;
- disk.d_opendata = NULL;
+ disk.dd.d_dev = dev->dd.d_dev;
+ disk.dd.d_unit = dev->dd.d_unit;
disk.d_slice = -1;
disk.d_partition = -1;
disk.d_offset = 0;
@@ -433,7 +431,7 @@ bd_open(struct open_file *f, ...)
return (err);
/* if we already know there is no GELI, skip the rest */
- if (geli_status[dev->d_unit][dev->d_slice] != ISGELI_UNKNOWN)
+ if (geli_status[dev->dd.d_unit][dev->d_slice] != ISGELI_UNKNOWN)
return (err);
struct dsk dskp;
@@ -442,9 +440,9 @@ bd_open(struct open_file *f, ...)
struct pentry *entry;
int geli_part = 0;
- dskp.drive = bd_unit2bios(dev->d_unit);
- dskp.type = dev->d_type;
- dskp.unit = dev->d_unit;
+ dskp.drive = bd_unit2bios(dev->dd.d_unit);
+ dskp.type = dev->dd.d_dev->dv_type;
+ dskp.unit = dev->dd.d_unit;
dskp.slice = dev->d_slice;
dskp.part = dev->d_partition;
dskp.start = dev->d_offset;
@@ -468,13 +466,13 @@ bd_open(struct open_file *f, ...)
dskp.slice = entry->part.index;
dskp.start = entry->part.start;
if (is_geli(&dskp) == 0) {
- geli_status[dev->d_unit][dskp.slice] = ISGELI_YES;
+ geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_YES;
return (0);
}
if (geli_taste(bios_read, &dskp,
entry->part.end - entry->part.start) == 0) {
if (geli_havekey(&dskp) == 0) {
- geli_status[dev->d_unit][dskp.slice] = ISGELI_YES;
+ geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_YES;
geli_part++;
continue;
}
@@ -488,18 +486,18 @@ bd_open(struct open_file *f, ...)
&dskp) == 0) {
setenv("kern.geom.eli.passphrase", gelipw, 1);
bzero(gelipw, sizeof(gelipw));
- geli_status[dev->d_unit][dskp.slice] = ISGELI_YES;
+ geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_YES;
geli_part++;
continue;
}
} else
- geli_status[dev->d_unit][dskp.slice] = ISGELI_NO;
+ geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_NO;
}
/* none of the partitions on this disk have GELI */
if (geli_part == 0) {
/* found no GELI */
- geli_status[dev->d_unit][dev->d_slice] = ISGELI_NO;
+ geli_status[dev->dd.d_unit][dev->d_slice] = ISGELI_NO;
}
#endif /* LOADER_GELI_SUPPORT */
@@ -856,10 +854,10 @@ bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest)
char *tmpbuf;
/* if we already know there is no GELI, skip the rest */
- if (geli_status[dev->d_unit][dev->d_slice] != ISGELI_YES)
+ if (geli_status[dev->dd.d_unit][dev->d_slice] != ISGELI_YES)
return (bd_io(dev, dblk, blks, dest, 0));
- if (geli_status[dev->d_unit][dev->d_slice] == ISGELI_YES) {
+ if (geli_status[dev->dd.d_unit][dev->d_slice] == ISGELI_YES) {
/*
* Align reads to DEV_GELIBOOT_BSIZE bytes because partial
* sectors cannot be decrypted. Round the requested LBA down to
@@ -893,9 +891,9 @@ bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest)
if (err)
return (err);
- dskp.drive = bd_unit2bios(dev->d_unit);
- dskp.type = dev->d_type;
- dskp.unit = dev->d_unit;
+ dskp.drive = bd_unit2bios(dev->dd.d_unit);
+ dskp.type = dev->dd.d_dev->dv_type;
+ dskp.unit = dev->dd.d_unit;
dskp.slice = dev->d_slice;
dskp.part = dev->d_partition;
dskp.start = dev->d_offset;
@@ -940,7 +938,7 @@ bd_write(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest)
* disk. And, incidentally, what is returned is not the geometry as
* such but the highest valid cylinder, head, and sector numbers.
*/
-u_int32_t
+uint32_t
bd_getbigeom(int bunit)
{
@@ -972,8 +970,8 @@ bd_getdev(struct i386_devdesc *d)
int i, unit;
dev = (struct disk_devdesc *)d;
- biosdev = bd_unit2bios(dev->d_unit);
- DEBUG("unit %d BIOS device %d", dev->d_unit, biosdev);
+ biosdev = bd_unit2bios(dev->dd.d_unit);
+ DEBUG("unit %d BIOS device %d", dev->dd.d_unit, biosdev);
if (biosdev == -1) /* not a BIOS device */
return(-1);
if (disk_open(dev, BD(dev).bd_sectors * BD(dev).bd_sectorsize,
@@ -984,7 +982,7 @@ bd_getdev(struct i386_devdesc *d)
if (biosdev < 0x80) {
/* floppy (or emulated floppy) or ATAPI device */
- if (bdinfo[dev->d_unit].bd_type == DT_ATAPI) {
+ if (bdinfo[dev->dd.d_unit].bd_type == DT_ATAPI) {
/* is an ATAPI disk */
major = WFDMAJOR;
} else {
@@ -1018,9 +1016,8 @@ bios_read(void *vdev __unused, void *xpriv, off_t off, void *buf, size_t bytes)
struct disk_devdesc dev;
struct dsk *priv = xpriv;
- dev.d_dev = &biosdisk;
- dev.d_type = priv->type;
- dev.d_unit = priv->unit;
+ dev.dd.d_dev = &biosdisk;
+ dev.dd.d_unit = priv->unit;
dev.d_slice = priv->slice;
dev.d_partition = priv->part;
dev.d_offset = priv->start;
diff --git a/stand/i386/libi386/biospnp.c b/stand/i386/libi386/biospnp.c
index 30e55fc..6cd381b 100644
--- a/stand/i386/libi386/biospnp.c
+++ b/stand/i386/libi386/biospnp.c
@@ -49,49 +49,49 @@ struct pnphandler biospnphandler =
struct pnp_ICstructure
{
- u_int8_t pnp_signature[4];
- u_int8_t pnp_version;
- u_int8_t pnp_length;
- u_int16_t pnp_BIOScontrol;
- u_int8_t pnp_checksum;
- u_int32_t pnp_eventflag;
- u_int16_t pnp_rmip;
- u_int16_t pnp_rmcs;
- u_int16_t pnp_pmip;
- u_int32_t pnp_pmcs;
- u_int8_t pnp_OEMdev[4];
- u_int16_t pnp_rmds;
- u_int32_t pnp_pmds;
+ uint8_t pnp_signature[4];
+ uint8_t pnp_version;
+ uint8_t pnp_length;
+ uint16_t pnp_BIOScontrol;
+ uint8_t pnp_checksum;
+ uint32_t pnp_eventflag;
+ uint16_t pnp_rmip;
+ uint16_t pnp_rmcs;
+ uint16_t pnp_pmip;
+ uint32_t pnp_pmcs;
+ uint8_t pnp_OEMdev[4];
+ uint16_t pnp_rmds;
+ uint32_t pnp_pmds;
} __packed;
struct pnp_devNode
{
- u_int16_t dn_size;
- u_int8_t dn_handle;
- u_int8_t dn_id[4];
- u_int8_t dn_type[3];
- u_int16_t dn_attrib;
- u_int8_t dn_data[1];
+ uint16_t dn_size;
+ uint8_t dn_handle;
+ uint8_t dn_id[4];
+ uint8_t dn_type[3];
+ uint16_t dn_attrib;
+ uint8_t dn_data[1];
} __packed;
struct pnp_isaConfiguration
{
- u_int8_t ic_revision;
- u_int8_t ic_nCSN;
- u_int16_t ic_rdport;
- u_int16_t ic_reserved;
+ uint8_t ic_revision;
+ uint8_t ic_nCSN;
+ uint16_t ic_rdport;
+ uint16_t ic_reserved;
} __packed;
static struct pnp_ICstructure *pnp_Icheck = NULL;
-static u_int16_t pnp_NumNodes;
-static u_int16_t pnp_NodeSize;
+static uint16_t pnp_NumNodes;
+static uint16_t pnp_NodeSize;
static void biospnp_scanresdata(struct pnpinfo *pi, struct pnp_devNode *dn);
static int biospnp_call(int func, const char *fmt, ...);
-#define vsegofs(vptr) (((u_int32_t)VTOPSEG(vptr) << 16) + VTOPOFF(vptr))
+#define vsegofs(vptr) (((uint32_t)VTOPSEG(vptr) << 16) + VTOPOFF(vptr))
-typedef void v86bios_t(u_int32_t, u_int32_t, u_int32_t, u_int32_t);
+typedef void v86bios_t(uint32_t, uint32_t, uint32_t, uint32_t);
v86bios_t *v86bios = (v86bios_t *)v86int;
#define biospnp_f00(NumNodes, NodeSize) biospnp_call(0x00, "ll", NumNodes, NodeSize)
@@ -155,7 +155,7 @@ biospnp_init(void)
static void
biospnp_enumerate(void)
{
- u_int8_t Node;
+ uint8_t Node;
struct pnp_devNode *devNodeBuffer;
int result;
struct pnpinfo *pi;
@@ -189,11 +189,11 @@ static void
biospnp_scanresdata(struct pnpinfo *pi, struct pnp_devNode *dn)
{
u_int tag, i, rlen, dlen;
- u_int8_t *p;
+ uint8_t *p;
char *str;
p = dn->dn_data; /* point to resource data */
- dlen = dn->dn_size - (p - (u_int8_t *)dn); /* length of resource data */
+ dlen = dn->dn_size - (p - (uint8_t *)dn); /* length of resource data */
for (i = 0; i < dlen; i+= rlen) {
tag = p[i];
@@ -213,8 +213,8 @@ biospnp_scanresdata(struct pnpinfo *pi, struct pnp_devNode *dn)
}
} else {
/* large resource */
- rlen = *(u_int16_t *)(p + i);
- i += sizeof(u_int16_t);
+ rlen = *(uint16_t *)(p + i);
+ i += sizeof(uint16_t);
switch(PNP_LRES_NUM(tag)) {
@@ -249,14 +249,14 @@ biospnp_call(int func, const char *fmt, ...)
{
va_list ap;
const char *p;
- u_int8_t *argp;
- u_int32_t args[4];
- u_int32_t i;
+ uint8_t *argp;
+ uint32_t args[4];
+ uint32_t i;
/* function number first */
- argp = (u_int8_t *)args;
- *(u_int16_t *)argp = func;
- argp += sizeof(u_int16_t);
+ argp = (uint8_t *)args;
+ *(uint16_t *)argp = func;
+ argp += sizeof(uint16_t);
/* take args according to format */
va_start(ap, fmt);
@@ -265,26 +265,26 @@ biospnp_call(int func, const char *fmt, ...)
case 'w':
i = va_arg(ap, u_int);
- *(u_int16_t *)argp = i;
- argp += sizeof(u_int16_t);
+ *(uint16_t *)argp = i;
+ argp += sizeof(uint16_t);
break;
case 'l':
- i = va_arg(ap, u_int32_t);
- *(u_int32_t *)argp = i;
- argp += sizeof(u_int32_t);
+ i = va_arg(ap, uint32_t);
+ *(uint32_t *)argp = i;
+ argp += sizeof(uint32_t);
break;
}
}
va_end(ap);
/* BIOS segment last */
- *(u_int16_t *)argp = pnp_Icheck->pnp_rmds;
- argp += sizeof(u_int16_t);
+ *(uint16_t *)argp = pnp_Icheck->pnp_rmds;
+ argp += sizeof(uint16_t);
/* prepare for call */
v86.ctl = V86_ADDR | V86_CALLF;
- v86.addr = ((u_int32_t)pnp_Icheck->pnp_rmcs << 16) + pnp_Icheck->pnp_rmip;
+ v86.addr = ((uint32_t)pnp_Icheck->pnp_rmcs << 16) + pnp_Icheck->pnp_rmip;
/* call with packed stack and return */
v86bios(args[0], args[1], args[2], args[3]);
diff --git a/stand/i386/libi386/bootinfo32.c b/stand/i386/libi386/bootinfo32.c
index 494688f..c185144 100644
--- a/stand/i386/libi386/bootinfo32.c
+++ b/stand/i386/libi386/bootinfo32.c
@@ -63,7 +63,7 @@ static struct bootinfo bi;
* MOD_METADATA (variable) type-specific metadata
*/
#define COPY32(v, a, c) { \
- u_int32_t x = (v); \
+ uint32_t x = (v); \
if (c) \
i386_copyin(&x, a, sizeof(x)); \
a += sizeof(x); \
@@ -181,16 +181,16 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t
/* XXX - use a default bootdev of 0. Is this ok??? */
bootdevnr = 0;
- switch(rootdev->d_type) {
+ switch(rootdev->dd.d_dev->dv_type) {
case DEVT_CD:
/* Pass in BIOS device number. */
- bi.bi_bios_dev = bc_unit2bios(rootdev->d_unit);
+ bi.bi_bios_dev = bc_unit2bios(rootdev->dd.d_unit);
bootdevnr = bc_getdev(rootdev);
break;
case DEVT_DISK:
/* pass in the BIOS device number of the current disk */
- bi.bi_bios_dev = bd_unit2bios(rootdev->d_unit);
+ bi.bi_bios_dev = bd_unit2bios(rootdev->dd.d_unit);
bootdevnr = bd_getdev(rootdev);
break;
@@ -199,7 +199,8 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t
break;
default:
- printf("WARNING - don't know how to boot from device type %d\n", rootdev->d_type);
+ printf("WARNING - don't know how to boot from device type %d\n",
+ rootdev->dd.d_dev->dv_type);
}
if (bootdevnr == -1) {
printf("root device %s invalid\n", i386_fmtdev(rootdev));
diff --git a/stand/i386/libi386/bootinfo64.c b/stand/i386/libi386/bootinfo64.c
index 02fcf72..80bb835 100644
--- a/stand/i386/libi386/bootinfo64.c
+++ b/stand/i386/libi386/bootinfo64.c
@@ -64,7 +64,7 @@ static const size_t keybuf_size = sizeof(struct keybuf) +
* MOD_METADATA (variable) type-specific metadata
*/
#define COPY32(v, a, c) { \
- u_int32_t x = (v); \
+ uint32_t x = (v); \
if (c) \
i386_copyin(&x, a, sizeof(x)); \
a += sizeof(x); \
@@ -75,7 +75,7 @@ static const size_t keybuf_size = sizeof(struct keybuf) +
COPY32(strlen(s) + 1, a, c); \
if (c) \
i386_copyin(s, a, strlen(s) + 1); \
- a += roundup(strlen(s) + 1, sizeof(u_int64_t));\
+ a += roundup(strlen(s) + 1, sizeof(uint64_t));\
}
#define MOD_NAME(a, s, c) MOD_STR(MODINFO_NAME, a, s, c)
@@ -87,7 +87,7 @@ static const size_t keybuf_size = sizeof(struct keybuf) +
COPY32(sizeof(s), a, c); \
if (c) \
i386_copyin(&s, a, sizeof(s)); \
- a += roundup(sizeof(s), sizeof(u_int64_t)); \
+ a += roundup(sizeof(s), sizeof(uint64_t)); \
}
#define MOD_ADDR(a, s, c) MOD_VAR(MODINFO_ADDR, a, s, c)
@@ -98,7 +98,7 @@ static const size_t keybuf_size = sizeof(struct keybuf) +
COPY32(mm->md_size, a, c); \
if (c) \
i386_copyin(mm->md_data, a, mm->md_size); \
- a += roundup(mm->md_size, sizeof(u_int64_t));\
+ a += roundup(mm->md_size, sizeof(uint64_t));\
}
#define MOD_END(a, c) { \
@@ -112,7 +112,7 @@ bi_copymodules64(vm_offset_t addr)
struct preloaded_file *fp;
struct file_metadata *md;
int c;
- u_int64_t v;
+ uint64_t v;
c = addr != 0;
/* start with the first module on the list, should be the kernel */
@@ -190,9 +190,9 @@ bi_load64(char *args, vm_offset_t addr, vm_offset_t *modulep,
struct preloaded_file *xp, *kfp;
struct i386_devdesc *rootdev;
struct file_metadata *md;
- u_int64_t kernend;
- u_int64_t envp;
- u_int64_t module;
+ uint64_t kernend;
+ uint64_t envp;
+ uint64_t module;
vm_offset_t size;
char *rootdevname;
int howto;
diff --git a/stand/i386/libi386/devicename.c b/stand/i386/libi386/devicename.c
index c7705d7..9780d59 100644
--- a/stand/i386/libi386/devicename.c
+++ b/stand/i386/libi386/devicename.c
@@ -135,7 +135,7 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
goto fail;
}
- idev->d_unit = unit;
+ idev->dd.d_unit = unit;
if (path != NULL)
*path = (*cp == 0) ? cp : cp + 1;
break;
@@ -148,8 +148,7 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
err = EINVAL;
goto fail;
}
- idev->d_dev = dv;
- idev->d_type = dv->dv_type;
+ idev->dd.d_dev = dv;
if (dev == NULL) {
free(idev);
} else {
@@ -169,14 +168,14 @@ i386_fmtdev(void *vdev)
struct i386_devdesc *dev = (struct i386_devdesc *)vdev;
static char buf[128]; /* XXX device length constant? */
- switch(dev->d_type) {
+ switch(dev->dd.d_dev->dv_type) {
case DEVT_NONE:
strcpy(buf, "(no device)");
break;
case DEVT_CD:
case DEVT_NET:
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+ sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
break;
case DEVT_DISK:
diff --git a/stand/i386/libi386/elf64_freebsd.c b/stand/i386/libi386/elf64_freebsd.c
index 338a745..47e83e8 100644
--- a/stand/i386/libi386/elf64_freebsd.c
+++ b/stand/i386/libi386/elf64_freebsd.c
@@ -51,15 +51,15 @@ struct file_format amd64_elf_obj = { elf64_obj_loadfile, elf64_obj_exec };
#define PG_U 0x004
#define PG_PS 0x080
-typedef u_int64_t p4_entry_t;
-typedef u_int64_t p3_entry_t;
-typedef u_int64_t p2_entry_t;
+typedef uint64_t p4_entry_t;
+typedef uint64_t p3_entry_t;
+typedef uint64_t p2_entry_t;
extern p4_entry_t PT4[];
extern p3_entry_t PT3[];
extern p2_entry_t PT2[];
-u_int32_t entry_hi;
-u_int32_t entry_lo;
+uint32_t entry_hi;
+uint32_t entry_lo;
extern void amd64_tramp();
diff --git a/stand/i386/libi386/libi386.h b/stand/i386/libi386/libi386.h
index 297d493..da1ba4d 100644
--- a/stand/i386/libi386/libi386.h
+++ b/stand/i386/libi386/libi386.h
@@ -29,31 +29,21 @@
/*
* i386 fully-qualified device descriptor.
- * Note, this must match the 'struct devdesc' declaration
- * in bootstrap.h and also with struct zfs_devdesc for zfs
- * support.
+ * Note, this must match struct zfs_devdesc for zfs support.
*/
-struct i386_devdesc
-{
- struct devsw *d_dev;
- int d_type;
- int d_unit;
+/* Note: Must match the 'struct devdesc' in stand.h */
+struct i386_devdesc {
+ struct devdesc dd;
union
{
struct
{
- void *data;
int slice;
int partition;
off_t offset;
} biosdisk;
struct
{
- void *data;
- } bioscd;
- struct
- {
- void *data;
uint64_t pool_guid;
uint64_t root_guid;
} zfs;
diff --git a/stand/i386/libi386/multiboot.c b/stand/i386/libi386/multiboot.c
index 252a1f5..a29696e 100644
--- a/stand/i386/libi386/multiboot.c
+++ b/stand/i386/libi386/multiboot.c
@@ -61,16 +61,16 @@ __FBSDID("$FreeBSD$");
#define METADATA_RESV_SIZE(mod_num) \
roundup(METADATA_FIXED_SIZE + METADATA_MODULE_SIZE * mod_num, PAGE_SIZE)
-extern int elf32_loadfile_raw(char *filename, u_int64_t dest,
+extern int elf32_loadfile_raw(char *filename, uint64_t dest,
struct preloaded_file **result, int multiboot);
-extern int elf64_load_modmetadata(struct preloaded_file *fp, u_int64_t dest);
-extern int elf64_obj_loadfile(char *filename, u_int64_t dest,
+extern int elf64_load_modmetadata(struct preloaded_file *fp, uint64_t dest);
+extern int elf64_obj_loadfile(char *filename, uint64_t dest,
struct preloaded_file **result);
-static int multiboot_loadfile(char *, u_int64_t, struct preloaded_file **);
+static int multiboot_loadfile(char *, uint64_t, struct preloaded_file **);
static int multiboot_exec(struct preloaded_file *);
-static int multiboot_obj_loadfile(char *, u_int64_t, struct preloaded_file **);
+static int multiboot_obj_loadfile(char *, uint64_t, struct preloaded_file **);
static int multiboot_obj_exec(struct preloaded_file *fp);
struct file_format multiboot = { multiboot_loadfile, multiboot_exec };
@@ -108,7 +108,7 @@ max_addr(void)
}
static int
-multiboot_loadfile(char *filename, u_int64_t dest,
+multiboot_loadfile(char *filename, uint64_t dest,
struct preloaded_file **result)
{
uint32_t *magic;
@@ -394,7 +394,7 @@ error:
}
static int
-multiboot_obj_loadfile(char *filename, u_int64_t dest,
+multiboot_obj_loadfile(char *filename, uint64_t dest,
struct preloaded_file **result)
{
struct preloaded_file *mfp, *kfp, *rfp;
diff --git a/stand/i386/libi386/pxe.c b/stand/i386/libi386/pxe.c
index 7cb4833..17c831c 100644
--- a/stand/i386/libi386/pxe.c
+++ b/stand/i386/libi386/pxe.c
@@ -85,11 +85,11 @@ static ssize_t pxe_netif_put(struct iodesc *desc, void *pkt, size_t len);
static void pxe_netif_end(struct netif *nif);
extern struct netif_stats pxe_st[];
-extern u_int16_t __bangpxeseg;
-extern u_int16_t __bangpxeoff;
+extern uint16_t __bangpxeseg;
+extern uint16_t __bangpxeoff;
extern void __bangpxeentry(void);
-extern u_int16_t __pxenvseg;
-extern u_int16_t __pxenvoff;
+extern uint16_t __pxenvseg;
+extern uint16_t __pxenvoff;
extern void __pxenventry(void);
struct netif_dif pxe_ifs[] = {
diff --git a/stand/i386/loader/chain.c b/stand/i386/loader/chain.c
index d6810ef..5b61528 100644
--- a/stand/i386/loader/chain.c
+++ b/stand/i386/loader/chain.c
@@ -111,7 +111,7 @@ command_chain(int argc, char *argv[])
relocater_data[0].dest = 0x7C00;
relocater_data[0].size = SECTOR_SIZE;
- relocator_edx = bd_unit2bios(rootdev->d_unit);
+ relocator_edx = bd_unit2bios(rootdev->dd.d_unit);
relocator_esi = relocater_size;
relocator_ds = 0;
relocator_es = 0;
diff --git a/stand/i386/loader/main.c b/stand/i386/loader/main.c
index 635f160..2fc1728 100644
--- a/stand/i386/loader/main.c
+++ b/stand/i386/loader/main.c
@@ -60,8 +60,8 @@ CTASSERT(offsetof(struct bootinfo, bi_size) == BI_SIZE);
/* Arguments passed in from the boot1/boot2 loader */
static struct bootargs *kargs;
-static u_int32_t initial_howto;
-static u_int32_t initial_bootdev;
+static uint32_t initial_howto;
+static uint32_t initial_bootdev;
static struct bootinfo *initial_bootinfo;
struct arch_switch archsw; /* MI/MD interface boundary */
@@ -254,18 +254,18 @@ extract_currdev(void)
int biosdev = -1;
/* Assume we are booting from a BIOS disk by default */
- new_currdev.d_dev = &biosdisk;
+ new_currdev.dd.d_dev = &biosdisk;
/* new-style boot loaders such as pxeldr and cdldr */
if (kargs->bootinfo == 0) {
if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) {
/* we are booting from a CD with cdboot */
- new_currdev.d_dev = &bioscd;
- new_currdev.d_unit = bc_bios2unit(initial_bootdev);
+ new_currdev.dd.d_dev = &bioscd;
+ new_currdev.dd.d_unit = bc_bios2unit(initial_bootdev);
} else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) {
/* we are booting from pxeldr */
- new_currdev.d_dev = &pxedisk;
- new_currdev.d_unit = 0;
+ new_currdev.dd.d_dev = &pxedisk;
+ new_currdev.dd.d_unit = 0;
} else {
/* we don't know what our boot device is */
new_currdev.d_kind.biosdisk.slice = -1;
@@ -295,7 +295,7 @@ extract_currdev(void)
new_currdev.d_kind.zfs.pool_guid = kargs->zfspool;
new_currdev.d_kind.zfs.root_guid = 0;
}
- new_currdev.d_dev = &zfs_dev;
+ new_currdev.dd.d_dev = &zfs_dev;
#endif
} else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) {
/* The passed-in boot device is bad */
@@ -316,21 +316,20 @@ extract_currdev(void)
if ((biosdev == 0) && (B_TYPE(initial_bootdev) != 2)) /* biosdev doesn't match major */
biosdev = 0x80 + B_UNIT(initial_bootdev); /* assume harddisk */
}
- new_currdev.d_type = new_currdev.d_dev->dv_type;
/*
* If we are booting off of a BIOS disk and we didn't succeed in determining
* which one we booted off of, just use disk0: as a reasonable default.
*/
- if ((new_currdev.d_type == biosdisk.dv_type) &&
- ((new_currdev.d_unit = bd_bios2unit(biosdev)) == -1)) {
+ if ((new_currdev.dd.d_dev->dv_type == biosdisk.dv_type) &&
+ ((new_currdev.dd.d_unit = bd_bios2unit(biosdev)) == -1)) {
printf("Can't work out which disk we are booting from.\n"
"Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev);
- new_currdev.d_unit = 0;
+ new_currdev.dd.d_unit = 0;
}
#ifdef LOADER_ZFS_SUPPORT
- if (new_currdev.d_type == DEVT_ZFS)
+ if (new_currdev.dd.d_dev->dv_type == DEVT_ZFS)
init_zfs_bootenv(zfs_fmtdev(&new_currdev));
#endif
diff --git a/stand/libsa/arp.c b/stand/libsa/arp.c
index b24da3d..626ee34 100644
--- a/stand/libsa/arp.c
+++ b/stand/libsa/arp.c
@@ -164,7 +164,7 @@ arprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft, void *extra)
{
ssize_t n;
struct ether_arp *ah;
- u_int16_t etype; /* host order */
+ uint16_t etype; /* host order */
void *ptr;
#ifdef ARP_DEBUG
diff --git a/stand/libsa/bootp.c b/stand/libsa/bootp.c
index 7546e8d..fd4477e 100644
--- a/stand/libsa/bootp.c
+++ b/stand/libsa/bootp.c
@@ -190,7 +190,7 @@ bootp(int sock)
#ifdef SUPPORT_DHCP
if(dhcp_ok) {
- u_int32_t leasetime;
+ uint32_t leasetime;
bp->bp_vend[6] = DHCPREQUEST;
bp->bp_vend[7] = TAG_REQ_ADDR;
bp->bp_vend[8] = 4;
diff --git a/stand/libsa/bootparam.c b/stand/libsa/bootparam.c
index 1de2d53..30e109e 100644
--- a/stand/libsa/bootparam.c
+++ b/stand/libsa/bootparam.c
@@ -77,7 +77,7 @@ n_short bp_server_port; /* net order */
* (Note, really four ints, NOT chars. Blech.)
*/
struct xdr_inaddr {
- u_int32_t atype;
+ uint32_t atype;
int32_t addr[4];
};
@@ -108,16 +108,16 @@ bp_whoami(int sockfd)
{
/* RPC structures for PMAPPROC_CALLIT */
struct args {
- u_int32_t prog;
- u_int32_t vers;
- u_int32_t proc;
- u_int32_t arglen;
+ uint32_t prog;
+ uint32_t vers;
+ uint32_t proc;
+ uint32_t arglen;
struct xdr_inaddr xina;
} *args;
struct repl {
- u_int16_t _pad;
- u_int16_t port;
- u_int32_t encap_len;
+ uint16_t _pad;
+ uint16_t port;
+ uint32_t encap_len;
/* encapsulated data here */
n_long capsule[64];
} *repl;
diff --git a/stand/libsa/dosfs.h b/stand/libsa/dosfs.h
index 5b11e0f..30bb435 100644
--- a/stand/libsa/dosfs.h
+++ b/stand/libsa/dosfs.h
@@ -47,12 +47,12 @@
* Macros to convert DOS-format 16-bit and 32-bit quantities
*/
-#define cv2(p) ((u_int16_t)(p)[0] | \
- ((u_int16_t)(p)[1] << 010))
-#define cv4(p) ((u_int32_t)(p)[0] | \
- ((u_int32_t)(p)[1] << 010) | \
- ((u_int32_t)(p)[2] << 020) | \
- ((u_int32_t)(p)[3] << 030))
+#define cv2(p) ((uint16_t)(p)[0] | \
+ ((uint16_t)(p)[1] << 010))
+#define cv4(p) ((uint32_t)(p)[0] | \
+ ((uint32_t)(p)[1] << 010) | \
+ ((uint32_t)(p)[2] << 020) | \
+ ((uint32_t)(p)[3] << 030))
/*
* Directory, filesystem, and file structures.
diff --git a/stand/libsa/ext2fs.c b/stand/libsa/ext2fs.c
index d0b91e0..21865dd 100644
--- a/stand/libsa/ext2fs.c
+++ b/stand/libsa/ext2fs.c
@@ -152,7 +152,7 @@ struct fs_ops ext2fs_fsops = {
#define ino_to_bo(fs, ino) (ino_to_bgo(fs, ino) % (fs)->fs_ipb)
#define nindir(fs) \
- ((fs)->fs_bsize / sizeof(u_int32_t))
+ ((fs)->fs_bsize / sizeof(uint32_t))
#define lblkno(fs, loc) /* loc / bsize */ \
((loc) >> (fs)->fs_bshift)
#define smalllblktosize(fs, blk) /* blk * bsize */ \
@@ -170,45 +170,45 @@ struct fs_ops ext2fs_fsops = {
* superblock describing ext2fs
*/
struct ext2fs_disk {
- u_int32_t fd_inodes; /* # of inodes */
- u_int32_t fd_blocks; /* # of blocks */
- u_int32_t fd_resblk; /* # of reserved blocks */
- u_int32_t fd_freeblk; /* # of free blocks */
- u_int32_t fd_freeino; /* # of free inodes */
- u_int32_t fd_firstblk; /* first data block */
- u_int32_t fd_bsize; /* block size */
- u_int32_t fd_fsize; /* frag size */
- u_int32_t fd_bpg; /* blocks per group */
- u_int32_t fd_fpg; /* frags per group */
- u_int32_t fd_ipg; /* inodes per group */
- u_int32_t fd_mtime; /* mount time */
- u_int32_t fd_wtime; /* write time */
- u_int16_t fd_mount; /* # of mounts */
+ uint32_t fd_inodes; /* # of inodes */
+ uint32_t fd_blocks; /* # of blocks */
+ uint32_t fd_resblk; /* # of reserved blocks */
+ uint32_t fd_freeblk; /* # of free blocks */
+ uint32_t fd_freeino; /* # of free inodes */
+ uint32_t fd_firstblk; /* first data block */
+ uint32_t fd_bsize; /* block size */
+ uint32_t fd_fsize; /* frag size */
+ uint32_t fd_bpg; /* blocks per group */
+ uint32_t fd_fpg; /* frags per group */
+ uint32_t fd_ipg; /* inodes per group */
+ uint32_t fd_mtime; /* mount time */
+ uint32_t fd_wtime; /* write time */
+ uint16_t fd_mount; /* # of mounts */
int16_t fd_maxmount; /* max # of mounts */
- u_int16_t fd_magic; /* magic number */
- u_int16_t fd_state; /* state */
- u_int16_t fd_eflag; /* error flags */
- u_int16_t fd_mnrrev; /* minor revision */
- u_int32_t fd_lastchk; /* last check */
- u_int32_t fd_chkintvl; /* maximum check interval */
- u_int32_t fd_os; /* os */
- u_int32_t fd_revision; /* revision */
- u_int16_t fd_uid; /* uid for reserved blocks */
- u_int16_t fd_gid; /* gid for reserved blocks */
-
- u_int32_t fd_firstino; /* first non-reserved inode */
- u_int16_t fd_isize; /* inode size */
- u_int16_t fd_nblkgrp; /* block group # of superblock */
- u_int32_t fd_fcompat; /* compatible features */
- u_int32_t fd_fincompat; /* incompatible features */
- u_int32_t fd_frocompat; /* read-only compatibilties */
- u_int8_t fd_uuid[16]; /* volume uuid */
+ uint16_t fd_magic; /* magic number */
+ uint16_t fd_state; /* state */
+ uint16_t fd_eflag; /* error flags */
+ uint16_t fd_mnrrev; /* minor revision */
+ uint32_t fd_lastchk; /* last check */
+ uint32_t fd_chkintvl; /* maximum check interval */
+ uint32_t fd_os; /* os */
+ uint32_t fd_revision; /* revision */
+ uint16_t fd_uid; /* uid for reserved blocks */
+ uint16_t fd_gid; /* gid for reserved blocks */
+
+ uint32_t fd_firstino; /* first non-reserved inode */
+ uint16_t fd_isize; /* inode size */
+ uint16_t fd_nblkgrp; /* block group # of superblock */
+ uint32_t fd_fcompat; /* compatible features */
+ uint32_t fd_fincompat; /* incompatible features */
+ uint32_t fd_frocompat; /* read-only compatibilties */
+ uint8_t fd_uuid[16]; /* volume uuid */
char fd_volname[16]; /* volume name */
char fd_fsmnt[64]; /* name last mounted on */
- u_int32_t fd_bitmap; /* compression bitmap */
+ uint32_t fd_bitmap; /* compression bitmap */
- u_int8_t fd_nblkpa; /* # of blocks to preallocate */
- u_int8_t fd_ndblkpa; /* # of dir blocks to preallocate */
+ uint8_t fd_nblkpa; /* # of blocks to preallocate */
+ uint8_t fd_ndblkpa; /* # of dir blocks to preallocate */
};
struct ext2fs_core {
@@ -251,39 +251,39 @@ struct ext2fs {
};
struct ext2blkgrp {
- u_int32_t bg_blkmap; /* block bitmap */
- u_int32_t bg_inomap; /* inode bitmap */
- u_int32_t bg_inotbl; /* inode table */
- u_int16_t bg_nfblk; /* # of free blocks */
- u_int16_t bg_nfino; /* # of free inodes */
- u_int16_t bg_ndirs; /* # of dirs */
+ uint32_t bg_blkmap; /* block bitmap */
+ uint32_t bg_inomap; /* inode bitmap */
+ uint32_t bg_inotbl; /* inode table */
+ uint16_t bg_nfblk; /* # of free blocks */
+ uint16_t bg_nfino; /* # of free inodes */
+ uint16_t bg_ndirs; /* # of dirs */
char bg_pad[14];
};
struct ext2dinode {
- u_int16_t di_mode; /* mode */
- u_int16_t di_uid; /* uid */
- u_int32_t di_size; /* byte size */
- u_int32_t di_atime; /* access time */
- u_int32_t di_ctime; /* creation time */
- u_int32_t di_mtime; /* modification time */
- u_int32_t di_dtime; /* deletion time */
- u_int16_t di_gid; /* gid */
- u_int16_t di_nlink; /* link count */
- u_int32_t di_nblk; /* block count */
- u_int32_t di_flags; /* file flags */
-
- u_int32_t di_osdep1; /* os dependent stuff */
-
- u_int32_t di_db[NDADDR]; /* direct blocks */
- u_int32_t di_ib[NIADDR]; /* indirect blocks */
- u_int32_t di_version; /* version */
- u_int32_t di_facl; /* file acl */
- u_int32_t di_dacl; /* dir acl */
- u_int32_t di_faddr; /* fragment addr */
-
- u_int8_t di_frag; /* fragment number */
- u_int8_t di_fsize; /* fragment size */
+ uint16_t di_mode; /* mode */
+ uint16_t di_uid; /* uid */
+ uint32_t di_size; /* byte size */
+ uint32_t di_atime; /* access time */
+ uint32_t di_ctime; /* creation time */
+ uint32_t di_mtime; /* modification time */
+ uint32_t di_dtime; /* deletion time */
+ uint16_t di_gid; /* gid */
+ uint16_t di_nlink; /* link count */
+ uint32_t di_nblk; /* block count */
+ uint32_t di_flags; /* file flags */
+
+ uint32_t di_osdep1; /* os dependent stuff */
+
+ uint32_t di_db[NDADDR]; /* direct blocks */
+ uint32_t di_ib[NIADDR]; /* indirect blocks */
+ uint32_t di_version; /* version */
+ uint32_t di_facl; /* file acl */
+ uint32_t di_dacl; /* dir acl */
+ uint32_t di_faddr; /* fragment addr */
+
+ uint8_t di_frag; /* fragment number */
+ uint8_t di_fsize; /* fragment size */
char di_pad[10];
@@ -293,10 +293,10 @@ struct ext2dinode {
#define EXT2_MAXNAMLEN 255
struct ext2dirent {
- u_int32_t d_ino; /* inode */
- u_int16_t d_reclen; /* directory entry length */
- u_int8_t d_namlen; /* name length */
- u_int8_t d_type; /* file type */
+ uint32_t d_ino; /* inode */
+ uint16_t d_reclen; /* directory entry length */
+ uint8_t d_namlen; /* name length */
+ uint8_t d_type; /* file type */
char d_name[EXT2_MAXNAMLEN];
};
diff --git a/stand/libsa/net.h b/stand/libsa/net.h
index 801fb06..1870db1 100644
--- a/stand/libsa/net.h
+++ b/stand/libsa/net.h
@@ -40,7 +40,7 @@
#define _STAND_NET_H
#ifndef _KERNEL /* XXX - see <netinet/in.h> */
#undef __IPADDR
-#define __IPADDR(x) htonl((u_int32_t)(x))
+#define __IPADDR(x) htonl((uint32_t)(x))
#endif
#include "iodesc.h"
diff --git a/stand/libsa/rpc.c b/stand/libsa/rpc.c
index 6ddb137..5d5e598 100644
--- a/stand/libsa/rpc.c
+++ b/stand/libsa/rpc.c
@@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$");
struct auth_info {
int32_t authtype; /* auth type */
- u_int32_t authlen; /* auth length */
+ uint32_t authlen; /* auth length */
};
struct auth_unix {
@@ -75,23 +75,23 @@ struct auth_unix {
};
struct rpc_call {
- u_int32_t rp_xid; /* request transaction id */
+ uint32_t rp_xid; /* request transaction id */
int32_t rp_direction; /* call direction (0) */
- u_int32_t rp_rpcvers; /* rpc version (2) */
- u_int32_t rp_prog; /* program */
- u_int32_t rp_vers; /* version */
- u_int32_t rp_proc; /* procedure */
+ uint32_t rp_rpcvers; /* rpc version (2) */
+ uint32_t rp_prog; /* program */
+ uint32_t rp_vers; /* version */
+ uint32_t rp_proc; /* procedure */
};
struct rpc_reply {
- u_int32_t rp_xid; /* request transaction id */
+ uint32_t rp_xid; /* request transaction id */
int32_t rp_direction; /* call direction (1) */
int32_t rp_astatus; /* accept status (0: accepted) */
union {
- u_int32_t rpu_errno;
+ uint32_t rpu_errno;
struct {
struct auth_info rok_auth;
- u_int32_t rok_status;
+ uint32_t rok_status;
} rpu_rok;
} rp_u;
};
@@ -283,10 +283,10 @@ rpc_fromaddr(void *pkt, struct in_addr *addr, u_short *port)
n_long ip_src;
n_long ip_dst;
/* UDP header: */
- u_int16_t uh_sport; /* source port */
- u_int16_t uh_dport; /* destination port */
+ uint16_t uh_sport; /* source port */
+ uint16_t uh_dport; /* destination port */
int16_t uh_ulen; /* udp length */
- u_int16_t uh_sum; /* udp checksum */
+ uint16_t uh_sum; /* udp checksum */
/* RPC reply header: */
struct rpc_reply rpc;
} *hhdr;
diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h
index b58fbb2..aebf07a 100644
--- a/stand/libsa/stand.h
+++ b/stand/libsa/stand.h
@@ -138,6 +138,12 @@ extern struct fs_ops pkgfs_fsops;
struct devsw {
const char dv_name[8];
int dv_type; /* opaque type constant, arch-dependant */
+#define DEVT_NONE 0
+#define DEVT_DISK 1
+#define DEVT_NET 2
+#define DEVT_CD 3
+#define DEVT_ZFS 4
+#define DEVT_FD 5
int (*dv_init)(void); /* early probe call */
int (*dv_strategy)(void *devdata, int rw, daddr_t blk,
size_t size, char *buf, size_t *rsize);
@@ -160,16 +166,8 @@ extern int errno;
* versions may be larger, but should be allowed to
* overlap.
*/
-struct devdesc
-{
+struct devdesc {
struct devsw *d_dev;
- int d_type;
-#define DEVT_NONE 0
-#define DEVT_DISK 1
-#define DEVT_NET 2
-#define DEVT_CD 3
-#define DEVT_ZFS 4
-#define DEVT_FD 5
int d_unit;
void *d_opendata;
};
diff --git a/stand/mips/beri/loader/beri_disk_cfi.c b/stand/mips/beri/loader/beri_disk_cfi.c
index a21947f..76b7bb7 100644
--- a/stand/mips/beri/loader/beri_disk_cfi.c
+++ b/stand/mips/beri/loader/beri_disk_cfi.c
@@ -98,7 +98,7 @@ beri_cfi_disk_open(struct open_file *f, ...)
dev = va_arg(ap, struct disk_devdesc *);
va_end(ap);
- if (dev->d_unit != 0)
+ if (dev->dd.d_unit != 0)
return (EIO);
return (disk_open(dev, cfi_get_mediasize(), cfi_get_sectorsize()));
}
@@ -127,8 +127,8 @@ beri_cfi_disk_print(int verbose)
ret = pager_output(line);
if (ret != 0)
return (ret);
- dev.d_dev = &beri_cfi_disk;
- dev.d_unit = 0;
+ dev.dd.d_dev = &beri_cfi_disk;
+ dev.dd.d_unit = 0;
dev.d_slice = -1;
dev.d_partition = -1;
if (disk_open(&dev, cfi_get_mediasize(), cfi_get_sectorsize()) == 0) {
diff --git a/stand/mips/beri/loader/beri_disk_sdcard.c b/stand/mips/beri/loader/beri_disk_sdcard.c
index 266fb4a..f577eaf 100644
--- a/stand/mips/beri/loader/beri_disk_sdcard.c
+++ b/stand/mips/beri/loader/beri_disk_sdcard.c
@@ -103,7 +103,7 @@ beri_sdcard_disk_open(struct open_file *f, ...)
return (ENXIO);
}
- if (dev->d_unit != 0)
+ if (dev->dd.d_unit != 0)
return (EIO);
return (disk_open(dev, altera_sdcard_get_mediasize(),
altera_sdcard_get_sectorsize()));
@@ -133,8 +133,8 @@ beri_sdcard_disk_print(int verbose)
ret = pager_output(line);
if (ret != 0)
return (ret);
- dev.d_dev = &beri_sdcard_disk;
- dev.d_unit = 0;
+ dev.dd.d_dev = &beri_sdcard_disk;
+ dev.dd.d_unit = 0;
dev.d_slice = -1;
dev.d_partition = -1;
if (disk_open(&dev, altera_sdcard_get_mediasize(),
diff --git a/stand/mips/beri/loader/devicename.c b/stand/mips/beri/loader/devicename.c
index 968c946..89eee32 100644
--- a/stand/mips/beri/loader/devicename.c
+++ b/stand/mips/beri/loader/devicename.c
@@ -139,7 +139,7 @@ beri_arch_parsedev(struct disk_devdesc **dev, const char *devspec,
goto fail;
}
- idev->d_unit = unit;
+ idev->dd.d_unit = unit;
if (path != NULL)
*path = (*cp == 0) ? cp : cp + 1;
break;
@@ -148,8 +148,7 @@ beri_arch_parsedev(struct disk_devdesc **dev, const char *devspec,
err = EINVAL;
goto fail;
}
- idev->d_dev = dv;
- idev->d_type = dv->dv_type;
+ idev->dd.d_dev = dv;
if (dev == NULL) {
free(idev);
} else {
@@ -169,13 +168,13 @@ beri_arch_fmtdev(void *vdev)
struct disk_devdesc *dev = (struct disk_devdesc *)vdev;
static char buf[128]; /* XXX device length constant? */
- switch(dev->d_type) {
+ switch(dev->dd.d_dev->dv_type) {
case DEVT_NONE:
strcpy(buf, "(no device)");
break;
case DEVT_CD:
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+ sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
break;
case DEVT_DISK:
@@ -183,7 +182,7 @@ beri_arch_fmtdev(void *vdev)
case DEVT_NET:
case DEVT_ZFS:
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+ sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
break;
}
return(buf);
diff --git a/stand/ofw/libofw/devicename.c b/stand/ofw/libofw/devicename.c
index c9814b7..1f45a95 100644
--- a/stand/ofw/libofw/devicename.c
+++ b/stand/ofw/libofw/devicename.c
@@ -113,9 +113,8 @@ found:
return ENOMEM;
}
strcpy(idev->d_path, name);
- idev->d_dev = dv;
- idev->d_type = dv->dv_type;
- if (idev->d_type == DEVT_ZFS) {
+ idev->dd.d_dev = dv;
+ if (dv->dv_type == DEVT_ZFS) {
p = devspec + strlen(dv->dv_name);
err = zfs_parsedev((struct zfs_devdesc *)idev, p, path);
if (err != 0) {
diff --git a/stand/ofw/libofw/libofw.h b/stand/ofw/libofw/libofw.h
index 6e2cc81..a4bfc27 100644
--- a/stand/ofw/libofw/libofw.h
+++ b/stand/ofw/libofw/libofw.h
@@ -27,14 +27,13 @@
#include "openfirm.h"
-/* Note: Must match the 'struct devdesc' in bootstrap.h */
struct ofw_devdesc {
- struct devsw *d_dev;
- int d_type;
- int d_unit;
- ihandle_t d_handle;
+ struct devdesc dd;
union {
- char d_path[256];
+ struct {
+ ihandle_t d_handle;
+ char d_path[256];
+ };
struct {
uint64_t pool_guid;
uint64_t root_guid;
diff --git a/stand/ofw/libofw/openfirm.c b/stand/ofw/libofw/openfirm.c
index 84e81d9..7a5aac0 100644
--- a/stand/ofw/libofw/openfirm.c
+++ b/stand/ofw/libofw/openfirm.c
@@ -598,7 +598,7 @@ OF_write(ihandle_t instance, void *addr, int len)
/* Seek to a position. */
int
-OF_seek(ihandle_t instance, u_int64_t pos)
+OF_seek(ihandle_t instance, uint64_t pos)
{
static struct {
cell_t name;
diff --git a/stand/pc98/libpc98/bioscd.c b/stand/pc98/libpc98/bioscd.c
index f259701..3b29c21 100644
--- a/stand/pc98/libpc98/bioscd.c
+++ b/stand/pc98/libpc98/bioscd.c
@@ -89,7 +89,7 @@ static struct bcinfo {
} bcinfo [MAXBCDEV];
static int nbcinfo = 0;
-#define BC(dev) (bcinfo[(dev)->d_unit])
+#define BC(dev) (bcinfo[(dev)->dd.d_unit])
static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest);
static int bc_init(void);
@@ -207,7 +207,7 @@ bc_open(struct open_file *f, ...)
va_start(ap, f);
dev = va_arg(ap, struct i386_devdesc *);
va_end(ap);
- if (dev->d_unit >= nbcinfo) {
+ if (dev->dd.d_unit >= nbcinfo) {
DEBUG("attempt to open nonexistent disk");
return(ENXIO);
}
@@ -267,7 +267,7 @@ bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
if (rw != F_READ)
return(EROFS);
dev = (struct i386_devdesc *)devdata;
- unit = dev->d_unit;
+ unit = dev->dd.d_unit;
blks = size / BIOSCD_SECSIZE;
if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0)
return (EINVAL);
@@ -397,7 +397,7 @@ bc_getdev(struct i386_devdesc *dev)
int major;
int rootdev;
- unit = dev->d_unit;
+ unit = dev->dd.d_unit;
biosdev = bc_unit2bios(unit);
DEBUG("unit %d BIOS device %d", unit, biosdev);
if (biosdev == -1) /* not a BIOS device */
diff --git a/stand/pc98/libpc98/biosdisk.c b/stand/pc98/libpc98/biosdisk.c
index 86a550d..b13e96f 100644
--- a/stand/pc98/libpc98/biosdisk.c
+++ b/stand/pc98/libpc98/biosdisk.c
@@ -101,7 +101,7 @@ static struct bdinfo
} bdinfo [MAXBDDEV];
static int nbdinfo = 0;
-#define BD(dev) (bdinfo[(dev)->d_unit])
+#define BD(dev) (bdinfo[(dev)->dd.d_unit])
static int bd_getgeom(struct open_disk *od);
static int bd_read(struct open_disk *od, daddr_t dblk, int blks,
@@ -272,7 +272,7 @@ bd_print(int verbose)
break;
/* try to open the whole disk */
- dev.d_unit = i;
+ dev.dd.d_unit = i;
dev.d_kind.biosdisk.slice = -1;
dev.d_kind.biosdisk.partition = -1;
@@ -465,7 +465,7 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev)
struct open_disk *od;
int error;
- if (dev->d_unit >= nbdinfo) {
+ if (dev->dd.d_unit >= nbdinfo) {
DEBUG("attempt to open nonexistent disk");
return(ENXIO);
}
@@ -477,13 +477,13 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev)
}
/* Look up BIOS unit number, intialise open_disk structure */
- od->od_dkunit = dev->d_unit;
+ od->od_dkunit = dev->dd.d_unit;
od->od_unit = bdinfo[od->od_dkunit].bd_unit;
od->od_flags = bdinfo[od->od_dkunit].bd_flags;
od->od_boff = 0;
error = 0;
DEBUG("open '%s', unit 0x%x slice %d partition %d",
- i386_fmtdev(dev), dev->d_unit,
+ i386_fmtdev(dev), dev->dd.d_unit,
dev->d_kind.biosdisk.slice, dev->d_kind.biosdisk.partition);
/* Get geometry for this open (removable device may have changed) */
@@ -1066,8 +1066,8 @@ bd_getdev(struct i386_devdesc *dev)
char *nip, *cp;
int unitofs = 0, i, unit;
- biosdev = bd_unit2bios(dev->d_unit);
- DEBUG("unit %d BIOS device %d", dev->d_unit, biosdev);
+ biosdev = bd_unit2bios(dev->dd.d_unit);
+ DEBUG("unit %d BIOS device %d", dev->dd.d_unit, biosdev);
if (biosdev == -1) /* not a BIOS device */
return(-1);
if (bd_opendisk(&od, dev) != 0) /* oops, not a viable device */
@@ -1075,7 +1075,7 @@ bd_getdev(struct i386_devdesc *dev)
if ((biosdev & 0xf0) == 0x90 || (biosdev & 0xf0) == 0x30) {
/* floppy (or emulated floppy) or ATAPI device */
- if (bdinfo[dev->d_unit].bd_type == DT_ATAPI) {
+ if (bdinfo[dev->dd.d_unit].bd_type == DT_ATAPI) {
/* is an ATAPI disk */
major = WFDMAJOR;
} else {
@@ -1101,7 +1101,7 @@ bd_getdev(struct i386_devdesc *dev)
}
/* default root disk unit number */
if ((biosdev & 0xf0) == 0xa0)
- unit = bdinfo[dev->d_unit].bd_da_unit;
+ unit = bdinfo[dev->dd.d_unit].bd_da_unit;
else
unit = biosdev & 0xf;
diff --git a/stand/pc98/loader/main.c b/stand/pc98/loader/main.c
index 300db73..47bace6 100644
--- a/stand/pc98/loader/main.c
+++ b/stand/pc98/loader/main.c
@@ -211,18 +211,18 @@ extract_currdev(void)
int biosdev = -1;
/* Assume we are booting from a BIOS disk by default */
- new_currdev.d_dev = &biosdisk;
+ new_currdev.dd.d_dev = &biosdisk;
/* new-style boot loaders such as pxeldr and cdldr */
if (kargs->bootinfo == 0) {
if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) {
/* we are booting from a CD with cdboot */
- new_currdev.d_dev = &bioscd;
- new_currdev.d_unit = bc_bios2unit(initial_bootdev);
+ new_currdev.dd.d_dev = &bioscd;
+ new_currdev.dd.d_unit = bc_bios2unit(initial_bootdev);
} else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) {
/* we are booting from pxeldr */
- new_currdev.d_dev = &pxedisk;
- new_currdev.d_unit = 0;
+ new_currdev.dd.d_dev = &pxedisk;
+ new_currdev.dd.d_unit = 0;
} else {
/* we don't know what our boot device is */
new_currdev.d_kind.biosdisk.slice = -1;
@@ -253,17 +253,17 @@ extract_currdev(void)
biosdev = (major << 3) + 0x80 + B_UNIT(initial_bootdev);
}
}
- new_currdev.d_type = new_currdev.d_dev->dv_type;
+ new_currdev.dd.d_type = new_currdev.dd.d_dev->dv_type;
/*
* If we are booting off of a BIOS disk and we didn't succeed in determining
* which one we booted off of, just use disk0: as a reasonable default.
*/
- if ((new_currdev.d_type == biosdisk.dv_type) &&
- ((new_currdev.d_unit = bd_bios2unit(biosdev)) == -1)) {
+ if ((new_currdev.dd.d_type == biosdisk.dv_type) &&
+ ((new_currdev.dd.d_unit = bd_bios2unit(biosdev)) == -1)) {
printf("Can't work out which disk we are booting from.\n"
"Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev);
- new_currdev.d_unit = 0;
+ new_currdev.dd.d_unit = 0;
}
env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev),
diff --git a/stand/powerpc/boot1.chrp/boot1.c b/stand/powerpc/boot1.chrp/boot1.c
index e73186a..5e54c95 100644
--- a/stand/powerpc/boot1.chrp/boot1.c
+++ b/stand/powerpc/boot1.chrp/boot1.c
@@ -54,7 +54,7 @@ int main(int ac, char **av);
static void exit(int) __dead2;
static void load(const char *);
-static int dskread(void *, u_int64_t, int);
+static int dskread(void *, uint64_t, int);
static void usage(void);
@@ -79,8 +79,8 @@ static char *__ultoa(char *buf, u_long val, int base);
/*
* Open Firmware interface functions
*/
-typedef u_int32_t ofwcell_t;
-typedef u_int32_t u_ofwh_t;
+typedef uint32_t ofwcell_t;
+typedef uint32_t u_ofwh_t;
typedef int (*ofwfp_t)(void *);
ofwfp_t ofw; /* the prom Open Firmware entry */
ofwh_t chosenh;
@@ -94,7 +94,7 @@ static int ofw_setprop(ofwh_t, const char *, void *, size_t);
static int ofw_read(ofwh_t, void *, size_t);
static int ofw_write(ofwh_t, const void *, size_t);
static int ofw_claim(void *virt, size_t len, u_int align);
-static int ofw_seek(ofwh_t, u_int64_t);
+static int ofw_seek(ofwh_t, uint64_t);
static void ofw_exit(void) __dead2;
ofwh_t bootdevh;
@@ -322,7 +322,7 @@ ofw_write(ofwh_t devh, const void *buf, size_t len)
}
static int
-ofw_seek(ofwh_t devh, u_int64_t off)
+ofw_seek(ofwh_t devh, uint64_t off)
{
ofwcell_t args[] = {
(ofwcell_t)"seek",
@@ -541,7 +541,7 @@ load(const char *fname)
}
static int
-dskread(void *buf, u_int64_t lba, int nblk)
+dskread(void *buf, uint64_t lba, int nblk)
{
/*
* The Open Firmware should open the correct partition for us.
diff --git a/stand/powerpc/kboot/ppc64_elf_freebsd.c b/stand/powerpc/kboot/ppc64_elf_freebsd.c
index 9547077..adbdc7f 100644
--- a/stand/powerpc/kboot/ppc64_elf_freebsd.c
+++ b/stand/powerpc/kboot/ppc64_elf_freebsd.c
@@ -57,7 +57,7 @@ struct trampoline_data {
vm_offset_t md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
int
-ppc64_elf_loadfile(char *filename, u_int64_t dest,
+ppc64_elf_loadfile(char *filename, uint64_t dest,
struct preloaded_file **result)
{
int r;
diff --git a/stand/powerpc/ofw/elf_freebsd.c b/stand/powerpc/ofw/elf_freebsd.c
index 78bebf4..7693306 100644
--- a/stand/powerpc/ofw/elf_freebsd.c
+++ b/stand/powerpc/ofw/elf_freebsd.c
@@ -46,7 +46,7 @@ extern char end[];
extern vm_offset_t reloc; /* From <arch>/conf.c */
int
-__elfN(ofw_loadfile)(char *filename, u_int64_t dest,
+__elfN(ofw_loadfile)(char *filename, uint64_t dest,
struct preloaded_file **result)
{
int r;
diff --git a/stand/powerpc/ofw/main.c b/stand/powerpc/ofw/main.c
index d3ada31..785c61b 100644
--- a/stand/powerpc/ofw/main.c
+++ b/stand/powerpc/ofw/main.c
@@ -40,7 +40,7 @@ struct arch_switch archsw; /* MI/MD interface boundary */
extern char end[];
extern char bootprog_info[];
-u_int32_t acells, scells;
+uint32_t acells, scells;
static char bootargs[128];
@@ -73,7 +73,7 @@ memsize(void)
phandle_t memoryp;
cell_t reg[24];
int i, sz;
- u_int64_t memsz;
+ uint64_t memsz;
memsz = 0;
memoryp = OF_instance_to_package(memory);
diff --git a/stand/powerpc/ofw/ppc64_elf_freebsd.c b/stand/powerpc/ofw/ppc64_elf_freebsd.c
index 6d85029..96efb16 100644
--- a/stand/powerpc/ofw/ppc64_elf_freebsd.c
+++ b/stand/powerpc/ofw/ppc64_elf_freebsd.c
@@ -46,7 +46,7 @@ extern char end[];
extern vm_offset_t reloc; /* From <arch>/conf.c */
int
-ppc64_ofw_elf_loadfile(char *filename, u_int64_t dest,
+ppc64_ofw_elf_loadfile(char *filename, uint64_t dest,
struct preloaded_file **result)
{
int r;
diff --git a/stand/sparc64/boot1/boot1.c b/stand/sparc64/boot1/boot1.c
index 4724ca1..3a84d23 100644
--- a/stand/sparc64/boot1/boot1.c
+++ b/stand/sparc64/boot1/boot1.c
@@ -61,7 +61,7 @@ static void bcopy(const void *src, void *dst, size_t len);
static void bzero(void *b, size_t len);
static int domount(const char *device);
-static int dskread(void *buf, u_int64_t lba, int nblk);
+static int dskread(void *buf, uint64_t lba, int nblk);
static void panic(const char *fmt, ...) __dead2;
static int printf(const char *fmt, ...);
@@ -78,8 +78,8 @@ static char *__ultoa(char *buf, u_long val, int base);
/*
* Open Firmware interface functions
*/
-typedef u_int64_t ofwcell_t;
-typedef u_int32_t u_ofwh_t;
+typedef uint64_t ofwcell_t;
+typedef uint32_t u_ofwh_t;
typedef int (*ofwfp_t)(ofwcell_t []);
static ofwfp_t ofw; /* the PROM Open Firmware entry */
@@ -89,7 +89,7 @@ static ofwh_t ofw_open(const char *);
static int ofw_getprop(ofwh_t, const char *, void *, size_t);
static int ofw_read(ofwh_t, void *, size_t);
static int ofw_write(ofwh_t, const void *, size_t);
-static int ofw_seek(ofwh_t, u_int64_t);
+static int ofw_seek(ofwh_t, uint64_t);
static void ofw_exit(void) __dead2;
static ofwh_t stdinh, stdouth;
@@ -251,7 +251,7 @@ ofw_write(ofwh_t devh, const void *buf, size_t len)
}
static int
-ofw_seek(ofwh_t devh, u_int64_t off)
+ofw_seek(ofwh_t devh, uint64_t off)
{
ofwcell_t args[] = {
(ofwcell_t)"seek",
@@ -515,7 +515,7 @@ domount(const char *device)
}
static int
-dskread(void *buf, u_int64_t lba, int nblk)
+dskread(void *buf, uint64_t lba, int nblk)
{
/*
diff --git a/stand/sparc64/loader/main.c b/stand/sparc64/loader/main.c
index 4843aa9..7c1bf43 100644
--- a/stand/sparc64/loader/main.c
+++ b/stand/sparc64/loader/main.c
@@ -117,7 +117,7 @@ uint32_t cpu_get_mid_sun4u(void);
static void tlb_init_sun4u(void);
#ifdef LOADER_DEBUG
-typedef u_int64_t tte_t;
+typedef uint64_t tte_t;
static void pmap_print_tlb_sun4u(void);
static void pmap_print_tte_sun4u(tte_t, tte_t);
@@ -806,8 +806,7 @@ sparc64_zfs_probe(void)
if (guid != 0) {
zfs_currdev.pool_guid = guid;
zfs_currdev.root_guid = 0;
- zfs_currdev.d_dev = &zfs_dev;
- zfs_currdev.d_type = zfs_currdev.d_dev->dv_type;
+ zfs_currdev.dd.d_dev = &zfs_dev;
}
}
#endif /* LOADER_ZFS_SUPPORT */
diff --git a/stand/uboot/common/main.c b/stand/uboot/common/main.c
index 26355fe..8ad33f4 100644
--- a/stand/uboot/common/main.c
+++ b/stand/uboot/common/main.c
@@ -322,7 +322,7 @@ print_disk_probe_info()
strcpy(partition, "<auto>");
printf(" Checking unit=%d slice=%s partition=%s...",
- currdev.d_unit, slice, partition);
+ currdev.dd.d_unit, slice, partition);
}
@@ -342,8 +342,8 @@ probe_disks(int devidx, int load_type, int load_unit, int load_slice,
if (load_type == -1) {
printf(" Probing all disk devices...\n");
/* Try each disk in succession until one works. */
- for (currdev.d_unit = 0; currdev.d_unit < UB_MAX_DEV;
- currdev.d_unit++) {
+ for (currdev.dd.d_unit = 0; currdev.dd.d_unit < UB_MAX_DEV;
+ currdev.dd.d_unit++) {
print_disk_probe_info();
open_result = devsw[devidx]->dv_open(&f, &currdev);
if (open_result == 0) {
@@ -359,8 +359,8 @@ probe_disks(int devidx, int load_type, int load_unit, int load_slice,
printf(" Probing all %s devices...\n", device_typename(load_type));
/* Try each disk of given type in succession until one works. */
for (unit = 0; unit < UB_MAX_DEV; unit++) {
- currdev.d_unit = uboot_diskgetunit(load_type, unit);
- if (currdev.d_unit == -1)
+ currdev.dd.d_unit = uboot_diskgetunit(load_type, unit);
+ if (currdev.dd.d_unit == -1)
break;
print_disk_probe_info();
open_result = devsw[devidx]->dv_open(&f, &currdev);
@@ -373,7 +373,7 @@ probe_disks(int devidx, int load_type, int load_unit, int load_slice,
return (-1);
}
- if ((currdev.d_unit = uboot_diskgetunit(load_type, load_unit)) != -1) {
+ if ((currdev.dd.d_unit = uboot_diskgetunit(load_type, load_unit)) != -1) {
print_disk_probe_info();
open_result = devsw[devidx]->dv_open(&f,&currdev);
if (open_result == 0) {
@@ -463,9 +463,8 @@ main(int argc, char **argv)
printf("Found U-Boot device: %s\n", devsw[i]->dv_name);
- currdev.d_dev = devsw[i];
- currdev.d_type = currdev.d_dev->dv_type;
- currdev.d_unit = 0;
+ currdev.dd.d_dev = devsw[i];
+ currdev.dd.d_unit = 0;
if ((load_type == -1 || (load_type & DEV_TYP_STOR)) &&
strcmp(devsw[i]->dv_name, "disk") == 0) {
diff --git a/stand/uboot/lib/devicename.c b/stand/uboot/lib/devicename.c
index 9e68f9d..cda16de 100644
--- a/stand/uboot/lib/devicename.c
+++ b/stand/uboot/lib/devicename.c
@@ -136,7 +136,7 @@ uboot_parsedev(struct uboot_devdesc **dev, const char *devspec,
err = EINVAL;
goto fail;
}
- idev->d_unit = unit;
+ idev->dd.d_unit = unit;
if (path != NULL)
*path = (*cp == 0) ? cp : cp + 1;
@@ -146,8 +146,7 @@ uboot_parsedev(struct uboot_devdesc **dev, const char *devspec,
err = EINVAL;
goto fail;
}
- idev->d_dev = dv;
- idev->d_type = dv->dv_type;
+ idev->dd.d_dev = dv;
if (dev == NULL) {
free(idev);
} else {
@@ -167,7 +166,7 @@ uboot_fmtdev(void *vdev)
struct uboot_devdesc *dev = (struct uboot_devdesc *)vdev;
static char buf[128];
- switch(dev->d_type) {
+ switch(dev->dd.d_dev->dv_type) {
case DEVT_NONE:
strcpy(buf, "(no device)");
break;
@@ -178,7 +177,7 @@ uboot_fmtdev(void *vdev)
#endif
case DEVT_NET:
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+ sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
break;
}
return(buf);
diff --git a/stand/uboot/lib/disk.c b/stand/uboot/lib/disk.c
index f5e44c7..bf07d04 100644
--- a/stand/uboot/lib/disk.c
+++ b/stand/uboot/lib/disk.c
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
#include "libuboot.h"
#define stor_printf(fmt, args...) do { \
- printf("%s%d: ", dev->d_dev->dv_name, dev->d_unit); \
+ printf("%s%d: ", dev->dd.d_dev->dv_name, dev->dd.d_unit); \
printf(fmt, ##args); \
} while (0)
@@ -65,7 +65,7 @@ static struct {
u_int bsize; /* block size */
} stor_info[UB_MAX_DEV];
-#define SI(dev) (stor_info[(dev)->d_unit])
+#define SI(dev) (stor_info[(dev)->dd.d_unit])
static int stor_info_no = 0;
static int stor_opendev(struct disk_devdesc *);
@@ -190,7 +190,7 @@ stor_opendev(struct disk_devdesc *dev)
{
int err;
- if (dev->d_unit < 0 || dev->d_unit >= stor_info_no)
+ if (dev->dd.d_unit < 0 || dev->dd.d_unit >= stor_info_no)
return (EIO);
if (SI(dev).opened == 0) {
@@ -252,8 +252,8 @@ stor_print(int verbose)
return (ret);
for (i = 0; i < stor_info_no; i++) {
- dev.d_dev = &uboot_storage;
- dev.d_unit = i;
+ dev.dd.d_dev = &uboot_storage;
+ dev.dd.d_unit = i;
dev.d_slice = -1;
dev.d_partition = -1;
snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i,
diff --git a/stand/uboot/lib/elf_freebsd.c b/stand/uboot/lib/elf_freebsd.c
index 8ce3702..a11f0ac 100644
--- a/stand/uboot/lib/elf_freebsd.c
+++ b/stand/uboot/lib/elf_freebsd.c
@@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$");
extern vm_offset_t md_load(char *, vm_offset_t *, vm_offset_t *);
int
-__elfN(uboot_load)(char *filename, u_int64_t dest,
+__elfN(uboot_load)(char *filename, uint64_t dest,
struct preloaded_file **result)
{
int r;
diff --git a/stand/uboot/lib/libuboot.h b/stand/uboot/lib/libuboot.h
index c6cf93c..221f48f7 100644
--- a/stand/uboot/lib/libuboot.h
+++ b/stand/uboot/lib/libuboot.h
@@ -27,12 +27,9 @@
* $FreeBSD$
*/
-struct uboot_devdesc
-{
- struct devsw *d_dev;
- int d_type;
- int d_unit;
- void *d_opendata;
+/* Note: Must match the 'struct devdesc' in stand.h */
+struct uboot_devdesc {
+ struct devdesc dd;
union {
struct {
int slice;
diff --git a/stand/userboot/userboot/bootinfo32.c b/stand/userboot/userboot/bootinfo32.c
index 6498461..4f1cef6 100644
--- a/stand/userboot/userboot/bootinfo32.c
+++ b/stand/userboot/userboot/bootinfo32.c
@@ -55,7 +55,7 @@ static struct bootinfo bi;
* MOD_METADATA (variable) type-specific metadata
*/
#define COPY32(v, a, c) { \
- u_int32_t x = (v); \
+ uint32_t x = (v); \
if (c) \
CALLBACK(copyin, &x, a, sizeof(x)); \
a += sizeof(x); \
diff --git a/stand/userboot/userboot/bootinfo64.c b/stand/userboot/userboot/bootinfo64.c
index 10ff133..6088741 100644
--- a/stand/userboot/userboot/bootinfo64.c
+++ b/stand/userboot/userboot/bootinfo64.c
@@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$");
* MOD_METADATA (variable) type-specific metadata
*/
#define COPY32(v, a, c) { \
- u_int32_t x = (v); \
+ uint32_t x = (v); \
if (c) \
CALLBACK(copyin, &x, a, sizeof(x)); \
a += sizeof(x); \
@@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$");
COPY32(strlen(s) + 1, a, c); \
if (c) \
CALLBACK(copyin, s, a, strlen(s) + 1); \
- a += roundup(strlen(s) + 1, sizeof(u_int64_t));\
+ a += roundup(strlen(s) + 1, sizeof(uint64_t));\
}
#define MOD_NAME(a, s, c) MOD_STR(MODINFO_NAME, a, s, c)
@@ -79,7 +79,7 @@ __FBSDID("$FreeBSD$");
COPY32(sizeof(s), a, c); \
if (c) \
CALLBACK(copyin, &s, a, sizeof(s)); \
- a += roundup(sizeof(s), sizeof(u_int64_t)); \
+ a += roundup(sizeof(s), sizeof(uint64_t)); \
}
#define MOD_ADDR(a, s, c) MOD_VAR(MODINFO_ADDR, a, s, c)
@@ -90,7 +90,7 @@ __FBSDID("$FreeBSD$");
COPY32(mm->md_size, a, c); \
if (c) \
CALLBACK(copyin, mm->md_data, a, mm->md_size); \
- a += roundup(mm->md_size, sizeof(u_int64_t));\
+ a += roundup(mm->md_size, sizeof(uint64_t));\
}
#define MOD_END(a, c) { \
@@ -104,7 +104,7 @@ bi_copymodules64(vm_offset_t addr)
struct preloaded_file *fp;
struct file_metadata *md;
int c;
- u_int64_t v;
+ uint64_t v;
c = addr != 0;
/* start with the first module on the list, should be the kernel */
@@ -185,8 +185,8 @@ bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernendp)
struct userboot_devdesc *rootdev;
struct file_metadata *md;
vm_offset_t addr;
- u_int64_t kernend;
- u_int64_t envp;
+ uint64_t kernend;
+ uint64_t envp;
vm_offset_t size;
char *rootdevname;
int howto;
diff --git a/stand/userboot/userboot/devicename.c b/stand/userboot/userboot/devicename.c
index efa5634..06ec394 100644
--- a/stand/userboot/userboot/devicename.c
+++ b/stand/userboot/userboot/devicename.c
@@ -139,7 +139,7 @@ userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **p
goto fail;
}
- idev->d_unit = unit;
+ idev->dd.d_unit = unit;
if (path != NULL)
*path = (*cp == 0) ? cp : cp + 1;
break;
@@ -158,8 +158,7 @@ userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **p
err = EINVAL;
goto fail;
}
- idev->d_dev = dv;
- idev->d_type = dv->dv_type;
+ idev->dd.d_dev = dv;
if (dev == NULL) {
free(idev);
} else {
@@ -179,27 +178,27 @@ userboot_fmtdev(void *vdev)
struct disk_devdesc *dev = (struct disk_devdesc *)vdev;
static char buf[128]; /* XXX device length constant? */
- switch(dev->d_type) {
+ switch(dev->dd.d_dev->dv_type) {
case DEVT_NONE:
strcpy(buf, "(no device)");
break;
case DEVT_CD:
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+ sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
break;
case DEVT_DISK:
return (disk_fmtdev(vdev));
case DEVT_NET:
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+ sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
break;
case DEVT_ZFS:
#if defined(USERBOOT_ZFS_SUPPORT)
return (zfs_fmtdev(vdev));
#else
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+ sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
#endif
break;
}
diff --git a/stand/userboot/userboot/elf64_freebsd.c b/stand/userboot/userboot/elf64_freebsd.c
index 19d369d..0dd90fa 100644
--- a/stand/userboot/userboot/elf64_freebsd.c
+++ b/stand/userboot/userboot/elf64_freebsd.c
@@ -60,9 +60,9 @@ struct file_format amd64_elf_obj = { elf64_obj_loadfile, elf64_obj_exec };
#define PG_U 0x004
#define PG_PS 0x080
-typedef u_int64_t p4_entry_t;
-typedef u_int64_t p3_entry_t;
-typedef u_int64_t p2_entry_t;
+typedef uint64_t p4_entry_t;
+typedef uint64_t p3_entry_t;
+typedef uint64_t p2_entry_t;
#define GUEST_NULL_SEL 0
#define GUEST_CODE_SEL 1
diff --git a/stand/userboot/userboot/main.c b/stand/userboot/userboot/main.c
index 00ca243..1f0901d 100644
--- a/stand/userboot/userboot/main.c
+++ b/stand/userboot/userboot/main.c
@@ -159,13 +159,13 @@ extract_currdev(void)
//bzero(&dev, sizeof(dev));
#if defined(USERBOOT_ZFS_SUPPORT)
+ CTASSERT(sizeof(struct disk_devdesc) >= sizeof(struct zfs_devdesc));
if (userboot_zfs_found) {
struct zfs_devdesc zdev;
/* Leave the pool/root guid's unassigned */
bzero(&zdev, sizeof(zdev));
- zdev.d_dev = &zfs_dev;
- zdev.d_type = zdev.d_dev->dv_type;
+ zdev.dd.d_dev = &zfs_dev;
dev = *(struct disk_devdesc *)&zdev;
init_zfs_bootenv(zfs_fmtdev(&dev));
@@ -173,23 +173,21 @@ extract_currdev(void)
#endif
if (userboot_disk_maxunit > 0) {
- dev.d_dev = &userboot_disk;
- dev.d_type = dev.d_dev->dv_type;
- dev.d_unit = 0;
+ dev.dd.d_dev = &userboot_disk;
+ dev.dd.d_unit = 0;
dev.d_slice = 0;
dev.d_partition = 0;
/*
* If we cannot auto-detect the partition type then
* access the disk as a raw device.
*/
- if (dev.d_dev->dv_open(NULL, &dev)) {
+ if (dev.dd.d_dev->dv_open(NULL, &dev)) {
dev.d_slice = -1;
dev.d_partition = -1;
}
} else {
- dev.d_dev = &host_dev;
- dev.d_type = dev.d_dev->dv_type;
- dev.d_unit = 0;
+ dev.dd.d_dev = &host_dev;
+ dev.dd.d_unit = 0;
}
env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev),
diff --git a/stand/userboot/userboot/userboot_disk.c b/stand/userboot/userboot/userboot_disk.c
index fc21b5f..149ba25 100644
--- a/stand/userboot/userboot/userboot_disk.c
+++ b/stand/userboot/userboot/userboot_disk.c
@@ -135,8 +135,8 @@ userdisk_print(int verbose)
ret = pager_output(line);
if (ret != 0)
break;
- dev.d_dev = &userboot_disk;
- dev.d_unit = i;
+ dev.dd.d_dev = &userboot_disk;
+ dev.dd.d_unit = i;
dev.d_slice = -1;
dev.d_partition = -1;
if (disk_open(&dev, ud_info[i].mediasize,
@@ -164,13 +164,13 @@ userdisk_open(struct open_file *f, ...)
dev = va_arg(ap, struct disk_devdesc *);
va_end(ap);
- if (dev->d_unit < 0 || dev->d_unit >= userdisk_maxunit)
+ if (dev->dd.d_unit < 0 || dev->dd.d_unit >= userdisk_maxunit)
return (EIO);
- ud_info[dev->d_unit].ud_open++;
- if (ud_info[dev->d_unit].ud_bcache == NULL)
- ud_info[dev->d_unit].ud_bcache = bcache_allocate();
- return (disk_open(dev, ud_info[dev->d_unit].mediasize,
- ud_info[dev->d_unit].sectorsize));
+ ud_info[dev->dd.d_unit].ud_open++;
+ if (ud_info[dev->dd.d_unit].ud_bcache == NULL)
+ ud_info[dev->dd.d_unit].ud_bcache = bcache_allocate();
+ return (disk_open(dev, ud_info[dev->dd.d_unit].mediasize,
+ ud_info[dev->dd.d_unit].sectorsize));
}
static int
@@ -179,10 +179,10 @@ userdisk_close(struct open_file *f)
struct disk_devdesc *dev;
dev = (struct disk_devdesc *)f->f_devdata;
- ud_info[dev->d_unit].ud_open--;
- if (ud_info[dev->d_unit].ud_open == 0) {
- bcache_free(ud_info[dev->d_unit].ud_bcache);
- ud_info[dev->d_unit].ud_bcache = NULL;
+ ud_info[dev->dd.d_unit].ud_open--;
+ if (ud_info[dev->dd.d_unit].ud_open == 0) {
+ bcache_free(ud_info[dev->dd.d_unit].ud_bcache);
+ ud_info[dev->dd.d_unit].ud_bcache = NULL;
}
return (disk_close(dev));
}
@@ -197,7 +197,7 @@ userdisk_strategy(void *devdata, int rw, daddr_t dblk, size_t size,
dev = (struct disk_devdesc *)devdata;
bcd.dv_strategy = userdisk_realstrategy;
bcd.dv_devdata = devdata;
- bcd.dv_cache = ud_info[dev->d_unit].ud_bcache;
+ bcd.dv_cache = ud_info[dev->dd.d_unit].ud_bcache;
return (bcache_strategy(&bcd, rw, dblk + dev->d_offset,
size, buf, rsize));
}
@@ -218,8 +218,8 @@ userdisk_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
return (EINVAL);
if (rsize)
*rsize = 0;
- off = dblk * ud_info[dev->d_unit].sectorsize;
- rc = CALLBACK(diskread, dev->d_unit, off, buf, size, &resid);
+ off = dblk * ud_info[dev->dd.d_unit].sectorsize;
+ rc = CALLBACK(diskread, dev->dd.d_unit, off, buf, size, &resid);
if (rc)
return (rc);
if (rsize)
@@ -238,5 +238,5 @@ userdisk_ioctl(struct open_file *f, u_long cmd, void *data)
if (rc != ENOTTY)
return (rc);
- return (CALLBACK(diskioctl, dev->d_unit, cmd, data));
+ return (CALLBACK(diskioctl, dev->dd.d_unit, cmd, data));
}
diff --git a/stand/zfs/libzfs.h b/stand/zfs/libzfs.h
index d1b46746..4b1e636 100644
--- a/stand/zfs/libzfs.h
+++ b/stand/zfs/libzfs.h
@@ -33,18 +33,14 @@
/*
* ZFS fully-qualified device descriptor.
- * Note, this must match the 'struct devdesc' declaration in bootstrap.h.
* Arch-specific device descriptors should be binary compatible with this
* structure if they are to support ZFS.
*/
-struct zfs_devdesc
-{
- struct devsw *d_dev;
- int d_type;
- int d_unit;
- void *d_opendata;
- uint64_t pool_guid;
- uint64_t root_guid;
+/* Note: Must match the 'struct devdesc' in stand.h */
+struct zfs_devdesc {
+ struct devdesc dd;
+ uint64_t pool_guid;
+ uint64_t root_guid;
};
#ifdef LOADER_GELI_SUPPORT
diff --git a/stand/zfs/zfs.c b/stand/zfs/zfs.c
index a588f7e..a818340 100644
--- a/stand/zfs/zfs.c
+++ b/stand/zfs/zfs.c
@@ -685,8 +685,7 @@ zfs_parsedev(struct zfs_devdesc *dev, const char *devspec, const char **path)
return (rv);
if (path != NULL)
*path = (*end == '\0') ? end : end + 1;
- dev->d_dev = &zfs_dev;
- dev->d_type = zfs_dev.dv_type;
+ dev->dd.d_dev = &zfs_dev;
return (0);
}
@@ -699,7 +698,7 @@ zfs_fmtdev(void *vdev)
spa_t *spa;
buf[0] = '\0';
- if (dev->d_type != DEVT_ZFS)
+ if (dev->dd.d_dev->dv_type != DEVT_ZFS)
return (buf);
if (dev->pool_guid == 0) {
@@ -721,9 +720,9 @@ zfs_fmtdev(void *vdev)
}
if (rootname[0] == '\0')
- sprintf(buf, "%s:%s:", dev->d_dev->dv_name, spa->spa_name);
+ sprintf(buf, "%s:%s:", dev->dd.d_dev->dv_name, spa->spa_name);
else
- sprintf(buf, "%s:%s/%s:", dev->d_dev->dv_name, spa->spa_name,
+ sprintf(buf, "%s:%s/%s:", dev->dd.d_dev->dv_name, spa->spa_name,
rootname);
return (buf);
}
OpenPOWER on IntegriCloud