Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys - add Apple driver map and partition map structs, ob...
details: https://anonhg.NetBSD.org/src/rev/0f0ed3ce4493
branches: trunk
changeset: 526989:0f0ed3ce4493
user: lukem <lukem%NetBSD.org@localhost>
date: Wed May 15 13:32:10 2002 +0000
description:
- add Apple driver map and partition map structs, obtained from
sys/arch/macppc/include/disklabel.h (with elements renamed as appropriate)
- consistenly use "uint*_t" instead of "u_int*_t"
diffstat:
sys/sys/bootblock.h | 190 ++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 154 insertions(+), 36 deletions(-)
diffs (300 lines):
diff -r 3e36b1142fbf -r 0f0ed3ce4493 sys/sys/bootblock.h
--- a/sys/sys/bootblock.h Wed May 15 13:01:27 2002 +0000
+++ b/sys/sys/bootblock.h Wed May 15 13:32:10 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootblock.h,v 1.5 2002/05/15 09:44:55 lukem Exp $ */
+/* $NetBSD: bootblock.h,v 1.6 2002/05/15 13:32:10 lukem Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -32,7 +32,39 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-
+/*-
+ * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
+ * Michael L. Finch, Bradley A. Grantham, and
+ * Lawrence A. Kesteloot
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the Alice Group.
+ * 4. The names of the Alice Group or any of its members may not be used
+ * to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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.
+ *
+ */
/*
* Copyright (c) 1994, 1999 Christopher G. Demetriou
* All rights reserved.
@@ -73,7 +105,7 @@
#include <stdint.h>
#endif
-/*
+/* ------------------------------------------
* shared --
* definintions shared by many platforms
*/
@@ -89,8 +121,7 @@
};
-
-/*
+/* ------------------------------------------
* alpha --
* Alpha (disk, but also tape) Boot Block.
*
@@ -98,9 +129,9 @@
*/
struct alpha_boot_block {
- u_int64_t bb_data[63]; /* data (disklabel, also as below) */
- u_int64_t bb_cksum; /* checksum of the boot block,
- * taken as u_int64_t's
+ uint64_t bb_data[63]; /* data (disklabel, also as below) */
+ uint64_t bb_cksum; /* checksum of the boot block,
+ * taken as uint64_t's
*/
};
#define bb_secsize bb_data[60] /* secondary size (blocks) */
@@ -116,7 +147,7 @@
#define ALPHA_BOOT_BLOCK_CKSUM(bb,cksum) \
do { \
const struct alpha_boot_block *_bb = (bb); \
- u_int64_t _cksum; \
+ uint64_t _cksum; \
int _i; \
\
_cksum = 0; \
@@ -127,8 +158,95 @@
*(cksum) = _cksum; \
} while (0)
+/* ------------------------------------------
+ * apple --
+ * Apple computers boot block related information
+ */
+
+/*
+ * Driver Descriptor Map, from Inside Macintosh: Devices, SCSI Manager
+ * pp 12-13. The driver descriptor map always resides on physical block 0.
+ */
+struct apple_drvr_descriptor {
+ uint32_t descBlock; /* first block of driver */
+ uint16_t descSize; /* driver size in blocks */
+ uint16_t descType; /* system type */
+};
+
+/*
+ * system types; Apple reserves 0-15
+ */
+#define APPLE_DRVR_TYPE_MACINTOSH 1
+
+#define APPLE_DRVR_MAP_MAGIC 0x4552
+#define APPLE_DRVR_MAP_MAX_DESCRIPTORS 61
+
+struct apple_drvr_map {
+ uint16_t sbSig; /* map signature */
+ uint16_t sbBlockSize; /* block size of device */
+ uint32_t sbBlkCount; /* number of blocks on device */
+ uint16_t sbDevType; /* (used internally by ROM) */
+ uint16_t sbDevID; /* (used internally by ROM) */
+ uint32_t sbData; /* (used internally by ROM) */
+ uint16_t sbDrvrCount; /* number of driver descriptors */
+ struct apple_drvr_descriptor sb_dd[APPLE_DRVR_MAP_MAX_DESCRIPTORS];
+ uint16_t pad[3];
+} __attribute__ ((packed));
/*
+ * Partition map structure from Inside Macintosh: Devices, SCSI Manager
+ * pp. 13-14. The partition map always begins on physical block 1.
+ *
+ * With the exception of block 0, all blocks on the disk must belong to
+ * exactly one partition. The partition map itself belongs to a partition
+ * of type `APPLE_PARTITION_MAP', and is not limited in size by anything
+ * other than available disk space. The partition map is not necessarily
+ * the first partition listed.
+ */
+#define APPLE_PART_MAP_ENTRY_MAGIC 0x504d
+
+struct apple_part_map_entry {
+ uint16_t pmSig; /* partition signature */
+ uint16_t pmSigPad; /* (reserved) */
+ uint32_t pmMapBlkCnt; /* number of blocks in partition map */
+ uint32_t pmPyPartStart; /* first physical block of partition */
+ uint32_t pmPartBlkCnt; /* number of blocks in partition */
+ uint8_t pmPartName[32]; /* partition name */
+ uint8_t pmPartType[32]; /* partition type */
+ uint32_t pmLgDataStart; /* first logical block of data area */
+ uint32_t pmDataCnt; /* number of blocks in data area */
+ uint32_t pmPartStatus; /* partition status information */
+ uint32_t pmLgBootStart; /* first logical block of boot code */
+ uint32_t pmBootSize; /* size of boot code, in bytes */
+ uint32_t pmBootLoad; /* boot code load address */
+ uint32_t pmBootLoad2; /* (reserved) */
+ uint32_t pmBootEntry; /* boot code entry point */
+ uint32_t pmBootEntry2; /* (reserved) */
+ uint32_t pmBootCksum; /* boot code checksum */
+ int8_t pmProcessor[16]; /* processor type (e.g. "68020") */
+ uint8_t pmBootArgs[128]; /* A/UX boot arguments */
+ uint8_t pad[248]; /* pad to end of block */
+};
+
+#define APPLE_PART_TYPE_DRIVER "APPLE_DRIVER"
+#define APPLE_PART_TYPE_DRIVER43 "APPLE_DRIVER43"
+#define APPLE_PART_TYPE_DRIVERATA "APPLE_DRIVER_ATA"
+#define APPLE_PART_TYPE_DRIVERIOKIT "APPLE_DRIVER_IOKIT"
+#define APPLE_PART_TYPE_FWDRIVER "APPLE_FWDRIVER"
+#define APPLE_PART_TYPE_FWB_COMPONENT "FWB DRIVER COMPONENTS"
+#define APPLE_PART_TYPE_FREE "APPLE_FREE"
+#define APPLE_PART_TYPE_MAC "APPLE_HFS"
+#define APPLE_PART_TYPE_NETBSD "NETBSD"
+#define APPLE_PART_TYPE_NBSD_PPCBOOT "NETBSD/MACPPC"
+#define APPLE_PART_TYPE_NBSD_68KBOOT "NETBSD/MAC68K"
+#define APPLE_PART_TYPE_PATCHES "APPLE_PATCHES"
+#define APPLE_PART_TYPE_PARTMAP "APPLE_PARTITION_MAP"
+#define APPLE_PART_TYPE_PATCHES "APPLE_PATCHES"
+#define APPLE_PART_TYPE_SCRATCH "APPLE_SCRATCH"
+#define APPLE_PART_TYPE_UNIX "APPLE_UNIX_SVR2"
+
+
+/* ------------------------------------------
* macppc
*/
@@ -138,7 +256,7 @@
/* Magic string -- 32 bytes long (including the NUL) */
#define MACPPC_BBINFO_MAGIC "NetBSD/macppc bootxx 20020515"
-/*
+/* ------------------------------------------
* pmax --
* PMAX (DECstation / MIPS) boot block information
*/
@@ -160,11 +278,11 @@
* start block pairs. Under NetBSD, contiguous mode is always used.
*/
struct pmax_boot_block {
- u_int8_t pad[8];
+ uint8_t pad[8];
int32_t magic; /* PMAX_BOOT_MAGIC */
int32_t mode; /* Mode for boot info. */
- u_int32_t load_addr; /* Address to start loading. */
- u_int32_t exec_addr; /* Address to start execing. */
+ uint32_t load_addr; /* Address to start loading. */
+ uint32_t exec_addr; /* Address to start execing. */
struct pmax_boot_map map[61]; /* boot program section(s). */
} __attribute__((__packed__));
@@ -176,7 +294,7 @@
#define PMAX_BOOT_BLOCK_BLOCKSIZE 512
-/*
+/* ------------------------------------------
* sparc
*/
@@ -187,7 +305,7 @@
#define SPARC_BBINFO_MAGIC "NetBSD/sparc bootxx 20020515"
-/*
+/* ------------------------------------------
* sparc64
*/
@@ -196,7 +314,7 @@
#define SPARC64_BOOT_BLOCK_MAX_SIZE (512 * 15)
-/*
+/* ------------------------------------------
* sun68k (sun2, sun3)
*/
@@ -207,41 +325,41 @@
#define SUN68K_BBINFO_MAGIC "NetBSD/sun68k bootxx 20020515"
-/*
+/* ------------------------------------------
* vax --
* VAX boot block information
*/
struct vax_boot_block {
/* Note that these don't overlap any of the pmax boot block */
- u_int8_t pad0[2];
- u_int8_t bb_id_offset; /* offset in words to id (magic1)*/
- u_int8_t bb_mbone; /* must be one */
- u_int16_t bb_lbn_hi; /* lbn (hi word) of bootstrap */
- u_int16_t bb_lbn_low; /* lbn (low word) of bootstrap */
- u_int8_t pad1[332];
+ uint8_t pad0[2];
+ uint8_t bb_id_offset; /* offset in words to id (magic1)*/
+ uint8_t bb_mbone; /* must be one */
+ uint16_t bb_lbn_hi; /* lbn (hi word) of bootstrap */
+ uint16_t bb_lbn_low; /* lbn (low word) of bootstrap */
+ uint8_t pad1[332];
/* The rest of these fields are identification area and describe
* the secondary block for uVAX VMB.
*/
- u_int8_t bb_magic1; /* magic number */
- u_int8_t bb_mbz1; /* must be zero */
- u_int8_t bb_pad1; /* any value */
- u_int8_t bb_sum1; /* ~(magic1 + mbz1 + pad1) */
+ uint8_t bb_magic1; /* magic number */
+ uint8_t bb_mbz1; /* must be zero */
+ uint8_t bb_pad1; /* any value */
+ uint8_t bb_sum1; /* ~(magic1 + mbz1 + pad1) */
- u_int8_t bb_mbz2; /* must be zero */
- u_int8_t bb_volinfo; /* volinfo */
- u_int8_t bb_pad2a; /* any value */
- u_int8_t bb_pad2b; /* any value */
+ uint8_t bb_mbz2; /* must be zero */
+ uint8_t bb_volinfo; /* volinfo */
+ uint8_t bb_pad2a; /* any value */
+ uint8_t bb_pad2b; /* any value */
- u_int32_t bb_size; /* size in blocks of bootstrap */
- u_int32_t bb_load; /* load offset to bootstrap */
- u_int32_t bb_entry; /* byte offset in bootstrap */
- u_int32_t bb_sum3; /* sum of previous 3 fields */
+ uint32_t bb_size; /* size in blocks of bootstrap */
+ uint32_t bb_load; /* load offset to bootstrap */
+ uint32_t bb_entry; /* byte offset in bootstrap */
+ uint32_t bb_sum3; /* sum of previous 3 fields */
/* The rest is unused.
*/
- u_int8_t pad2[148];
+ uint8_t pad2[148];
} __attribute__((__packed__));
#define VAX_BOOT_MAGIC1 0x18 /* size of BB info? */
Home |
Main Index |
Thread Index |
Old Index