summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2000-02-09 19:23:46 +0000
committerru <ru@FreeBSD.org>2000-02-09 19:23:46 +0000
commit4b1fee2e59c11f47630612ae62a763b0202a0f26 (patch)
treee7b6cae9f648496bfcdb4cfa1abd7face52d654b /sys/boot
parent3e19b530ec613dcf8b04bf8314378fb022c682ee (diff)
downloadFreeBSD-src-4b1fee2e59c11f47630612ae62a763b0202a0f26.zip
FreeBSD-src-4b1fee2e59c11f47630612ae62a763b0202a0f26.tar.gz
Support the new ata(4) syntax, while providing backward compatibility for wd(4).
Reviewed by: jkh, msmith, sos Approved by: jkh
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/i386/boot2/boot2.c23
-rw-r--r--sys/boot/i386/gptboot/gptboot.c23
2 files changed, 26 insertions, 20 deletions
diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c
index eefcf08..ad7e8e9 100644
--- a/sys/boot/i386/boot2/boot2.c
+++ b/sys/boot/i386/boot2/boot2.c
@@ -66,10 +66,11 @@
#define DRV_HARD 0x80
#define DRV_MASK 0x7f
-#define MAJ_WD 0
-#define MAJ_WFD 1
-#define MAJ_FD 2
-#define MAJ_DA 4
+#define TYPE_AD 0
+#define TYPE_WD 1
+#define TYPE_WFD 2
+#define TYPE_FD 3
+#define TYPE_DA 4
extern uint32_t _end;
@@ -88,7 +89,8 @@ static const unsigned char flags[NOPT] = {
RBX_VERBOSE
};
-static const char *const dev_nm[] = {"wd", " ", "fd", " ", "da"};
+static const char *const dev_nm[] = {"ad", "wd", " ", "fd", "da"};
+static const unsigned dev_maj[] = {30, 0, 1, 2, 4};
static struct dsk {
unsigned drive;
@@ -140,7 +142,7 @@ main(void)
v86.ctl = V86_FLAGS;
dsk.drive = *(uint8_t *)PTOV(ARGS);
- dsk.type = dsk.drive & DRV_HARD ? MAJ_WD : MAJ_FD;
+ dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD;
dsk.unit = dsk.drive & DRV_MASK;
dsk.slice = *(uint8_t *)PTOV(ARGS + 1) + 1;
bootinfo.bi_version = BOOTINFO_VERSION;
@@ -285,7 +287,7 @@ load(const char *fname)
bootinfo.bi_kernelname = VTOP(fname);
bootinfo.bi_bios_dev = dsk.drive;
__exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
- MAKEBOOTDEV(dsk.type, 0, dsk.slice, dsk.unit, dsk.part),
+ MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.slice, dsk.unit, dsk.part),
0, 0, 0, VTOP(&bootinfo));
}
@@ -355,8 +357,9 @@ parse(char *arg)
arg += 2;
if (drv == -1)
drv = dsk.unit;
- dsk.drive = (dsk.type == MAJ_WD ||
- dsk.type == MAJ_DA ? DRV_HARD : 0) + drv;
+ dsk.drive = (dsk.type == TYPE_WD ||
+ dsk.type == TYPE_AD ||
+ dsk.type == TYPE_DA ? DRV_HARD : 0) + drv;
dsk.meta = 0;
fsread(0, NULL, 0);
}
@@ -568,7 +571,7 @@ dskread(void *buf, unsigned lba, unsigned nblk)
} else {
if (!dsk.init) {
if (d->d_type == DTYPE_SCSI)
- dsk.type = MAJ_DA;
+ dsk.type = TYPE_DA;
dsk.init++;
}
if (dsk.part >= d->d_npartitions ||
diff --git a/sys/boot/i386/gptboot/gptboot.c b/sys/boot/i386/gptboot/gptboot.c
index eefcf08..ad7e8e9 100644
--- a/sys/boot/i386/gptboot/gptboot.c
+++ b/sys/boot/i386/gptboot/gptboot.c
@@ -66,10 +66,11 @@
#define DRV_HARD 0x80
#define DRV_MASK 0x7f
-#define MAJ_WD 0
-#define MAJ_WFD 1
-#define MAJ_FD 2
-#define MAJ_DA 4
+#define TYPE_AD 0
+#define TYPE_WD 1
+#define TYPE_WFD 2
+#define TYPE_FD 3
+#define TYPE_DA 4
extern uint32_t _end;
@@ -88,7 +89,8 @@ static const unsigned char flags[NOPT] = {
RBX_VERBOSE
};
-static const char *const dev_nm[] = {"wd", " ", "fd", " ", "da"};
+static const char *const dev_nm[] = {"ad", "wd", " ", "fd", "da"};
+static const unsigned dev_maj[] = {30, 0, 1, 2, 4};
static struct dsk {
unsigned drive;
@@ -140,7 +142,7 @@ main(void)
v86.ctl = V86_FLAGS;
dsk.drive = *(uint8_t *)PTOV(ARGS);
- dsk.type = dsk.drive & DRV_HARD ? MAJ_WD : MAJ_FD;
+ dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD;
dsk.unit = dsk.drive & DRV_MASK;
dsk.slice = *(uint8_t *)PTOV(ARGS + 1) + 1;
bootinfo.bi_version = BOOTINFO_VERSION;
@@ -285,7 +287,7 @@ load(const char *fname)
bootinfo.bi_kernelname = VTOP(fname);
bootinfo.bi_bios_dev = dsk.drive;
__exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
- MAKEBOOTDEV(dsk.type, 0, dsk.slice, dsk.unit, dsk.part),
+ MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.slice, dsk.unit, dsk.part),
0, 0, 0, VTOP(&bootinfo));
}
@@ -355,8 +357,9 @@ parse(char *arg)
arg += 2;
if (drv == -1)
drv = dsk.unit;
- dsk.drive = (dsk.type == MAJ_WD ||
- dsk.type == MAJ_DA ? DRV_HARD : 0) + drv;
+ dsk.drive = (dsk.type == TYPE_WD ||
+ dsk.type == TYPE_AD ||
+ dsk.type == TYPE_DA ? DRV_HARD : 0) + drv;
dsk.meta = 0;
fsread(0, NULL, 0);
}
@@ -568,7 +571,7 @@ dskread(void *buf, unsigned lba, unsigned nblk)
} else {
if (!dsk.init) {
if (d->d_type == DTYPE_SCSI)
- dsk.type = MAJ_DA;
+ dsk.type = TYPE_DA;
dsk.init++;
}
if (dsk.part >= d->d_npartitions ||
OpenPOWER on IntegriCloud