]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/ppc/unix_startup.c
05b16e5979f479f3c0d6eb1d7f02365a8a6d2f5e
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 * Copyright (c) 1992,7 NeXT Computer, Inc.
28 * Unix data structure initialization.
31 #include <mach/mach_types.h>
33 #include <vm/vm_kern.h>
34 #include <mach/vm_prot.h>
36 #include <sys/param.h>
38 #include <sys/clist.h>
40 #include <sys/systm.h>
42 #include <dev/ppc/cons.h>
44 extern vm_map_t mb_map
;
47 * Declare these as initialized data so we can patch them.
58 int srv
= 0; /* Flag indicates a server boot when set */
61 vm_map_t bufferhdr_map
;
66 vm_offset_t firstaddr
;
71 nbuf
= atop(mem_size
/ 100); /* 1% */
84 size
= (nbuf
+ niobuf
) * sizeof (struct buf
);
85 size
= round_page(size
);
87 ret
= kmem_suballoc(kernel_map
,
94 if (ret
!= KERN_SUCCESS
)
95 panic("Failed to create bufferhdr_map");
97 ret
= kernel_memory_allocate(bufferhdr_map
,
101 KMA_HERE
| KMA_KOBJECT
);
103 if (ret
!= KERN_SUCCESS
)
104 panic("Failed to allocate bufferhdr_map");
106 buf
= (struct buf
* )firstaddr
;
109 if ((mem_size
> (64 * 1024 * 1024)) || ncl
) {
111 extern u_long tcp_sendspace
;
112 extern u_long tcp_recvspace
;
114 if ((nmbclusters
= ncl
) == 0) {
115 if ((nmbclusters
= ((mem_size
/ 16) / MCLBYTES
)) > 16384)
118 if ((scale
= nmbclusters
/ NMBCLUSTERS
) > 1) {
119 tcp_sendspace
*= scale
;
120 tcp_recvspace
*= scale
;
122 if (tcp_sendspace
> (32 * 1024))
123 tcp_sendspace
= 32 * 1024;
124 if (tcp_recvspace
> (32 * 1024))
125 tcp_recvspace
= 32 * 1024;
135 cons
.t_dev
= makedev(12, 0);
139 ret
= kmem_suballoc(kernel_map
,
141 (vm_size_t
) (nmbclusters
* MCLBYTES
),
146 if (ret
!= KERN_SUCCESS
)
147 panic("Failed to allocate mb_map\n");
150 * Set up buffers, so they can be used to read disk labels.
156 md_prepare_for_shutdown(int paniced
, int howto
, char * command
)
158 extern void IOSystemShutdownNotification();
161 * Temporary hack to notify the power management root domain
162 * that the system will shut down.
164 IOSystemShutdownNotification();