]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
91447636 | 2 | * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved. |
1c79356b A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
37839358 A |
5 | * |
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. | |
11 | * | |
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 | |
1c79356b A |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
37839358 A |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
1c79356b A |
20 | * @APPLE_LICENSE_HEADER_END@ |
21 | */ | |
1c79356b | 22 | |
91447636 | 23 | #include <mach/vm_param.h> |
c0fea474 A |
24 | #include <chud/chud_xnu.h> |
25 | #include <machine/machine_routines.h> | |
26 | ||
27 | extern unsigned int IODefaultCacheBits(addr64_t pa); | |
28 | extern unsigned int vm_page_free_count; | |
1c79356b | 29 | |
55e303ae A |
30 | __private_extern__ |
31 | uint64_t chudxnu_avail_memory_size(void) | |
32 | { | |
c0fea474 | 33 | return max_mem; |
55e303ae | 34 | } |
1c79356b | 35 | |
55e303ae A |
36 | __private_extern__ |
37 | uint64_t chudxnu_phys_memory_size(void) | |
1c79356b | 38 | { |
55e303ae | 39 | return mem_actual; |
1c79356b A |
40 | } |
41 | ||
c0fea474 A |
42 | /* |
43 | * This function is not intended to be valid for any amount of time, | |
44 | * it is just an instantaneous snapshot of the current free memory size. | |
45 | */ | |
46 | __private_extern__ | |
47 | uint64_t chudxnu_free_memory_size(void) | |
48 | { | |
49 | return (uint64_t)vm_page_free_count * (uint64_t)page_size; | |
50 | } | |
51 | ||
55e303ae A |
52 | __private_extern__ |
53 | vm_offset_t chudxnu_io_map(uint64_t phys_addr, vm_size_t size) | |
54 | { | |
55 | return ml_io_map(phys_addr, size); // XXXXX limited to first 2GB XXXXX | |
56 | } | |
57 | ||
58 | __private_extern__ | |
59 | uint32_t chudxnu_phys_addr_wimg(uint64_t phys_addr) | |
60 | { | |
61 | return IODefaultCacheBits(phys_addr); | |
62 | } |