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
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.
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]
23 * Copyright (c) 1991-1994, by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <sys/promif.h>
30 #include <sys/promimpl.h>
33 * Mapping routines suitable for implementations using 2-cell physical
34 * address formats. Use of these routines makes the caller
35 * platform-dependent. The implementation of these routines is
36 * a bit sun-hardware centric, for historical use by SunOS and standalones.
40 prom_map(caddr_t virthint
, unsigned long long physaddr
, u_int size
)
45 * If no virthint, allocate it; otherwise claim it,
46 * the physical address is assumed to be a device or
47 * already claimed, or not appearing in a resource list.
49 if (virthint
== (caddr_t
)0) {
50 if ((virt
= prom_allocate_virt((u_int
)1, size
)) == 0)
54 if (prom_claim_virt(size
, virt
) != virt
)
58 if (prom_map_phys(-1, size
, virt
, physaddr
) != 0) {
60 * The map operation failed, free the virtual
61 * addresses we allocated or claimed.
63 (void) prom_free_virt(size
, virt
);
70 prom_unmap(caddr_t virt
, u_int size
)
72 (void) prom_unmap_virt(size
, virt
);
73 prom_free_virt(size
, virt
);