Skip to content

Commit e7b7fb6

Browse files
committed
FreeBSD: Upgrade to FreeBSD-releng-13.0 compiled, to be tested.
1 parent 4e3599d commit e7b7fb6

File tree

18,621 files changed

+3755278
-540558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

18,621 files changed

+3755278
-540558
lines changed

freebsd/Makefile

+6-22
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# $FreeBSD$
22

33
# Directories to include in cscope name file and TAGS.
4-
CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \
4+
CSCOPEDIRS= bsm cam cddl compat conf contrib crypto ddb dev fs gdb \
55
geom gnu isa kern libkern modules net net80211 \
6-
netgraph netinet netinet6 netipsec netnatm netpfil \
6+
netgraph netinet netinet6 netipsec netpfil \
77
netsmb nfs nfsclient nfsserver nlm ofed opencrypto \
88
rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR}
99
.if !defined(CSCOPE_ARCHDIR)
1010
.if defined(ALL_ARCH)
11-
CSCOPE_ARCHDIR = amd64 arm arm64 i386 mips pc98 powerpc riscv sparc64 x86
11+
CSCOPE_ARCHDIR = amd64 arm arm64 i386 mips powerpc riscv x86
1212
.else
1313
CSCOPE_ARCHDIR = ${MACHINE}
1414
.if ${MACHINE} != ${MACHINE_CPUARCH}
@@ -32,7 +32,8 @@ ${.CURDIR}/cscope.files: .PHONY
3232
find ${CSCOPEDIRS} -name "*.[chSsly]" -a -type f > ${.TARGET}
3333

3434
cscope-clean:
35-
rm -f cscope.files cscope.out cscope.in.out cscope.po.out
35+
cd ${.CURDIR}; \
36+
rm -f cscope.files cscope.out cscope.in.out cscope.po.out
3637

3738
#
3839
# Installs SCM hooks to update the cscope database every time the source tree
@@ -58,26 +59,9 @@ TAGS ${.CURDIR}/TAGS: ${.CURDIR}/cscope.files
5859
rm -f ${.CURDIR}/TAGS
5960
cd ${.CURDIR}; xargs etags -a < ${.CURDIR}/cscope.files
6061

61-
# You need the textproc/glimpse ports for this.
62-
glimpse:
63-
.if !exists(${.CURDIR}/.glimpse_exclude)
64-
echo .svn > ${.CURDIR}/.glimpse_exclude
65-
echo /compile/ >> ${.CURDIR}/.glimpse_exclude
66-
.endif
67-
cd ${.CURDIR}; glimpseindex -H . -B -f -o .
68-
69-
glimpse-clean:
70-
cd ${.CURDIR}; rm -f .glimpse_*
71-
72-
.if !(make(cscope) || make(cscope-clean) || make(cscope-hook) || make(TAGS) || \
73-
make(glimpse) || make(glimpse-clean))
62+
.if !(make(cscope) || make(cscope-clean) || make(cscope-hook) || make(TAGS))
7463
.include <src.opts.mk>
7564

76-
# The boot loader
77-
.if ${MK_BOOT} != "no"
78-
SUBDIR= boot
79-
.endif
80-
8165
# Loadable kernel modules
8266

8367
.if defined(MODULES_WITH_WORLD)

freebsd/amd64/acpica/acpi_machdep.c

