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