Home | History | Annotate | Line # | Download | only in include
pdinfo.h revision 1.1
      1 /*	$NetBSD: pdinfo.h,v 1.1 2005/12/29 15:20:08 tsutsui Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2004 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by UCHIYAMA Yasushi.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *        This product includes software developed by the NetBSD
     21  *        Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 #ifndef _EWS4800MIPS_PDINFO_H_
     40 #define	_EWS4800MIPS_PDINFO_H_
     41 
     42 /* Phisical Disk INFOrmation */
     43 
     44 #define	PDINFO_SECTOR		8		/* sector */
     45 #define	PDINFO_MAGIC		0xca5e600d
     46 #define	PDINFO_VERSION		2
     47 
     48 struct disk_geometory {
     49 	uint32_t cylinders_per_drive;		/* 24 */
     50 	uint32_t tracks_per_cylinder;		/* 28 */
     51 	uint32_t sectors_per_track;		/* 32 */
     52 	uint32_t bytes_per_sector;		/* 36 */
     53 } __attribute__((__packed__));
     54 
     55 /* UX internal use */
     56 struct disk_ux {
     57 	uint32_t errorlog_sector;		/* 44 */
     58 	uint32_t errorlog_size_byte;		/* 48 */
     59 	uint32_t mfg_sector;			/* 52 */
     60 	uint32_t mfg_size_byte;			/* 56 */
     61 	uint32_t defect_sector;			/* 60 */
     62 	uint32_t defect_size_byte;		/* 64 */
     63 	uint32_t n_relocation_area;		/* 68 */
     64 	uint32_t relocation_area_sector;	/* 72 */
     65 	uint32_t relocation_area_size_byte;	/* 76 */
     66 	uint32_t next_relocation_area;		/* 80 */
     67 	uint32_t diag_sector;			/* 84 */
     68 	uint32_t diag_size;			/* 88 */
     69 	uint32_t gap_size;			/* 92 */
     70 } __attribute__((__packed__));
     71 
     72 /* Sector image */
     73 struct pdinfo_sector {
     74 	uint32_t drive_id;			/* 0 */
     75 	uint32_t magic;				/* 4 */
     76 	uint32_t version;			/* 8 */
     77 	int8_t device_serial_number[12];	/* 12 */
     78 	struct disk_geometory geometory;	/* 24 */
     79 	uint32_t logical_sector;		/* 40 */
     80 	struct disk_ux ux;			/* 44 */
     81 	uint32_t device_depend[104];		/* 96 */
     82 } __attribute__((__packed__));			/* 512 byte */
     83 
     84 #if defined(_KERNEL) || defined(_STANDALONE)
     85 boolean_t pdinfo_sector(void *, struct pdinfo_sector *);
     86 boolean_t pdinfo_sanity(const struct pdinfo_sector *);
     87 boolean_t pdinfo_valid(const struct pdinfo_sector *);
     88 #endif
     89 
     90 #endif /* _EWS4800MIPS_PDINFO_H_ */
     91