+26-112
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/*-
2+
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3+
*
24
* Copyright (c) 2001 Mitsuru IWASAKI
35
* All rights reserved.
46
*
@@ -61,6 +63,7 @@ acpi_machdep_init(device_t dev)
6163
sc = device_get_softc(dev);
6264

6365
acpi_apm_init(sc);
66+
acpi_install_wakeup_handler(sc);
6467

6568
if (intr_model != ACPI_INTR_PIC)
6669
acpi_SetIntrModel(intr_model);
@@ -88,91 +91,29 @@ acpi_machdep_quirks(int *quirks)
8891
}
8992

9093
/*
91-
* Support for mapping ACPI tables during early boot. Currently this
92-
* uses the crashdump map to map each table. However, the crashdump
93-
* map is created in pmap_bootstrap() right after the direct map, so
94-
* we should be able to just use pmap_mapbios() here instead.
95-
*
96-
* This makes the following assumptions about how we use this KVA:
97-
* pages 0 and 1 are used to map in the header of each table found via
98-
* the RSDT or XSDT and pages 2 to n are used to map in the RSDT or
99-
* XSDT. This has to use 2 pages for the table headers in case a
100-
* header spans a page boundary.
101-
*
102-
* XXX: We don't ensure the table fits in the available address space
103-
* in the crashdump map.
104-
*/
105-
106-
/*
107-
* Map some memory using the crashdump map. 'offset' is an offset in
108-
* pages into the crashdump map to use for the start of the mapping.
109-
*/
110-
static void *
111-
table_map(vm_paddr_t pa, int offset, vm_offset_t length)
112-
{
113-
vm_offset_t va, off;
114-
void *data;
115-
116-
off = pa & PAGE_MASK;
117-
length = round_page(length + off);
118-
pa = pa & PG_FRAME;
119-
va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
120-
(offset * PAGE_SIZE);
121-
data = (void *)(va + off);
122-
length -= PAGE_SIZE;
123-
while (length > 0) {
124-
va += PAGE_SIZE;
125-
pa += PAGE_SIZE;
126-
length -= PAGE_SIZE;
127-
pmap_kenter(va, pa);
128-
invlpg(va);
129-
}
130-
return (data);
131-
}
132-
133-
/* Unmap memory previously mapped with table_map(). */
134-
static void
135-
table_unmap(void *data, vm_offset_t length)
136-
{
137-
vm_offset_t va, off;
138-
139-
va = (vm_offset_t)data;
140-
off = va & PAGE_MASK;
141-
length = round_page(length + off);
142-
va &= ~PAGE_MASK;
143-
while (length > 0) {
144-
pmap_kremove(va);
145-
invlpg(va);
146-
va += PAGE_SIZE;
147-
length -= PAGE_SIZE;
148-
}
149-
}
150-
151-
/*
152-
* Map a table at a given offset into the crashdump map. It first
153-
* maps the header to determine the table length and then maps the
154-
* entire table.
94+
* Map a table. First map the header to determine the table length and then map
95+
* the entire table.
15596
*/
15697
static void *
157-
map_table(vm_paddr_t pa, int offset, const char *sig)
98+
map_table(vm_paddr_t pa, const char *sig)
15899
{
159100
ACPI_TABLE_HEADER *header;
160101
vm_offset_t length;
161102
void *table;
162103

163-
header = table_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
164-
if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
165-
table_unmap(header, sizeof(ACPI_TABLE_HEADER));
104+
header = pmap_mapbios(pa, sizeof(ACPI_TABLE_HEADER));
105+
if (strncmp(header->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
106+
pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER));
166107
return (NULL);
167108
}
168109
length = header->Length;
169-
table_unmap(header, sizeof(ACPI_TABLE_HEADER));
170-
table = table_map(pa, offset, length);
110+
pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER));
111+
table = pmap_mapbios(pa, length);
171112
if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
172113
if (bootverbose)
173114
printf("ACPI: Failed checksum for table %s\n", sig);
174115
#if (ACPI_CHECKSUM_ABORT)
175-
table_unmap(table, length);
116+
pmap_unmapbios((vm_offset_t)table, length);
176117
return (NULL);
177118
#endif
178119
}
@@ -187,24 +128,12 @@ static int
187128
probe_table(vm_paddr_t address, const char *sig)
188129
{
189130
ACPI_TABLE_HEADER *table;
131+
int ret;
190132

191-
table = table_map(address, 0, sizeof(ACPI_TABLE_HEADER));
192-
if (table == NULL) {
193-
if (bootverbose)
194-
printf("ACPI: Failed to map table at 0x%jx\n",
195-
(uintmax_t)address);
196-
return (0);
197-
}
198-
if (bootverbose)
199-
printf("Table '%.4s' at 0x%jx\n", table->Signature,
200-
(uintmax_t)address);
201-
202-
if (strncmp(table->Signature, sig, ACPI_NAME_SIZE) != 0) {
203-
table_unmap(table, sizeof(ACPI_TABLE_HEADER));
204-
return (0);
205-
}
206-
table_unmap(table, sizeof(ACPI_TABLE_HEADER));
207-
return (1);
133+
table = pmap_mapbios(address, sizeof(ACPI_TABLE_HEADER));
134+
ret = strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) == 0;
135+
pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER));
136+
return (ret);
208137
}
209138

210139
/*
@@ -215,7 +144,7 @@ void *
215144
acpi_map_table(vm_paddr_t pa, const char *sig)
216145
{
217146

218-
return (map_table(pa, 0, sig));
147+
return (map_table(pa, sig));
219148
}
220149

221150
/* Unmap a table previously mapped via acpi_map_table(). */
@@ -225,7 +154,7 @@ acpi_unmap_table(void *table)
225154
ACPI_TABLE_HEADER *header;
226155

227156
header = (ACPI_TABLE_HEADER *)table;
228-
table_unmap(table, header->Length);
157+
pmap_unmapbios((vm_offset_t)table, header->Length);
229158
}
230159

