6 #include <linux/module.h>
17 static int physmem_fd = -1;
29 unsigned long phys_len, phys_pages, highmem_len, highmem_pages;
30 unsigned long iomem_len, iomem_pages,
total_len, total_pages;
34 phys_len = phys_pages *
sizeof(
struct page);
37 iomem_len = iomem_pages *
sizeof(
struct page);
40 highmem_len = highmem_pages *
sizeof(
struct page);
42 total_pages = phys_pages + iomem_pages + highmem_pages;
43 total_len = phys_len + iomem_len + highmem_len;
49 for (i = 0; i < total_pages; i++) {
53 INIT_LIST_HEAD(&p->
lru);
71 "/proc/sys/vm/max_map_count to <physical "
72 "memory size>/4096\n");
73 panic(
"map_memory(0x%lx, %d, 0x%llx, %ld, %d, %d, %d) failed, "
74 "err = %d\n", virt, fd, offset, len, r, w, x, err);
81 unsigned long len,
unsigned long long highmem)
92 len - offset, 1, 1, 1);
94 printf(
"setup_physmem - mapping %ld bytes of memory at 0x%p "
95 "failed - errno = %d\n", len - offset,
109 len - bootmap_size - reserve);
123 while (region !=
NULL) {
124 if ((phys >= region->
phys) &&
125 (phys < region->phys + region->
size)) {
127 *offset_out = phys - region->
phys;
130 region = region->
next;
148 "mem=<Amount of desired ram>\n"
149 " This controls how much \"physical\" memory the kernel allocates\n"
150 " for the system. The size is specified as a number followed by\n"
151 " one of 'k', 'K', 'm', 'M', which have the obvious meanings.\n"
152 " This is not related to the amount of memory in the host. It can\n"
153 " be more, and the excess, if it's ever used, will just be swapped out.\n"
154 " Example: mem=64M\n\n"
160 "iomem=<name>,<file>\n"
161 " Configure <file> as an IO memory region named <name>.\n\n"
178 while (region !=
NULL) {
180 *len_out = region->
size;
184 region = region->
next;
191 static int setup_iomem(
void)
197 while (region !=
NULL) {
199 region->
size, 1, 1, 0);
202 "failed, errno = %d\n", region->
driver, -err);
204 region->
virt = iomem_start;
209 region = region->
next;