.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* -*- linux-c -*- ------------------------------------------------------- * |
---|
2 | 3 | * |
---|
3 | 4 | * Copyright (C) 1991, 1992 Linus Torvalds |
---|
4 | 5 | * Copyright 2007 rPath, Inc. - All Rights Reserved |
---|
5 | 6 | * 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. |
---|
9 | 7 | * |
---|
10 | 8 | * ----------------------------------------------------------------------- */ |
---|
11 | 9 | |
---|
.. | .. |
---|
17 | 15 | |
---|
18 | 16 | #define SMAP 0x534d4150 /* ASCII "SMAP" */ |
---|
19 | 17 | |
---|
20 | | -static int detect_memory_e820(void) |
---|
| 18 | +static void detect_memory_e820(void) |
---|
21 | 19 | { |
---|
22 | 20 | int count = 0; |
---|
23 | 21 | struct biosregs ireg, oreg; |
---|
.. | .. |
---|
26 | 24 | |
---|
27 | 25 | initregs(&ireg); |
---|
28 | 26 | ireg.ax = 0xe820; |
---|
29 | | - ireg.cx = sizeof buf; |
---|
| 27 | + ireg.cx = sizeof(buf); |
---|
30 | 28 | ireg.edx = SMAP; |
---|
31 | 29 | ireg.di = (size_t)&buf; |
---|
32 | 30 | |
---|
.. | .. |
---|
68 | 66 | count++; |
---|
69 | 67 | } while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_table)); |
---|
70 | 68 | |
---|
71 | | - return boot_params.e820_entries = count; |
---|
| 69 | + boot_params.e820_entries = count; |
---|
72 | 70 | } |
---|
73 | 71 | |
---|
74 | | -static int detect_memory_e801(void) |
---|
| 72 | +static void detect_memory_e801(void) |
---|
75 | 73 | { |
---|
76 | 74 | struct biosregs ireg, oreg; |
---|
77 | 75 | |
---|
.. | .. |
---|
80 | 78 | intcall(0x15, &ireg, &oreg); |
---|
81 | 79 | |
---|
82 | 80 | if (oreg.eflags & X86_EFLAGS_CF) |
---|
83 | | - return -1; |
---|
| 81 | + return; |
---|
84 | 82 | |
---|
85 | 83 | /* Do we really need to do this? */ |
---|
86 | 84 | if (oreg.cx || oreg.dx) { |
---|
.. | .. |
---|
89 | 87 | } |
---|
90 | 88 | |
---|
91 | 89 | if (oreg.ax > 15*1024) { |
---|
92 | | - return -1; /* Bogus! */ |
---|
| 90 | + return; /* Bogus! */ |
---|
93 | 91 | } else if (oreg.ax == 15*1024) { |
---|
94 | 92 | boot_params.alt_mem_k = (oreg.bx << 6) + oreg.ax; |
---|
95 | 93 | } else { |
---|
.. | .. |
---|
102 | 100 | */ |
---|
103 | 101 | boot_params.alt_mem_k = oreg.ax; |
---|
104 | 102 | } |
---|
105 | | - |
---|
106 | | - return 0; |
---|
107 | 103 | } |
---|
108 | 104 | |
---|
109 | | -static int detect_memory_88(void) |
---|
| 105 | +static void detect_memory_88(void) |
---|
110 | 106 | { |
---|
111 | 107 | struct biosregs ireg, oreg; |
---|
112 | 108 | |
---|
.. | .. |
---|
115 | 111 | intcall(0x15, &ireg, &oreg); |
---|
116 | 112 | |
---|
117 | 113 | boot_params.screen_info.ext_mem_k = oreg.ax; |
---|
118 | | - |
---|
119 | | - return -(oreg.eflags & X86_EFLAGS_CF); /* 0 or -1 */ |
---|
120 | 114 | } |
---|
121 | 115 | |
---|
122 | | -int detect_memory(void) |
---|
| 116 | +void detect_memory(void) |
---|
123 | 117 | { |
---|
124 | | - int err = -1; |
---|
| 118 | + detect_memory_e820(); |
---|
125 | 119 | |
---|
126 | | - if (detect_memory_e820() > 0) |
---|
127 | | - err = 0; |
---|
| 120 | + detect_memory_e801(); |
---|
128 | 121 | |
---|
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(); |
---|
136 | 123 | } |
---|