1 /* 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Van Jacobson of Lawrence Berkeley Laboratory. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)sd_compat.c 8.1 (Berkeley) 06/10/93 11 */ 12 13 /* 14 * Compatibility for SCSI disks without labels. 15 */ 16 #include "sd.h" 17 #if NSD > 0 18 19 #include <sys/param.h> 20 #include <sys/disklabel.h> 21 #include <hp/dev/device.h> 22 #include <hp300/dev/sdvar.h> 23 24 /* 25 * Since the SCSI standard tends to hide the disk structure, we define 26 * partitions in terms of DEV_BSIZE blocks. The default partition table 27 * (for an unlabeled disk) reserves 512K for a boot area, has an 8 meg 28 * root (A) and 32 meg of swap (B). The rest of the space on the drive 29 * goes in the G partition. As usual, the C partition covers the entire 30 * disk (including the boot area). 31 * 32 * We also define the D, E, F and H partitions as an alternative to B and G. 33 * D is 48Mb, starts after A and is intended for swapping. 34 * E is 50Mb, starts after D and is intended for /usr. 35 * F starts after E and is what ever is left. 36 * H starts after D and is what ever is left (i.e. combo of E and F). 37 */ 38 struct partition sddefaultpart[] = { 39 { 16384, 1024, 1024, FS_BSDFFS, 8 }, 40 { 65536, 17408, 0, FS_SWAP, 0 }, 41 { 0, 0, 0, FS_BOOT, 0 }, 42 { 98304, 17408, 0, FS_SWAP, 0 }, 43 { 102400, 115712, 1024, FS_BSDFFS, 8 }, 44 { 0, 218112, 1024, FS_BSDFFS, 8 }, 45 { 0, 82944, 1024, FS_BSDFFS, 8 }, 46 { 0, 115712, 1024, FS_BSDFFS, 8 } 47 }; 48 int sdnumdefaultpart = sizeof(sddefaultpart)/sizeof(sddefaultpart[0]); 49 50 extern struct sd_softc sd_softc[]; 51 52 sdmakedisklabel(unit, lp) 53 int unit; 54 register struct disklabel *lp; 55 { 56 register struct sd_softc *sc = &sd_softc[unit]; 57 register struct partition *pi, *dpi; 58 register int dcount; 59 60 lp->d_secperunit = sc->sc_blks; 61 lp->d_rpm = 3600; 62 lp->d_interleave = 1; 63 if (sc->sc_flags & SDF_RMEDIA) 64 lp->d_flags |= D_REMOVABLE; 65 lp->d_npartitions = sdnumdefaultpart; 66 67 pi = lp->d_partitions; 68 dpi = sddefaultpart; 69 dcount = sdnumdefaultpart; 70 while (dcount-- > 0) 71 *pi++ = *dpi++; 72 73 pi = lp->d_partitions; 74 75 /* 76 * C gets everything 77 */ 78 pi[2].p_size = sc->sc_blks; 79 /* 80 * G gets from end of B to end of disk 81 */ 82 pi[6].p_size = sc->sc_blks - pi[6].p_offset; 83 /* 84 * H gets from end of D to end of disk 85 */ 86 pi[7].p_size = sc->sc_blks - pi[7].p_offset; 87 /* 88 * If disk is big enough, define E and F 89 */ 90 if (sc->sc_blks > pi[5].p_offset) 91 pi[5].p_size = sc->sc_blks - pi[5].p_offset; 92 else { 93 pi[4].p_offset = pi[4].p_size = 0; 94 pi[5].p_offset = pi[5].p_size = 0; 95 } 96 } 97 #endif 98