hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/x86/boot/memory.c
....@@ -1,11 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* -*- linux-c -*- ------------------------------------------------------- *
23 *
34 * Copyright (C) 1991, 1992 Linus Torvalds
45 * Copyright 2007 rPath, Inc. - All Rights Reserved
56 * Copyright 2009 Intel Corporation; author H. Peter Anvin
6
- *
7
- * This file is part of the Linux kernel, and is made available under
8
- * the terms of the GNU General Public License version 2.
97 *
108 * ----------------------------------------------------------------------- */
119
....@@ -17,7 +15,7 @@
1715
1816 #define SMAP 0x534d4150 /* ASCII "SMAP" */
1917
20
-static int detect_memory_e820(void)
18
+static void detect_memory_e820(void)
2119 {
2220 int count = 0;
2321 struct biosregs ireg, oreg;
....@@ -26,7 +24,7 @@
2624
2725 initregs(&ireg);
2826 ireg.ax = 0xe820;
29
- ireg.cx = sizeof buf;
27
+ ireg.cx = sizeof(buf);
3028 ireg.edx = SMAP;
3129 ireg.di = (size_t)&buf;
3230
....@@ -68,10 +66,10 @@
6866 count++;
6967 } while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_table));
7068
71
- return boot_params.e820_entries = count;
69
+ boot_params.e820_entries = count;
7270 }
7371
74
-static int detect_memory_e801(void)
72
+static void detect_memory_e801(void)
7573 {
7674 struct biosregs ireg, oreg;
7775
....@@ -80,7 +78,7 @@
8078 intcall(0x15, &ireg, &oreg);
8179
8280 if (oreg.eflags & X86_EFLAGS_CF)
83
- return -1;
81
+ return;
8482
8583 /* Do we really need to do this? */
8684 if (oreg.cx || oreg.dx) {
....@@ -89,7 +87,7 @@
8987 }
9088
9189 if (oreg.ax > 15*1024) {
92
- return -1; /* Bogus! */
90
+ return; /* Bogus! */
9391 } else if (oreg.ax == 15*1024) {
9492 boot_params.alt_mem_k = (oreg.bx << 6) + oreg.ax;
9593 } else {
....@@ -102,11 +100,9 @@
102100 */
103101 boot_params.alt_mem_k = oreg.ax;
104102 }
105
-
106
- return 0;
107103 }
108104
109
-static int detect_memory_88(void)
105
+static void detect_memory_88(void)
110106 {
111107 struct biosregs ireg, oreg;
112108
....@@ -115,22 +111,13 @@
115111 intcall(0x15, &ireg, &oreg);
116112
117113 boot_params.screen_info.ext_mem_k = oreg.ax;
118
-
119
- return -(oreg.eflags & X86_EFLAGS_CF); /* 0 or -1 */
120114 }
121115
122
-int detect_memory(void)
116
+void detect_memory(void)
123117 {
124
- int err = -1;
118
+ detect_memory_e820();
125119
126
- if (detect_memory_e820() > 0)
127
- err = 0;
120
+ detect_memory_e801();
128121
129
- if (!detect_memory_e801())
130
- err = 0;
131
-
132
- if (!detect_memory_88())
133
- err = 0;
134
-
135
- return err;
122
+ detect_memory_88();
136123 }