157330Shibler /*
2*63151Sbostic * Copyright (c) 1990, 1993
3*63151Sbostic * The Regents of the University of California. All rights reserved.
457330Shibler *
557330Shibler * This code is derived from software contributed to Berkeley by
657330Shibler * Van Jacobson of Lawrence Berkeley Laboratory.
757330Shibler *
857330Shibler * %sccs.include.redist.c%
957330Shibler *
10*63151Sbostic * @(#)sd_compat.c 8.1 (Berkeley) 06/10/93
1157330Shibler */
1257330Shibler
1357330Shibler /*
1457330Shibler * Compatibility for SCSI disks without labels.
1557330Shibler */
1657330Shibler #include "sd.h"
1757330Shibler #if NSD > 0
1857330Shibler
1957330Shibler #include <sys/param.h>
2057330Shibler #include <sys/disklabel.h>
2157330Shibler #include <hp/dev/device.h>
2257330Shibler #include <hp300/dev/sdvar.h>
2357330Shibler
2457330Shibler /*
2557330Shibler * Since the SCSI standard tends to hide the disk structure, we define
2657330Shibler * partitions in terms of DEV_BSIZE blocks. The default partition table
2757330Shibler * (for an unlabeled disk) reserves 512K for a boot area, has an 8 meg
2857330Shibler * root (A) and 32 meg of swap (B). The rest of the space on the drive
2957330Shibler * goes in the G partition. As usual, the C partition covers the entire
3057330Shibler * disk (including the boot area).
3157330Shibler *
3257330Shibler * We also define the D, E, F and H partitions as an alternative to B and G.
3357330Shibler * D is 48Mb, starts after A and is intended for swapping.
3457330Shibler * E is 50Mb, starts after D and is intended for /usr.
3557330Shibler * F starts after E and is what ever is left.
3657330Shibler * H starts after D and is what ever is left (i.e. combo of E and F).
3757330Shibler */
3857330Shibler struct partition sddefaultpart[] = {
3957330Shibler { 16384, 1024, 1024, FS_BSDFFS, 8 },
4057330Shibler { 65536, 17408, 0, FS_SWAP, 0 },
4158592Shibler { 0, 0, 0, FS_BOOT, 0 },
4257330Shibler { 98304, 17408, 0, FS_SWAP, 0 },
4357330Shibler { 102400, 115712, 1024, FS_BSDFFS, 8 },
4457330Shibler { 0, 218112, 1024, FS_BSDFFS, 8 },
4557330Shibler { 0, 82944, 1024, FS_BSDFFS, 8 },
4657330Shibler { 0, 115712, 1024, FS_BSDFFS, 8 }
4757330Shibler };
4857330Shibler int sdnumdefaultpart = sizeof(sddefaultpart)/sizeof(sddefaultpart[0]);
4957330Shibler
5057330Shibler extern struct sd_softc sd_softc[];
5157330Shibler
sdmakedisklabel(unit,lp)5257330Shibler sdmakedisklabel(unit, lp)
5357330Shibler int unit;
5457330Shibler register struct disklabel *lp;
5557330Shibler {
5657330Shibler register struct sd_softc *sc = &sd_softc[unit];
5757330Shibler register struct partition *pi, *dpi;
5857330Shibler register int dcount;
5957330Shibler
6057330Shibler lp->d_secperunit = sc->sc_blks;
6157330Shibler lp->d_rpm = 3600;
6257330Shibler lp->d_interleave = 1;
6357330Shibler if (sc->sc_flags & SDF_RMEDIA)
6457330Shibler lp->d_flags |= D_REMOVABLE;
6557330Shibler lp->d_npartitions = sdnumdefaultpart;
6657330Shibler
6757330Shibler pi = lp->d_partitions;
6857330Shibler dpi = sddefaultpart;
6957330Shibler dcount = sdnumdefaultpart;
7057330Shibler while (dcount-- > 0)
7157330Shibler *pi++ = *dpi++;
7257330Shibler
7357330Shibler pi = lp->d_partitions;
7457330Shibler
7557330Shibler /*
7657330Shibler * C gets everything
7757330Shibler */
7857330Shibler pi[2].p_size = sc->sc_blks;
7957330Shibler /*
8057330Shibler * G gets from end of B to end of disk
8157330Shibler */
8257330Shibler pi[6].p_size = sc->sc_blks - pi[6].p_offset;
8357330Shibler /*
8457330Shibler * H gets from end of D to end of disk
8557330Shibler */
8657330Shibler pi[7].p_size = sc->sc_blks - pi[7].p_offset;
8757330Shibler /*
8857330Shibler * If disk is big enough, define E and F
8957330Shibler */
9057330Shibler if (sc->sc_blks > pi[5].p_offset)
9157330Shibler pi[5].p_size = sc->sc_blks - pi[5].p_offset;
9257330Shibler else {
9357330Shibler pi[4].p_offset = pi[4].p_size = 0;
9457330Shibler pi[5].p_offset = pi[5].p_size = 0;
9557330Shibler }
9657330Shibler }
9757330Shibler #endif
98