On Fri, 25 Jun 2021 18:26:31 +0200 (CEST) Mark Kettenis <[email protected]> wrote:
> > Date: Fri, 25 Jun 2021 16:13:27 +0000 > > From: "Mickael Torres" <[email protected]> > > > > Hello, > > > > This enables radeondrm/amdgpu and wsconsole/kbd/mouse on risc-v. > > This was tested with a radeondrm "7:0:0: ATI Radeon HD 7450" (see > > dmesg at the end), I'll try to test amdgpu with an RX550 during the > > week end. > > > > X doesn't start because of undefined symbols in modesetting_drv.so > > (see below), but I didn't take a look yet. > > Hi Mickael, > > Cool. Will take a proper look at this later. Some of your fixes > overlap with changes that we already have pending but aren't committed > yet. But there are some good fixes in here. > > There is a small problem though. Your e-mail client seems to replace > tabs with spaces, which means your patches don't apply. You may be > able to fix that in your e-mail client. As a last resort you could > include your diffs *both* inline and as an attachment. > > Cheers, > > Mark > Hi Mark, Here is a new version of the diff, based on an up-to-date tree, and (hopefully) with tabs as tabs. Best, Mickael Index: sys/arch/riscv64/conf/GENERIC =================================================================== RCS file: /cvs/src/sys/arch/riscv64/conf/GENERIC,v retrieving revision 1.23 diff -u -p -u -r1.23 GENERIC --- sys/arch/riscv64/conf/GENERIC 23 Jun 2021 15:26:10 -0000 1.23 +++ sys/arch/riscv64/conf/GENERIC 25 Jun 2021 18:37:25 -0000 @@ -103,9 +103,11 @@ 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? +ukbd* at uhidev? +wskbd* at ukbd? mux 1 +ums* at uhidev? # USB mouse +wsmouse* at ums? mux 0 umass* at uhub? aue* at uhub? # ADMtek AN986 Pegasus Ethernet atu* at uhub? # Atmel AT76c50x based 802.11b @@ -148,5 +150,17 @@ sqphy* at mii? # Seeq 8x220 PHYs ukphy* at mii? # "unknown" PHYs urlphy* at mii? # Realtek RTL8150L internal PHY +radeondrm* at pci? +drm* at radeondrm? +wsdisplay* at radeondrm? +amdgpu* at pci? +drm* at amdgpu? +wsdisplay* at amdgpu? + +option WSDISPLAY_COMPAT_USL # VT handling +option WSDISPLAY_COMPAT_RAWKBD # provide raw scancodes; needed for X11 +option WSDISPLAY_DEFAULTSCREENS=6 # initial number of text consoles + # Pseudo-Devices pseudo-device openprom +pseudo-device wsmux 2 Index: sys/arch/riscv64/conf/Makefile.riscv64 =================================================================== RCS file: /cvs/src/sys/arch/riscv64/conf/Makefile.riscv64,v retrieving revision 1.10 diff -u -p -u -r1.10 Makefile.riscv64 --- sys/arch/riscv64/conf/Makefile.riscv64 18 May 2021 12:24:12 -0000 1.10 +++ sys/arch/riscv64/conf/Makefile.riscv64 25 Jun 2021 18:37:25 -0000 @@ -21,7 +21,25 @@ 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 \ + -I$S/dev/pci/drm/amd/include/asic_reg \ + -I$S/dev/pci/drm/amd/include \ + -I$S/dev/pci/drm/amd/amdgpu \ + -I$S/dev/pci/drm/amd/display \ + -I$S/dev/pci/drm/amd/display/include \ + -I$S/dev/pci/drm/amd/display/dc \ + -I$S/dev/pci/drm/amd/display/amdgpu_dm \ + -I$S/dev/pci/drm/amd/powerplay/inc \ + -I$S/dev/pci/drm/amd/powerplay/smumgr \ + -I$S/dev/pci/drm/amd/powerplay/hwmgr \ + -I$S/dev/pci/drm/amd/display/dc/inc \ + -I$S/dev/pci/drm/amd/display/dc/inc/hw \ + -I$S/dev/pci/drm/amd/display/dc/clk_mgr \ + -I$S/dev/pci/drm/amd/display/modules/inc \ + -I$S/dev/pci/drm/amd/display/modules/hdcp \ + -I$S/dev/pci/drm/amd/display/dmub/inc CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \ -Wno-uninitialized -Wno-pointer-sign \ Index: sys/arch/riscv64/conf/files.riscv64 =================================================================== RCS file: /cvs/src/sys/arch/riscv64/conf/files.riscv64,v retrieving revision 1.14 diff -u -p -u -r1.14 files.riscv64 --- sys/arch/riscv64/conf/files.riscv64 17 Jun 2021 16:10:50 -0000 1.14 +++ sys/arch/riscv64/conf/files.riscv64 25 Jun 2021 18:37:25 -0000 @@ -137,3 +137,7 @@ file dev/fdt/pciecam.c pciecam # Machine-independent USB drivers include "dev/usb/files.usb" +# Include WSCONS stuff +include "dev/wscons/files.wscons" +include "dev/rasops/files.rasops" +include "dev/wsfont/files.wsfont" Index: sys/arch/riscv64/riscv64/conf.c =================================================================== RCS file: /cvs/src/sys/arch/riscv64/riscv64/conf.c,v retrieving revision 1.9 diff -u -p -u -r1.9 conf.c --- sys/arch/riscv64/riscv64/conf.c 19 May 2021 20:37:16 -0000 1.9 +++ sys/arch/riscv64/riscv64/conf.c 25 Jun 2021 18:37:25 -0000 @@ -102,6 +102,11 @@ cdev_decl(pci); #include "ipmi.h" #include "switch.h" +#include "wsdisplay.h" +#include "wskbd.h" +#include "wsmouse.h" +#include "wsmux.h" + struct cdevsw cdevsw[] = { cdev_cn_init(1,cn), /* 0: virtual console */ @@ -116,7 +121,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 +179,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 Index: sys/dev/fdt/dwpcie.c =================================================================== RCS file: /cvs/src/sys/dev/fdt/dwpcie.c,v retrieving revision 1.34 diff -u -p -u -r1.34 dwpcie.c --- sys/dev/fdt/dwpcie.c 25 Jun 2021 17:41:22 -0000 1.34 +++ sys/dev/fdt/dwpcie.c 25 Jun 2021 19:31:46 -0000 @@ -1373,12 +1373,12 @@ dwpcie_bs_memmap(bus_space_tag_t t, bus_ uint64_t pci_end = pci_start + sc->sc_ranges[i].size; uint64_t phys_start = sc->sc_ranges[i].phys_base; - if ((sc->sc_ranges[i].flags & 0x03000000) == 0x02000000 && + if ((sc->sc_ranges[i].flags & 0x02000000) == 0x02000000 && addr >= pci_start && addr + size <= pci_end) { return bus_space_map(sc->sc_iot, addr - pci_start + phys_start, size, flags, bshp); } } - + return ENXIO; } Index: sys/dev/pci/drm/include/linux/pci.h =================================================================== RCS file: /cvs/src/sys/dev/pci/drm/include/linux/pci.h,v retrieving revision 1.5 diff -u -p -u -r1.5 pci.h --- sys/dev/pci/drm/include/linux/pci.h 8 Jun 2020 04:48:15 -0000 1.5 +++ sys/dev/pci/drm/include/linux/pci.h 25 Jun 2021 18:37:26 -0000 @@ -395,7 +395,7 @@ pci_get_class(pcireg_t class, struct pci #define PCI_CLASS_DISPLAY_OTHER \ (PCI_CLASS_DISPLAY | PCI_SUBCLASS_DISPLAY_MISC) -#if defined(__amd64__) || defined(__arm64__) || defined(__i386__) +#if defined(__amd64__) || defined(__arm64__) || defined(__i386__) || defined(__riscv64__) #define PCI_DMA_BIDIRECTIONAL 0 @@ -419,6 +419,6 @@ pci_dma_mapping_error(struct pci_dev *pd #define pci_set_dma_mask(x, y) 0 #define pci_set_consistent_dma_mask(x, y) 0 -#endif /* defined(__amd64__) || defined(__arm64__) || defined(__i386__) */ +#endif /* defined(__amd64__) || defined(__arm64__) || defined(__i386__) || defined(__riscv64__) */ #endif