231160
/*
@@ -262,9 +191,7 @@ acpi_find_table(const char *sig)
262191

263192
/*
264193
* For ACPI >= 2.0, use the XSDT if it is available.
265-
* Otherwise, use the RSDT. We map the XSDT or RSDT at page 2
266-
* in the crashdump area. Pages 0 and 1 are used to map in the
267-
* headers of candidate ACPI tables.
194+
* Otherwise, use the RSDT.
268195
*/
269196
addr = 0;
270197
if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
@@ -278,7 +205,7 @@ acpi_find_table(const char *sig)
278205
printf("ACPI: RSDP failed extended checksum\n");
279206
return (0);
280207
}
281-
xsdt = map_table(rsdp->XsdtPhysicalAddress, 2, ACPI_SIG_XSDT);
208+
xsdt = map_table(rsdp->XsdtPhysicalAddress, ACPI_SIG_XSDT);
282209
if (xsdt == NULL) {
283210
if (bootverbose)
284211
printf("ACPI: Failed to map XSDT\n");
@@ -293,7 +220,7 @@ acpi_find_table(const char *sig)
293220
}
294221
acpi_unmap_table(xsdt);
295222
} else {
296-
rsdt = map_table(rsdp->RsdtPhysicalAddress, 2, ACPI_SIG_RSDT);
223+
rsdt = map_table(rsdp->RsdtPhysicalAddress, ACPI_SIG_RSDT);
297224
if (rsdt == NULL) {
298225
if (bootverbose)
299226
printf("ACPI: Failed to map RSDT\n");
@@ -309,19 +236,14 @@ acpi_find_table(const char *sig)
309236
acpi_unmap_table(rsdt);
310237
}
311238
pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
312-
if (addr == 0) {
313-
if (bootverbose)
314-
printf("ACPI: No %s table found\n", sig);
239+
if (addr == 0)
315240
return (0);
316-
}
317-
if (bootverbose)
318-
printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr);
319241

320242
/*
321243
* Verify that we can map the full table and that its checksum is
322244
* correct, etc.
323245
*/
324-
table = map_table(addr, 0, sig);
246+
table = map_table(addr, sig);
325247
if (table == NULL)
326248
return (0);
327249
acpi_unmap_table(table);
@@ -347,27 +269,19 @@ nexus_acpi_probe(device_t dev)
347269
static int
348270
nexus_acpi_attach(device_t dev)
349271
{
350-
device_t acpi_dev;
351-
int error;
352272

353273
nexus_init_resources();
354274
bus_generic_probe(dev);
355-
acpi_dev = BUS_ADD_CHILD(dev, 10, "acpi", 0);
356-
if (acpi_dev == NULL)
275+
if (BUS_ADD_CHILD(dev, 10, "acpi", 0) == NULL)
357276
panic("failed to add acpi0 device");
358277

359-
error = bus_generic_attach(dev);
360-
if (error == 0)
361-
acpi_install_wakeup_handler(device_get_softc(acpi_dev));
362-
363-
return (error);
278+
return (bus_generic_attach(dev));
364279
}
365280

366281
static device_method_t nexus_acpi_methods[] = {
367282
/* Device interface */
368283
DEVMETHOD(device_probe, nexus_acpi_probe),
369284
DEVMETHOD(device_attach, nexus_acpi_attach),
370-
371285
{ 0, 0 }
372286
};
373287

freebsd/amd64/acpica/acpi_wakecode.S

+18-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include <machine/specialreg.h>
3535
#include <machine/timerreg.h>
3636

37-
#include "assym.s"
37+
#include "assym.inc"
3838

3939
/*
4040
* Resume entry point for real mode.
@@ -148,19 +148,28 @@ wakeup_32:
148148
mov $bootdata32 - bootgdt, %eax
149149
mov %ax, %ds
150150

151-
/* Turn on the PAE bit for when paging is enabled */
151+
/*
152+
* Turn on the PAE bit and optionally the LA57 bit for when paging
153+
* is later enabled.
154+
*/
152155
mov %cr4, %eax
153156
orl $CR4_PAE, %eax
154-
mov %eax, %cr4
157+
leal wakeup_pagetables - wakeup_start(%ebx), %ecx
158+
movl (%ecx), %ecx
159+
testl $0x1, %ecx
160+
je 1f
161+
orl $CR4_LA57, %eax
162+
1: mov %eax, %cr4
155163

156164
/*
157165
* Enable EFER.LME so that we get long mode when all the prereqs are
158166
* in place. In this case, it turns on when CR0_PG is finally enabled.
159-
* Pick up a few other EFER bits that we'll use need we're here.
167+
* Also it picks up a few other EFER bits that we'll use need we're
168+
* here, like SYSCALL and NX enable.
160169
*/
161170
movl $MSR_EFER, %ecx
162-
rdmsr
163-
orl $EFER_LME | EFER_SCE, %eax
171+
movl wakeup_efer - wakeup_start(%ebx), %eax
172+
movl wakeup_efer + 4 - wakeup_start(%ebx), %edx
164173
wrmsr
165174

166175
/*
@@ -173,6 +182,7 @@ wakeup_32:
173182
*/
174183
leal wakeup_pagetables - wakeup_start(%ebx), %eax
175184
movl (%eax), %eax
185+
andl $~0x1, %eax
176186
mov %eax, %cr3
177187

178188
/*
@@ -276,6 +286,8 @@ wakeup_pcb:
276286
.quad 0
277287
wakeup_ret:
278288
.quad 0
289+
wakeup_efer:
290+
.quad 0
279291
wakeup_gdt:
280292
.word 0
281293
.quad 0

0 commit comments

Comments
 (0)