Module Name: src
Committed By: riastradh
Date: Sun Jul 17 15:36:05 UTC 2022
Modified Files:
src/sys/external/bsd/drm2/ttm: files.ttm
src/sys/modules: Makefile
Added Files:
src/sys/external/bsd/drm2/ttm: ttm_module.c
src/sys/modules/drmkms_ttm: Makefile
Log Message:
drm: Modularize ttm.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/ttm/files.ttm
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/ttm/ttm_module.c
cvs rdiff -u -r1.266 -r1.267 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/drmkms_ttm/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/drm2/ttm/files.ttm
diff -u src/sys/external/bsd/drm2/ttm/files.ttm:1.7 src/sys/external/bsd/drm2/ttm/files.ttm:1.8
--- src/sys/external/bsd/drm2/ttm/files.ttm:1.7 Sun Dec 19 10:55:38 2021
+++ src/sys/external/bsd/drm2/ttm/files.ttm Sun Jul 17 15:36:05 2022
@@ -1,4 +1,4 @@
-# $NetBSD: files.ttm,v 1.7 2021/12/19 10:55:38 riastradh Exp $
+# $NetBSD: files.ttm,v 1.8 2022/07/17 15:36:05 riastradh Exp $
# TTM, the texture and tiling manager.
@@ -17,8 +17,7 @@ file external/bsd/drm2/dist/drm/ttm/ttm_
file external/bsd/drm2/dist/drm/ttm/ttm_bo.c drmkms_ttm
file external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c drmkms_ttm
file external/bsd/drm2/ttm/ttm_bo_vm.c drmkms_ttm
-# Linux module goo.
-#file external/bsd/drm2/dist/drm/ttm/ttm_module.c drmkms_ttm
+file external/bsd/drm2/ttm/ttm_module.c drmkms_ttm
# Used only by vmwgfx. Needs porting for rcu -> pserialize.
#file external/bsd/drm2/dist/drm/ttm/ttm_object.c drmkms_ttm
# Used only by vmwgfx. Needs porting. Does silly things like SIGKILL.
Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.266 src/sys/modules/Makefile:1.267
--- src/sys/modules/Makefile:1.266 Sat Jun 4 03:31:10 2022
+++ src/sys/modules/Makefile Sun Jul 17 15:36:05 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.266 2022/06/04 03:31:10 pgoyette Exp $
+# $NetBSD: Makefile,v 1.267 2022/07/17 15:36:05 riastradh Exp $
.include <bsd.own.mk>
@@ -354,6 +354,7 @@ SUBDIR+= drm
#SUBDIR+= drmkms_agp
#SUBDIR+= drmkms_linux
#SUBDIR+= drmkms_pci
+#SUBDIR+= drmkms_ttm
SUBDIR+= i915drm
#SUBDIR+= i915drmkms
#
Added files:
Index: src/sys/external/bsd/drm2/ttm/ttm_module.c
diff -u /dev/null src/sys/external/bsd/drm2/ttm/ttm_module.c:1.1
--- /dev/null Sun Jul 17 15:36:05 2022
+++ src/sys/external/bsd/drm2/ttm/ttm_module.c Sun Jul 17 15:36:05 2022
@@ -0,0 +1,51 @@
+/* $NetBSD: ttm_module.c,v 1.1 2022/07/17 15:36:05 riastradh Exp $ */
+
+/*-
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: ttm_module.c,v 1.1 2022/07/17 15:36:05 riastradh Exp $");
+
+#include <sys/errno.h>
+#include <sys/module.h>
+
+MODULE(MODULE_CLASS_DRIVER, drmkms_ttm, "drmkms");
+
+static int
+drmkms_ttm_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return 0;
+ case MODULE_CMD_AUTOUNLOAD:
+ return EBUSY;
+ case MODULE_CMD_FINI:
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
Index: src/sys/modules/drmkms_ttm/Makefile
diff -u /dev/null src/sys/modules/drmkms_ttm/Makefile:1.1
--- /dev/null Sun Jul 17 15:36:05 2022
+++ src/sys/modules/drmkms_ttm/Makefile Sun Jul 17 15:36:05 2022
@@ -0,0 +1,35 @@
+# $NetBSD: Makefile,v 1.1 2022/07/17 15:36:05 riastradh Exp $
+
+.include "../Makefile.inc"
+.include "../drmkms/Makefile.inc"
+
+KMOD= drmkms_ttm
+
+.PATH: ${S}/external/bsd/drm2/ttm
+.PATH: ${S}/external/bsd/drm2/dist/drm/ttm
+
+CPPFLAGS+= -DCONFIG_AGP=1
+
+WARNS= 3
+
+COPTS.ttm_bo.c+= ${GCC_NO_IMPLICIT_FALLTHRU}
+
+CWARNFLAGS+= -Wno-missing-field-initializers
+CWARNFLAGS+= -Wno-shadow
+
+SRCS+= ttm_agp_backend.c
+SRCS+= ttm_memory.c
+SRCS+= ttm_tt.c
+SRCS+= ttm_bo.c
+SRCS+= ttm_bo_util.c
+SRCS+= ttm_bo_vm.c
+SRCS+= ttm_module.c
+#SRCS+= ttm_object.c
+#SRCS+= ttm_lock.c
+SRCS+= ttm_execbuf_util.c
+#SRCS+= ttm_page_alloc.c
+SRCS+= ttm_bo_manager.c
+#SRCS+= ttm_page_alloc_dma.c
+SRCS+= ttm_bus_dma.c
+
+.include <bsd.kmodule.mk>