]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/ppc/unix_startup.c
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1992,7 NeXT Computer, Inc.
25 * Unix data structure initialization.
28 #include <mach/mach_types.h>
30 #include <vm/vm_kern.h>
31 #include <mach/vm_prot.h>
33 #include <sys/param.h>
35 #include <sys/clist.h>
37 #include <sys/systm.h>
39 #include <dev/ppc/cons.h>
41 extern vm_map_t mb_map
;
44 * Declare these as initialized data so we can patch them.
55 int srv
= 0; /* Flag indicates a server boot when set */
58 vm_map_t bufferhdr_map
;
63 vm_offset_t firstaddr
;
68 nbuf
= atop(mem_size
/ 100); /* 1% */
81 size
= (nbuf
+ niobuf
) * sizeof (struct buf
);
82 size
= round_page(size
);
84 ret
= kmem_suballoc(kernel_map
,
91 if (ret
!= KERN_SUCCESS
)
92 panic("Failed to create bufferhdr_map");
94 ret
= kernel_memory_allocate(bufferhdr_map
,
98 KMA_HERE
| KMA_KOBJECT
);
100 if (ret
!= KERN_SUCCESS
)
101 panic("Failed to allocate bufferhdr_map");
103 buf
= (struct buf
* )firstaddr
;
106 if ((mem_size
> (64 * 1024 * 1024)) || ncl
) {
108 extern u_long tcp_sendspace
;
109 extern u_long tcp_recvspace
;
111 if ((nmbclusters
= ncl
) == 0) {
112 if ((nmbclusters
= ((mem_size
/ 16) / MCLBYTES
)) > 8192)
115 if ((scale
= nmbclusters
/ NMBCLUSTERS
) > 1) {
116 tcp_sendspace
*= scale
;
117 tcp_recvspace
*= scale
;
119 if (tcp_sendspace
> (32 * 1024))
120 tcp_sendspace
= 32 * 1024;
121 if (tcp_recvspace
> (32 * 1024))
122 tcp_recvspace
= 32 * 1024;
132 cons
.t_dev
= makedev(12, 0);
136 ret
= kmem_suballoc(kernel_map
,
138 (vm_size_t
) (nmbclusters
* MCLBYTES
),
143 if (ret
!= KERN_SUCCESS
)
144 panic("Failed to allocate mb_map\n");
147 * Set up buffers, so they can be used to read disk labels.
153 md_prepare_for_shutdown(int paniced
, int howto
, char * command
)
155 extern void IOSystemShutdownNotification();
158 * Temporary hack to notify the power management root domain
159 * that the system will shut down.
161 IOSystemShutdownNotification();