Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
8fba1e5
Documentation
arch
alpha
arm
arm64
avr32
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
microblaze
mips
alchemy
ar7
ath79
bcm47xx
bcm63xx
boot
cavium-octeon
cobalt
configs
dec
emma
fw
include
jazz
jz4740
kernel
lantiq
lasat
lib
loongson
loongson1
math-emu
mm
mti-malta
mti-sead3
Makefile
Platform
leds-sead3.c
sead3-cmdline.c
sead3-console.c
sead3-display.c
sead3-ehci.c
sead3-i2c-dev.c
sead3-i2c-drv.c
sead3-i2c.c
sead3-init.c
sead3-int.c
sead3-lcd.c
sead3-leds.c
sead3-memory.c
sead3-mtd.c
sead3-net.c
sead3-pic32-bus.c
sead3-pic32-i2c-drv.c
sead3-platform.c
sead3-reset.c
sead3-serial.c
sead3-setup.c
sead3-time.c
netlogic
oprofile
pci
pmc-sierra
pnx833x
pnx8550
power
powertv
rb532
sgi-ip22
sgi-ip27
sgi-ip32
sibyte
sni
txx9
vr41xx
wrppmc
Kbuild
Kbuild.platforms
Kconfig
Kconfig.debug
Makefile
mn10300
openrisc
parisc
powerpc
s390
score
sh
sparc
tile
um
unicore32
x86
xtensa
.gitignore
Kconfig
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
arch
/
mips
/
mti-sead3
/
sead3-memory.c
Copy path
Blame
Blame
Latest commit
History
History
138 lines (113 loc) · 3.14 KB
Breadcrumbs
linux
/
arch
/
mips
/
mti-sead3
/
sead3-memory.c
Top
File metadata and controls
Code
Blame
138 lines (113 loc) · 3.14 KB
Raw
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. */ #include <linux/bootmem.h> #include <asm/bootinfo.h> #include <asm/sections.h> #include <asm/mips-boards/prom.h> enum yamon_memtypes { yamon_dontuse, yamon_prom, yamon_free, }; static struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS]; /* determined physical memory size, not overridden by command line args */ unsigned long physical_memsize = 0L; struct prom_pmemblock * __init prom_getmdesc(void) { char *memsize_str, *ptr; unsigned int memsize; static char cmdline[COMMAND_LINE_SIZE] __initdata; long val; int tmp; /* otherwise look in the environment */ memsize_str = prom_getenv("memsize"); if (!memsize_str) { pr_warn("memsize not set in boot prom, set to default 32Mb\n"); physical_memsize = 0x02000000; } else { tmp = kstrtol(memsize_str, 0, &val); physical_memsize = (unsigned long)val; } #ifdef CONFIG_CPU_BIG_ENDIAN /* SOC-it swaps, or perhaps doesn't swap, when DMA'ing the last word of physical memory */ physical_memsize -= PAGE_SIZE; #endif /* Check the command line for a memsize directive that overrides the physical/default amount */ strcpy(cmdline, arcs_cmdline); ptr = strstr(cmdline, "memsize="); if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' ')) ptr = strstr(ptr, " memsize="); if (ptr) memsize = memparse(ptr + 8, &ptr); else memsize = physical_memsize; memset(mdesc, 0, sizeof(mdesc)); mdesc[0].type = yamon_dontuse; mdesc[0].base = 0x00000000; mdesc[0].size = 0x00001000; mdesc[1].type = yamon_prom; mdesc[1].base = 0x00001000; mdesc[1].size = 0x000ef000; /* * The area 0x000f0000-0x000fffff is allocated for BIOS memory by the * south bridge and PCI access always forwarded to the ISA Bus and * BIOSCS# is always generated. * This mean that this area can't be used as DMA memory for PCI * devices. */ mdesc[2].type = yamon_dontuse; mdesc[2].base = 0x000f0000; mdesc[2].size = 0x00010000; mdesc[3].type = yamon_dontuse; mdesc[3].base = 0x00100000; mdesc[3].size = CPHYSADDR(PFN_ALIGN((unsigned long)&_end)) - mdesc[3].base; mdesc[4].type = yamon_free; mdesc[4].base = CPHYSADDR(PFN_ALIGN(&_end)); mdesc[4].size = memsize - mdesc[4].base; return &mdesc[0]; } static int __init prom_memtype_classify(unsigned int type) { switch (type) { case yamon_free: return BOOT_MEM_RAM; case yamon_prom: return BOOT_MEM_ROM_DATA; default: return BOOT_MEM_RESERVED; } } void __init prom_meminit(void) { struct prom_pmemblock *p; p = prom_getmdesc(); while (p->size) { long type; unsigned long base, size; type = prom_memtype_classify(p->type); base = p->base; size = p->size; add_memory_region(base, size, type); p++; } } void __init prom_free_prom_memory(void) { unsigned long addr; int i; for (i = 0; i < boot_mem_map.nr_map; i++) { if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA) continue; addr = boot_mem_map.map[i].addr; free_init_pages("prom memory", addr, addr + boot_mem_map.map[i].size); } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
You can’t perform that action at this time.