]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/machparam.h
xnu-1228.15.4.tar.gz
[apple/xnu.git] / osfmk / ppc / machparam.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * @OSF_COPYRIGHT@
30 */
31 /*
32 * Copyright (c) 1990, 1991 The University of Utah and
33 * the Center for Software Science at the University of Utah (CSS).
34 * All rights reserved.
35 *
36 * Permission to use, copy, modify and distribute this software is hereby
37 * granted provided that (1) source code retains these copyright, permission,
38 * and disclaimer notices, and (2) redistributions including binaries
39 * reproduce the notices in supporting documentation, and (3) all advertising
40 * materials mentioning features or use of this software display the following
41 * acknowledgement: ``This product includes software developed by the Center
42 * for Software Science at the University of Utah.''
43 *
44 * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
45 * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF
46 * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 *
48 * CSS requests users of this software to return to css-dist@cs.utah.edu any
49 * improvements that they make and grant CSS redistribution rights.
50 *
51 * Utah $Hdr: machparam.h 1.7 92/05/22$
52 */
53
54 #ifndef _PPC_MACHPARAM_H_
55 #define _PPC_MACHPARAM_H_
56
57 /*
58 * Machine dependent constants for ppc.
59 * Added as needed (for device drivers).
60 */
61 #define NBPG 4096 /* bytes/page */
62 #define PGSHIFT 12 /* LOG2(NBPG) */
63
64 #define DEV_BSHIFT 10 /* log2(DEV_BSIZE) */
65
66 /*
67 * Disk devices do all IO in 1024-byte blocks.
68 */
69 #define DEV_BSIZE 1024
70
71 #define btop(x) ((x)>>PGSHIFT)
72 #define ptob(x) ((x)<<PGSHIFT)
73
74 /* Clicks to disk blocks */
75 #define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT))
76
77 /* Disk blocks to clicks */
78 #define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT))
79
80 /* clicks to bytes */
81 #define ctob(x) ((x)<<PGSHIFT)
82
83 /* bytes to clicks */
84 #define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT)
85
86 #endif /* _PPC_MACHPARAM_H_ */