
/*
 *   Hard disk header file
 */

/*
 * Copyright 1987 Alan Kent
 *
 * Permission is granted to redistribute this code as long
 * as this message is retained in the code and the code is
 * not sold without written permission from the author.
 *
 * UUCP: {seismo,hplabs,mcvax,ukc,nttlab}!munnari!goanna.oz!ajk
 * ACSnet: ajk@goanna.oz
 * ARPA: munnari!goanna.oz!ajk@SEISMO.ARPA
 */

#ifndef DEVICES_HARDDISK_H
#define DEVICES_HARDDISK_H

#ifndef DEVICES_TRACKDISK_H
#include "devices/trackdisk.h"
#endif


#define HD_NAME 			"harddisk.device"


/* at present, can only handle 1 unit */
/* problems with sharing interrupts, caches etc */

#define HD_NUMUNITS	1

#define HD_SECTOR	512
#define HD_SECSHIFT	9


#define HD_PARK		(TD_LASTCOMM+1)
#define HD_GETINFO	(TD_LASTCOMM+2)
#define HD_LASTCOMM	HD_GETINFO



#define HD_MAGIC			0xCE11DCF0

#define HD_MAP_SIZE			(4*(HD_SECTOR/sizeof(LONG)))
#define HD_MAP_SECTORS		(sizeof(struct hd_FirstSector)/HD_SECTOR)



struct hd_FirstSector {
	LONG magic;
	LONG cylinders;
	LONG park_cylinder;
	LONG heads;
	LONG sectors;
	LONG map_sectors;
	LONG bad_sectors;
	LONG precomp;
	UBYTE pad[HD_SECTOR-8*sizeof(LONG)];

	UBYTE interleave[ HD_SECTOR ];

	LONG map[ HD_MAP_SIZE ];
};



/* for map */

#define MAP_MARK_FREE	-1

/* MARK_BAD means the sector is a bad sector so dont use it */

#define MAP_MARK_BAD	-2



struct IOExtHD {
	struct IOExtTD	iohd_TD;

	/* any extensions go here */

	struct hd_FirstSector iohd_Info;	/* used only by HD_GETINFO */
};

#endif
