sun4x_standalloc.c (fa9e4066) sun4x_standalloc.c (986fd29a)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#pragma ident "%Z%%M% %I% %E% SMI"
28
29#include <sys/types.h>
30#include <sys/saio.h>
31#include <sys/sysmacros.h>

--- 67 unchanged lines hidden (view full) ---

99#define MAPPEDMEM_RESERVE (512*1024) /* reserved for NOFAIL allocs */
100
101#define MAPPEDMEM_MINTOP (caddr_t)(6*1024*1024)
102#define MAPPEDMEM_FULLTOP (caddr_t)(10*1024*1024)
103
104static caddr_t top_bootmem = MAPPEDMEM_MINTOP;
105static caddr_t top_resvmem, scratchresvp;
106
23 * Use is subject to license terms.
24 */
25
26#pragma ident "%Z%%M% %I% %E% SMI"
27
28#include <sys/types.h>
29#include <sys/saio.h>
30#include <sys/sysmacros.h>

--- 67 unchanged lines hidden (view full) ---

98#define MAPPEDMEM_RESERVE (512*1024) /* reserved for NOFAIL allocs */
99
100#define MAPPEDMEM_MINTOP (caddr_t)(6*1024*1024)
101#define MAPPEDMEM_FULLTOP (caddr_t)(10*1024*1024)
102
103static caddr_t top_bootmem = MAPPEDMEM_MINTOP;
104static caddr_t top_resvmem, scratchresvp;
105
106/*
107 * with newboot, boot goes away when it launches the client,
108 * so we can safely extend bootmem on sg, and give it back
109 * before we die.
110 */
111int is_sg;
112caddr_t sg_addr;
113size_t sg_len;
114
107static int
108impl_name(char *buf, size_t bufsz)
109{
110 pnode_t n = prom_rootnode();
111 size_t len = prom_getproplen(n, "name");
112
113 if (len == 0 || len >= bufsz)
114 return (-1);

--- 92 unchanged lines hidden (view full) ---

207
208 dprintf("boot: resalloc_init: got iarch %s\n", iarch);
209
210 /*
211 * Some versions of SG/LW8 firmware can actually handle the entire 10MB,
212 * but we don't have the ability to check for the firmware version here.
213 */
214 if (strcmp(iarch, "SUNW,Sun-Fire") == 0 ||
115static int
116impl_name(char *buf, size_t bufsz)
117{
118 pnode_t n = prom_rootnode();
119 size_t len = prom_getproplen(n, "name");
120
121 if (len == 0 || len >= bufsz)
122 return (-1);

--- 92 unchanged lines hidden (view full) ---

215
216 dprintf("boot: resalloc_init: got iarch %s\n", iarch);
217
218 /*
219 * Some versions of SG/LW8 firmware can actually handle the entire 10MB,
220 * but we don't have the ability to check for the firmware version here.
221 */
222 if (strcmp(iarch, "SUNW,Sun-Fire") == 0 ||
215 strcmp(iarch, "SUNW,Netra-T12") == 0)
216 return;
223 strcmp(iarch, "SUNW,Netra-T12") == 0) {
224 is_sg = 1;
225 sg_addr = MAPPEDMEM_MINTOP;
226 sg_len = MAPPEDMEM_FULLTOP - MAPPEDMEM_MINTOP;
227 if (prom_alloc(sg_addr, sg_len, 1) != sg_addr)
228 prom_panic("can't extend sg bootmem");
229 }
217
218 top_bootmem = MAPPEDMEM_FULLTOP;
219
220 dprintf("boot: resalloc_init: boosted top_bootmem to %p\n",
221 (void *)top_bootmem);
222}
223
224caddr_t

--- 34 unchanged lines hidden (view full) ---

259 /*NOTREACHED*/
260
261 case RES_CHILDVIRT:
262 vaddr = (caddr_t)prom_alloc(virthint, bytes, align);
263
264 if (vaddr == (caddr_t)virthint)
265 return (vaddr);
266 printf("Alloc of 0x%lx bytes at 0x%p refused.\n",
230
231 top_bootmem = MAPPEDMEM_FULLTOP;
232
233 dprintf("boot: resalloc_init: boosted top_bootmem to %p\n",
234 (void *)top_bootmem);
235}
236
237caddr_t

--- 34 unchanged lines hidden (view full) ---

272 /*NOTREACHED*/
273
274 case RES_CHILDVIRT:
275 vaddr = (caddr_t)prom_alloc(virthint, bytes, align);
276
277 if (vaddr == (caddr_t)virthint)
278 return (vaddr);
279 printf("Alloc of 0x%lx bytes at 0x%p refused.\n",
267 bytes, (void *)virthint);
280 bytes, (void *)virthint);
268 return ((caddr_t)0);
269 /*NOTREACHED*/
270
271 default:
272 printf("Bad resurce type\n");
273 return ((caddr_t)0);
274 }
275}

--- 64 unchanged lines hidden ---
281 return ((caddr_t)0);
282 /*NOTREACHED*/
283
284 default:
285 printf("Bad resurce type\n");
286 return ((caddr_t)0);
287 }
288}

--- 64 unchanged lines hidden ---