From 7a179e3a3bff5d74678e364eab22147ed3205567 Mon Sep 17 00:00:00 2001 From: matthieu Date: Fri, 25 Jun 2021 19:27:40 +0000 Subject: [PATCH] basic radeondrm / X support for riscv64. Ok kettenis@ - add wscons devices - build radeondrm and add MD uvm bits to support it. --- sys/arch/riscv64/conf/GENERIC | 32 ++++++++++++++++++++++---- sys/arch/riscv64/conf/Makefile.riscv64 | 6 +++-- sys/arch/riscv64/conf/files.riscv64 | 7 +++++- sys/arch/riscv64/riscv64/conf.c | 21 ++++++++++++----- sys/dev/pci/drm/ttm/ttm_bo_util.c | 2 +- sys/uvm/uvm_device.c | 4 ++-- sys/uvm/uvm_pdaemon.c | 4 ++-- 7 files changed, 58 insertions(+), 18 deletions(-) diff --git a/sys/arch/riscv64/conf/GENERIC b/sys/arch/riscv64/conf/GENERIC index 332d20bc363..00f8fc4d058 100644 --- a/sys/arch/riscv64/conf/GENERIC +++ b/sys/arch/riscv64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.23 2021/06/23 15:26:10 kettenis Exp $ +# $OpenBSD: GENERIC,v 1.24 2021/06/25 19:27:40 matthieu Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -23,6 +23,11 @@ makeoptions KERNEL_BASE_VIRT="0xffffffc000200000" #option DEBUG_INTC #option DEBUG_TIMER +option WSDISPLAY_COMPAT_USL +option WSDISPLAY_COMPAT_RAWKBD +option WSDISPLAY_DEFAULTSCREENS=6 + + config bsd swap generic # @@ -80,6 +85,11 @@ titmp* at iic? ppb* at pci? # PCI-PCI bridges pci* at ppb? +# DRM devices +radeondrm* at pci? +drm* at radeondrm? +wsdisplay* at radeondrm? + # PCI Ethernet em* at pci? # Intel Pro/1000 Ethernet bge* at pci? # Broadcom BCM57xx (aka Tigon3) @@ -103,9 +113,19 @@ usb* at xhci? # USB devices uhub* at usb? uhub* at uhub? -#uhidev* at uhub? -#ukbd* at uhidev? -#wskbd* at ukbd? mux 1 +uhidev* at uhub? +ums* at uhidev? # USB mouse +wsmouse* at ums? mux 0 +umt* at uhidev? # USB multitouch touchpad +wsmouse* at umt? mux 0 +uts* at uhub? # USB touchscreen +wsmouse* at uts? mux 0 +uwacom* at uhidev? # USB Wacom tablet +wsmouse* at uwacom? mux 0 +ukbd* at uhidev? +wskbd* at ukbd? mux 1 +udl* at uhub? # DisplayLink USB displays +wsdisplay* at udl? umass* at uhub? aue* at uhub? # ADMtek AN986 Pegasus Ethernet atu* at uhub? # Atmel AT76c50x based 802.11b @@ -150,3 +170,7 @@ urlphy* at mii? # Realtek RTL8150L internal PHY # Pseudo-Devices pseudo-device openprom +pseudo-device hotplug 1 # devices hot plugging + +# mouse & keyboard multiplexor pseudo-devices +pseudo-device wsmux 2 diff --git a/sys/arch/riscv64/conf/Makefile.riscv64 b/sys/arch/riscv64/conf/Makefile.riscv64 index 56d3940429c..82a14f2953a 100644 --- a/sys/arch/riscv64/conf/Makefile.riscv64 +++ b/sys/arch/riscv64/conf/Makefile.riscv64 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.riscv64,v 1.10 2021/05/18 12:24:12 jsg Exp $ +# $OpenBSD: Makefile.riscv64,v 1.11 2021/06/25 19:27:40 matthieu Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -21,7 +21,9 @@ S!= cd ../../../..; pwd _machdir?= $S/arch/${_mach} _archdir?= $S/arch/${_arch} -INCLUDES= -nostdinc -I$S -I${.OBJDIR} -I$S/arch +INCLUDES= -nostdinc -I$S -I${.OBJDIR} -I$S/arch \ + -I$S/dev/pci/drm/include \ + -I$S/dev/pci/drm/include/uapi CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \ -Wno-uninitialized -Wno-pointer-sign \ diff --git a/sys/arch/riscv64/conf/files.riscv64 b/sys/arch/riscv64/conf/files.riscv64 index 6ea4fbb2b7f..8b50b28ef96 100644 --- a/sys/arch/riscv64/conf/files.riscv64 +++ b/sys/arch/riscv64/conf/files.riscv64 @@ -1,4 +1,4 @@ -# $OpenBSD: files.riscv64,v 1.14 2021/06/17 16:10:50 kettenis Exp $ +# $OpenBSD: files.riscv64,v 1.15 2021/06/25 19:27:40 matthieu Exp $ # Standard stanzas config(8) can't run without maxpartitions 16 @@ -130,6 +130,11 @@ include "scsi/files.scsi" # Machine-independent ATA drivers include "dev/ata/files.ata" +# Include WSCONS stuff +include "dev/wscons/files.wscons" +include "dev/rasops/files.rasops" +include "dev/wsfont/files.wsfont" + device pciecam: pcibus attach pciecam at fdt file dev/fdt/pciecam.c pciecam diff --git a/sys/arch/riscv64/riscv64/conf.c b/sys/arch/riscv64/riscv64/conf.c index 1516fe2bef1..732a71ee26c 100644 --- a/sys/arch/riscv64/riscv64/conf.c +++ b/sys/arch/riscv64/riscv64/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.9 2021/05/19 20:37:16 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.10 2021/06/25 19:27:40 matthieu Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -86,6 +86,13 @@ cdev_decl(lpt); #include "ksyms.h" #include "kstat.h" #include "radio.h" +#include "drm.h" +cdev_decl(drm); + +#include "wsdisplay.h" +#include "wskbd.h" +#include "wsmouse.h" +#include "wsmux.h" #ifdef USER_PCICONF #include "pci.h" @@ -116,7 +123,8 @@ struct cdevsw cdevsw[] = cdev_notdef(), /* 9: was floppy disk */ cdev_notdef(), /* 10 */ cdev_notdef(), /* 11: Sony CD-ROM */ - cdev_notdef(), /* 12: frame buffers, etc. */ + cdev_wsdisplay_init(NWSDISPLAY, /* 12: frame buffers, etc. */ + wsdisplay), cdev_disk_init(NSD,sd), /* 13: SCSI disk */ cdev_notdef(), /* 14: was: SCSI tape */ cdev_disk_init(NCD,cd), /* 15: SCSI CD-ROM */ @@ -173,9 +181,10 @@ struct cdevsw cdevsw[] = cdev_notdef(), /* 64: USB printers */ cdev_notdef(), /* 65: urio */ cdev_notdef(), /* 66: USB tty */ - cdev_notdef(), /* 67: keyboards */ - cdev_notdef(), /* 68: mice */ - cdev_notdef(), /* 69: ws multiplexor */ + cdev_mouse_init(NWSKBD, wskbd), /* 67: keyboards */ + cdev_mouse_init(NWSMOUSE, /* 68: mice */ + wsmouse), + cdev_mouse_init(NWSMUX, wsmux), /* 69: ws multiplexor */ cdev_openprom_init(NOPENPROM,openprom), /* 70: /dev/openprom */ cdev_notdef(), /* 71: was: Cyclades-Z serial port */ #ifdef USER_PCICONF @@ -197,7 +206,7 @@ struct cdevsw cdevsw[] = cdev_notdef(), /* 84 */ cdev_notdef(), /* 85 */ cdev_notdef(), /* 86 */ - cdev_notdef(), /* 87: drm */ + cdev_drm_init(NDRM,drm), /* 87: drm */ cdev_notdef(), /* 88: GPIO interface */ cdev_vscsi_init(NVSCSI,vscsi), /* 89: vscsi */ cdev_disk_init(1,diskmap), /* 90: disk mapper */ diff --git a/sys/dev/pci/drm/ttm/ttm_bo_util.c b/sys/dev/pci/drm/ttm/ttm_bo_util.c index 26228cb9b4c..c280ca41498 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_util.c +++ b/sys/dev/pci/drm/ttm/ttm_bo_util.c @@ -551,7 +551,7 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp) tmp = pgprot_noncached(tmp); #endif #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \ - defined(__powerpc__) || defined(__mips__) + defined(__powerpc__) || defined(__mips__) || defined(__riscv64__) if (caching_flags & TTM_PL_FLAG_WC) tmp = pgprot_writecombine(tmp); else diff --git a/sys/uvm/uvm_device.c b/sys/uvm/uvm_device.c index 1d0af1740ba..aad6829f555 100644 --- a/sys/uvm/uvm_device.c +++ b/sys/uvm/uvm_device.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_device.c,v 1.62 2021/06/16 09:02:21 mpi Exp $ */ +/* $OpenBSD: uvm_device.c,v 1.63 2021/06/25 19:27:40 matthieu Exp $ */ /* $NetBSD: uvm_device.c,v 1.30 2000/11/25 06:27:59 chs Exp $ */ /* @@ -44,7 +44,7 @@ #if defined(__amd64__) || defined(__arm64__) || \ defined(__i386__) || defined(__loongson__) || \ defined(__macppc__) || defined(__powerpc64__) || \ - defined(__sparc64__) + defined(__riscv64__) || defined(__sparc64__) #include "drm.h" #endif diff --git a/sys/uvm/uvm_pdaemon.c b/sys/uvm/uvm_pdaemon.c index 33c266a5a89..b31d37a05f4 100644 --- a/sys/uvm/uvm_pdaemon.c +++ b/sys/uvm/uvm_pdaemon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pdaemon.c,v 1.91 2021/05/31 13:44:04 jsg Exp $ */ +/* $OpenBSD: uvm_pdaemon.c,v 1.92 2021/06/25 19:27:40 matthieu Exp $ */ /* $NetBSD: uvm_pdaemon.c,v 1.23 2000/08/20 10:24:14 bjh21 Exp $ */ /* @@ -84,7 +84,7 @@ #if defined(__amd64__) || defined(__arm64__) || \ defined(__i386__) || defined(__loongson__) || \ defined(__macppc__) || defined(__powerpc64__) || \ - defined(__sparc64__) + defined(__riscv64__) || defined(__sparc64__) #include "drm.h" #endif -- 2.20.1