Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys x86: Forbid using x86/pte.h directly; use machine/pte.h.



details:   https://anonhg.NetBSD.org/src/rev/7db26d545e25
branches:  trunk
changeset: 369530:7db26d545e25
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Aug 20 23:19:08 2022 +0000

description:
x86: Forbid using x86/pte.h directly; use machine/pte.h.

machine/pte.h already used outside sys/arch, so let's make it the
primary thing and make sure to use x86/pte.h only as a subroutine.

diffstat:

 sys/arch/amd64/include/pte.h                       |  4 +++-
 sys/arch/i386/include/pte.h                        |  4 +++-
 sys/arch/x86/include/pte.h                         |  6 +++++-
 sys/external/bsd/drm2/dist/drm/i915/gt/intel_gtt.h |  4 ++--
 sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c |  6 +++---
 5 files changed, 16 insertions(+), 8 deletions(-)

diffs (102 lines):

diff -r 4de6ecc0e262 -r 7db26d545e25 sys/arch/amd64/include/pte.h
--- a/sys/arch/amd64/include/pte.h      Sat Aug 20 23:18:51 2022 +0000
+++ b/sys/arch/amd64/include/pte.h      Sat Aug 20 23:19:08 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pte.h,v 1.15 2022/08/20 23:18:39 riastradh Exp $       */
+/*     $NetBSD: pte.h,v 1.16 2022/08/20 23:19:08 riastradh Exp $       */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -121,7 +121,9 @@
 #define PTE_FRAME      PTE_4KFRAME
 #define PTE_LGFRAME    PTE_2MFRAME
 
+#define        _MACHINE_PTE_H_X86
 #include <x86/pte.h>
+#undef _MACHINE_PTE_H_X86
 
 #else   /*      !__x86_64__      */
 
diff -r 4de6ecc0e262 -r 7db26d545e25 sys/arch/i386/include/pte.h
--- a/sys/arch/i386/include/pte.h       Sat Aug 20 23:18:51 2022 +0000
+++ b/sys/arch/i386/include/pte.h       Sat Aug 20 23:19:08 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pte.h,v 1.34 2022/08/20 23:18:40 riastradh Exp $       */
+/*     $NetBSD: pte.h,v 1.35 2022/08/20 23:19:08 riastradh Exp $       */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -168,6 +168,8 @@
 #define PTE_NX         0               /* Dummy */
 #endif
 
+#define        _MACHINE_PTE_H_X86
 #include <x86/pte.h>
+#undef _MACHINE_PTE_H_X86
 
 #endif /* _I386_PTE_H_ */
diff -r 4de6ecc0e262 -r 7db26d545e25 sys/arch/x86/include/pte.h
--- a/sys/arch/x86/include/pte.h        Sat Aug 20 23:18:51 2022 +0000
+++ b/sys/arch/x86/include/pte.h        Sat Aug 20 23:19:08 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pte.h,v 1.6 2022/08/20 23:18:51 riastradh Exp $        */
+/*     $NetBSD: pte.h,v 1.7 2022/08/20 23:19:09 riastradh Exp $        */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -32,6 +32,10 @@
 #ifndef _X86_PTE_H
 #define _X86_PTE_H
 
+#ifndef _MACHINE_PTE_H_X86
+#error Use machine/pte.h, not x86/pte.h directly.
+#endif
+
 /* Cacheability bits when we are using PAT */
 #define PGC_WB         0                       /* The default */
 #define PGC_WC         PTE_PWT                 /* WT and CD is WC */
diff -r 4de6ecc0e262 -r 7db26d545e25 sys/external/bsd/drm2/dist/drm/i915/gt/intel_gtt.h
--- a/sys/external/bsd/drm2/dist/drm/i915/gt/intel_gtt.h        Sat Aug 20 23:18:51 2022 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gt/intel_gtt.h        Sat Aug 20 23:19:08 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_gtt.h,v 1.12 2021/12/19 11:39:55 riastradh Exp $ */
+/*     $NetBSD: intel_gtt.h,v 1.13 2022/08/20 23:19:09 riastradh Exp $ */
 
 /* SPDX-License-Identifier: MIT */
 /*
@@ -37,7 +37,7 @@
 #ifdef __NetBSD__
 #include <drm/bus_dma_hacks.h>
 #include <x86/machdep.h>
-#include <x86/pte.h>
+#include <machine/pte.h>
 #define        _PAGE_PRESENT   PTE_P   /* 0x01 PTE is present / valid */
 #define        _PAGE_RW        PTE_W   /* 0x02 read/write */
 #define        _PAGE_PWT       PTE_PWT /* 0x08 write-through */
diff -r 4de6ecc0e262 -r 7db26d545e25 sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c        Sat Aug 20 23:18:51 2022 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c        Sat Aug 20 23:19:08 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_gem_gtt.c,v 1.23 2021/12/19 11:33:30 riastradh Exp $      */
+/*     $NetBSD: i915_gem_gtt.c,v 1.24 2022/08/20 23:19:09 riastradh Exp $      */
 
 // SPDX-License-Identifier: MIT
 /*
@@ -6,7 +6,7 @@
  * Copyright © 2020 Intel Corporation
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_gtt.c,v 1.23 2021/12/19 11:33:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_gtt.c,v 1.24 2022/08/20 23:19:09 riastradh Exp $");
 
 #include <linux/slab.h> /* fault-inject.h is not standalone! */
 
@@ -33,7 +33,7 @@
 #ifdef __NetBSD__
 #include <drm/bus_dma_hacks.h>
 #include <x86/machdep.h>
-#include <x86/pte.h>
+#include <machine/pte.h>
 #define        _PAGE_PRESENT   PTE_P   /* 0x01 PTE is present */
 #define        _PAGE_RW        PTE_W   /* 0x02 read/write */
 #define        _PAGE_PWT       PTE_PWT /* 0x08 page write-through */



Home | Main Index | Thread Index | Old Index