]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/i386/unix_startup.c
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.
32 #include <mach/mach_types.h>
34 #include <vm/vm_kern.h>
35 #include <mach/vm_prot.h>
37 #include <sys/param.h>
39 #include <sys/clist.h>
41 #include <sys/systm.h>
43 #include <dev/ppc/cons.h>
45 extern vm_map_t mb_map
;
48 * Declare these as initialized data so we can patch them.
59 int srv
= 0; /* Flag indicates a server boot when set */
63 vm_map_t bufferhdr_map
;
68 vm_offset_t firstaddr
;
73 nbuf
= atop(mem_size
/ 100); /* 1% */
80 niobuf
= (nbuf
/ 2) + 64; /* 64 reserved buffers */
86 size
= (nbuf
+ niobuf
) * sizeof (struct buf
);
87 size
= round_page(size
);
89 ret
= kmem_suballoc(kernel_map
,
96 if (ret
!= KERN_SUCCESS
)
97 panic("Failed to create bufferhdr_map");
99 ret
= kernel_memory_allocate(bufferhdr_map
,
103 KMA_HERE
| KMA_KOBJECT
);
105 if (ret
!= KERN_SUCCESS
)
106 panic("Failed to allocate bufferhdr_map");
108 buf
= (struct buf
* )firstaddr
;
111 if (mem_size
> (64 * 1024 * 1024)) {
113 extern u_long tcp_sendspace
;
114 extern u_long tcp_recvspace
;
116 if ((nmbclusters
= ncl
) == 0) {
117 if ((nmbclusters
= ((mem_size
/ 16) / MCLBYTES
)) > 16384)
120 if ((scale
= nmbclusters
/ NMBCLUSTERS
) > 1) {
121 tcp_sendspace
*= scale
;
122 tcp_recvspace
*= scale
;
124 if (tcp_sendspace
> (32 * 1024))
125 tcp_sendspace
= 32 * 1024;
126 if (tcp_recvspace
> (32 * 1024))
127 tcp_recvspace
= 32 * 1024;
138 vm_offset_t firstaddr
;
140 cons
.t_dev
= makedev(12, 0);
144 ret
= kmem_suballoc(kernel_map
,
145 (vm_offset_t
*)&mbutl
,
146 (vm_size_t
) (nmbclusters
* MCLBYTES
),
151 if (ret
!= KERN_SUCCESS
)
152 panic("Failed to allocate mb_map\n");
155 * Set up buffers, so they can be used to read disk labels.
161 md_prepare_for_shutdown(int paniced
, int howto
, char * command
)