Re: amd64 serial console changes, part 2
> Date: Tue, 12 Jul 2022 20:03:15 +0200 > From: Denis Fondras > > Le Wed, Jul 06, 2022 at 10:45:39PM +0200, Mark Kettenis a écrit : > > Now that the kernel supports the extended BOOTARG_CONSDEV struct and > > snaps with that change are out there, here is the diff that changes > > the amd64 bootloaders to switch to the extended struct and provide the > > parameters necessary for using the non-standard UART on the AMD Ryzen > > Embedded V1000 SoCs. > > > > It would be good if someone can confirm this works on something like > > an APU. > > > > I don't have any other EFI appliance to test but it reads fine, applies and > builds OK. > > Anyway, I could not make it work on the AMD Ryzen Embedded V1000. I > might be missing a step here. I built a kernel with the diff > applied, built the ramdrive and tried to boot it but it still > reboots when in ELFNAME(). You'll need an image with an updated bootloader; check that the version number of the bootloader is at least 3.61. The diff is committed now, so the easiest thing is to just wait for a fresh snapshot. Cheers, Mark
Re: amd64 serial console changes, part 2
Le Wed, Jul 06, 2022 at 10:45:39PM +0200, Mark Kettenis a écrit : > Now that the kernel supports the extended BOOTARG_CONSDEV struct and > snaps with that change are out there, here is the diff that changes > the amd64 bootloaders to switch to the extended struct and provide the > parameters necessary for using the non-standard UART on the AMD Ryzen > Embedded V1000 SoCs. > > It would be good if someone can confirm this works on something like > an APU. > I don't have any other EFI appliance to test but it reads fine, applies and builds OK. Anyway, I could not make it work on the AMD Ryzen Embedded V1000. I might be missing a step here. I built a kernel with the diff applied, built the ramdrive and tried to boot it but it still reboots when in ELFNAME(). > ok? > > > Index: stand/boot/conf.c > === > RCS file: /cvs/src/sys/arch/amd64/stand/boot/conf.c,v > retrieving revision 1.53 > diff -u -p -r1.53 conf.c > --- stand/boot/conf.c 9 Dec 2020 18:10:17 - 1.53 > +++ stand/boot/conf.c 6 Jul 2022 20:02:13 - > @@ -41,7 +41,7 @@ > #include > #include > > -const char version[] = "3.53"; > +const char version[] = "3.54"; > int debug = 1; > > > Index: stand/cdboot/conf.c > === > RCS file: /cvs/src/sys/arch/amd64/stand/cdboot/conf.c,v > retrieving revision 1.47 > diff -u -p -r1.47 conf.c > --- stand/cdboot/conf.c 9 Dec 2020 18:10:18 - 1.47 > +++ stand/cdboot/conf.c 6 Jul 2022 20:02:13 - > @@ -42,7 +42,7 @@ > #include > #include > > -const char version[] = "3.53"; > +const char version[] = "3.54"; > int debug = 1; > > > Index: stand/efiboot/conf.c > === > RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/conf.c,v > retrieving revision 1.37 > diff -u -p -r1.37 conf.c > --- stand/efiboot/conf.c 20 Jun 2022 02:22:05 - 1.37 > +++ stand/efiboot/conf.c 6 Jul 2022 20:02:13 - > @@ -40,7 +40,7 @@ > #include "efidev.h" > #include "efipxe.h" > > -const char version[] = "3.60"; > +const char version[] = "3.61"; > > #ifdef EFI_DEBUG > int debug = 0; > Index: stand/efiboot/efiboot.c > === > RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/efiboot.c,v > retrieving revision 1.39 > diff -u -p -r1.39 efiboot.c > --- stand/efiboot/efiboot.c 20 Jun 2022 02:22:05 - 1.39 > +++ stand/efiboot/efiboot.c 6 Jul 2022 20:02:13 - > @@ -938,6 +938,70 @@ efi_makebootargs(void) > addbootarg(BOOTARG_EFIINFO, sizeof(bios_efiinfo), _efiinfo); > } > > +/* Vendor device path used to indicate the mmio UART on AMD SoCs. */ > +#define AMDSOC_DEVPATH \ > + { 0xe76fd4e9, 0x0a30, 0x4ca9, \ > + { 0x95, 0x40, 0xd7, 0x99, 0x53, 0x4c, 0xc4, 0xff } } > + > +void > +efi_setconsdev(void) > +{ > + bios_consdev_t cd; > + EFI_STATUS status; > + UINT8 data[128]; > + UINTN size = sizeof(data); > + EFI_DEVICE_PATH *dp = (void *)data; > + VENDOR_DEVICE_PATH *vdp; > + UART_DEVICE_PATH *udp; > + EFI_GUID global = EFI_GLOBAL_VARIABLE; > + EFI_GUID amdsoc = AMDSOC_DEVPATH; > + > + memset(, 0, sizeof(cd)); > + cd.consdev = cn_tab->cn_dev; > + cd.conspeed = com_speed; > + cd.consaddr = com_addr; > + > + /* > + * If the ConOut variable indicates we're using a serial > + * console, use it to determine the baud rate. > + */ > + status = RS->GetVariable(L"ConOut", , NULL, , ); > + if (status == EFI_SUCCESS) { > + for (dp = (void *)data; !IsDevicePathEnd(dp); > + dp = NextDevicePathNode(dp)) { > + /* > + * AMD Ryzen Embedded V1000 SoCs integrate a > + * Synopsys DesignWare UART that is not > + * compatible with the traditional 8250 UART > + * found on the IBM PC. Pass the magic > + * parameters to the kernel to make this UART > + * work. > + */ > + if (DevicePathType(dp) == HARDWARE_DEVICE_PATH && > + DevicePathSubType(dp) == HW_VENDOR_DP) { > + vdp = (VENDOR_DEVICE_PATH *)dp; > + if (efi_guidcmp(>Guid, ) == 0) { > + cd.consdev = makedev(8, 4); > + cd.consaddr = *(uint64_t *)(vdp + 1); > + cd.consfreq = 4800; > + cd.flags = BCD_MMIO; > + cd.reg_width = 4; > + cd.reg_shift = 2; > + } > + } > + > + if (DevicePathType(dp) == MESSAGING_DEVICE_PATH &&
Re: amd64 serial console changes, part 2
On 6.7.2022. 22:45, Mark Kettenis wrote: > Now that the kernel supports the extended BOOTARG_CONSDEV struct and > snaps with that change are out there, here is the diff that changes > the amd64 bootloaders to switch to the extended struct and provide the > parameters necessary for using the non-standard UART on the AMD Ryzen > Embedded V1000 SoCs. > > It would be good if someone can confirm this works on something like > an APU. Hi, I've tested this on Dell r620 with serial console and on supermicro box with ipmi serial and both works normally. This time with everything that needs to be compiled :) dell com1 at acpi0 COMA addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo com1: console com0 at acpi0 COMB addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo supermicro com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo com1: console
amd64 serial console changes, part 2
Now that the kernel supports the extended BOOTARG_CONSDEV struct and snaps with that change are out there, here is the diff that changes the amd64 bootloaders to switch to the extended struct and provide the parameters necessary for using the non-standard UART on the AMD Ryzen Embedded V1000 SoCs. It would be good if someone can confirm this works on something like an APU. ok? Index: stand/boot/conf.c === RCS file: /cvs/src/sys/arch/amd64/stand/boot/conf.c,v retrieving revision 1.53 diff -u -p -r1.53 conf.c --- stand/boot/conf.c 9 Dec 2020 18:10:17 - 1.53 +++ stand/boot/conf.c 6 Jul 2022 20:02:13 - @@ -41,7 +41,7 @@ #include #include -const char version[] = "3.53"; +const char version[] = "3.54"; intdebug = 1; Index: stand/cdboot/conf.c === RCS file: /cvs/src/sys/arch/amd64/stand/cdboot/conf.c,v retrieving revision 1.47 diff -u -p -r1.47 conf.c --- stand/cdboot/conf.c 9 Dec 2020 18:10:18 - 1.47 +++ stand/cdboot/conf.c 6 Jul 2022 20:02:13 - @@ -42,7 +42,7 @@ #include #include -const char version[] = "3.53"; +const char version[] = "3.54"; intdebug = 1; Index: stand/efiboot/conf.c === RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/conf.c,v retrieving revision 1.37 diff -u -p -r1.37 conf.c --- stand/efiboot/conf.c20 Jun 2022 02:22:05 - 1.37 +++ stand/efiboot/conf.c6 Jul 2022 20:02:13 - @@ -40,7 +40,7 @@ #include "efidev.h" #include "efipxe.h" -const char version[] = "3.60"; +const char version[] = "3.61"; #ifdef EFI_DEBUG intdebug = 0; Index: stand/efiboot/efiboot.c === RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/efiboot.c,v retrieving revision 1.39 diff -u -p -r1.39 efiboot.c --- stand/efiboot/efiboot.c 20 Jun 2022 02:22:05 - 1.39 +++ stand/efiboot/efiboot.c 6 Jul 2022 20:02:13 - @@ -938,6 +938,70 @@ efi_makebootargs(void) addbootarg(BOOTARG_EFIINFO, sizeof(bios_efiinfo), _efiinfo); } +/* Vendor device path used to indicate the mmio UART on AMD SoCs. */ +#define AMDSOC_DEVPATH \ + { 0xe76fd4e9, 0x0a30, 0x4ca9, \ + { 0x95, 0x40, 0xd7, 0x99, 0x53, 0x4c, 0xc4, 0xff } } + +void +efi_setconsdev(void) +{ + bios_consdev_t cd; + EFI_STATUS status; + UINT8 data[128]; + UINTN size = sizeof(data); + EFI_DEVICE_PATH *dp = (void *)data; + VENDOR_DEVICE_PATH *vdp; + UART_DEVICE_PATH *udp; + EFI_GUID global = EFI_GLOBAL_VARIABLE; + EFI_GUID amdsoc = AMDSOC_DEVPATH; + + memset(, 0, sizeof(cd)); + cd.consdev = cn_tab->cn_dev; + cd.conspeed = com_speed; + cd.consaddr = com_addr; + + /* +* If the ConOut variable indicates we're using a serial +* console, use it to determine the baud rate. +*/ + status = RS->GetVariable(L"ConOut", , NULL, , ); + if (status == EFI_SUCCESS) { + for (dp = (void *)data; !IsDevicePathEnd(dp); +dp = NextDevicePathNode(dp)) { + /* +* AMD Ryzen Embedded V1000 SoCs integrate a +* Synopsys DesignWare UART that is not +* compatible with the traditional 8250 UART +* found on the IBM PC. Pass the magic +* parameters to the kernel to make this UART +* work. +*/ + if (DevicePathType(dp) == HARDWARE_DEVICE_PATH && + DevicePathSubType(dp) == HW_VENDOR_DP) { + vdp = (VENDOR_DEVICE_PATH *)dp; + if (efi_guidcmp(>Guid, ) == 0) { + cd.consdev = makedev(8, 4); + cd.consaddr = *(uint64_t *)(vdp + 1); + cd.consfreq = 4800; + cd.flags = BCD_MMIO; + cd.reg_width = 4; + cd.reg_shift = 2; + } + } + + if (DevicePathType(dp) == MESSAGING_DEVICE_PATH && + DevicePathSubType(dp) == MSG_UART_DP) { + udp = (UART_DEVICE_PATH *)dp; + if (cd.conspeed == -1) + cd.conspeed = udp->BaudRate; + } + } + } + + addbootarg(BOOTARG_CONSDEV, sizeof(cd), ); +} + void _rtt(void) { Index: stand/efiboot/efiboot.h === RCS file:
Re: amd64 serial console changes
On 30.6.2022. 17:03, Stuart Henderson wrote: > On 2022/06/30 16:55, Hrvoje Popovski wrote: >> On 30.6.2022. 16:48, Hrvoje Popovski wrote: >>> On 30.6.2022. 15:14, Anton Lindqvist wrote: On Thu, Jun 30, 2022 at 01:07:46PM +0200, Mark Kettenis wrote: > Ah right. Please commit! Here's the complete diff, ok? >>> >>> >>> Hi, >>> >>> with this diff : >>> >>> dell r620 - serial console >>> com1 at acpi0 COMA addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo >>> com1: console >>> com0 at acpi0 COMB addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo >>> >>> works fast as before with first boot but second boot is slow... >>> >>> supermicro - ipmi console >>> com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo >>> com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo >>> com1: console >>> >>> is slow as without this diff .. >>> >>> >>> i will try on few more machines this diff ... >>> >> >> after applying diff i did >> cd /sys/arch/amd64/compile/GENERIC.MP && make -j6 obj && make config && >> make clean && time make -j6 && make install && reboot >> >> >> is this ok? >> > > This is in the bootloader not the kernel - "make obj/make/make install" > in sys/arch/amd64/stand and "installboot" > Thank you sthen@ and jca@ ... After this steps everything works just fine .. Thank you guys ..
Re: amd64 serial console changes
On 2022/06/30 16:55, Hrvoje Popovski wrote: > On 30.6.2022. 16:48, Hrvoje Popovski wrote: > > On 30.6.2022. 15:14, Anton Lindqvist wrote: > >> On Thu, Jun 30, 2022 at 01:07:46PM +0200, Mark Kettenis wrote: > >>> Ah right. Please commit! > >> Here's the complete diff, ok? > > > > > > Hi, > > > > with this diff : > > > > dell r620 - serial console > > com1 at acpi0 COMA addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo > > com1: console > > com0 at acpi0 COMB addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo > > > > works fast as before with first boot but second boot is slow... > > > > supermicro - ipmi console > > com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo > > com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo > > com1: console > > > > is slow as without this diff .. > > > > > > i will try on few more machines this diff ... > > > > after applying diff i did > cd /sys/arch/amd64/compile/GENERIC.MP && make -j6 obj && make config && > make clean && time make -j6 && make install && reboot > > > is this ok? > This is in the bootloader not the kernel - "make obj/make/make install" in sys/arch/amd64/stand and "installboot"
Re: amd64 serial console changes
On Thu, Jun 30 2022, Hrvoje Popovski wrote: > On 30.6.2022. 16:48, Hrvoje Popovski wrote: >> On 30.6.2022. 15:14, Anton Lindqvist wrote: >>> On Thu, Jun 30, 2022 at 01:07:46PM +0200, Mark Kettenis wrote: Ah right. Please commit! >>> Here's the complete diff, ok? >> >> >> Hi, >> >> with this diff : >> >> dell r620 - serial console >> com1 at acpi0 COMA addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo >> com1: console >> com0 at acpi0 COMB addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo >> >> works fast as before with first boot but second boot is slow... >> >> supermicro - ipmi console >> com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo >> com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo >> com1: console >> >> is slow as without this diff .. >> >> >> i will try on few more machines this diff ... >> > > after applying diff i did > cd /sys/arch/amd64/compile/GENERIC.MP && make -j6 obj && make config && > make clean && time make -j6 && make install && reboot > > > is this ok? You need to rebuild the boot files in /sys/arch/amd64/stand, install them and then run installboot. -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Re: amd64 serial console changes
On 30.6.2022. 16:48, Hrvoje Popovski wrote: > On 30.6.2022. 15:14, Anton Lindqvist wrote: >> On Thu, Jun 30, 2022 at 01:07:46PM +0200, Mark Kettenis wrote: >>> Ah right. Please commit! >> Here's the complete diff, ok? > > > Hi, > > with this diff : > > dell r620 - serial console > com1 at acpi0 COMA addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo > com1: console > com0 at acpi0 COMB addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo > > works fast as before with first boot but second boot is slow... > > supermicro - ipmi console > com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo > com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo > com1: console > > is slow as without this diff .. > > > i will try on few more machines this diff ... > after applying diff i did cd /sys/arch/amd64/compile/GENERIC.MP && make -j6 obj && make config && make clean && time make -j6 && make install && reboot is this ok?
Re: amd64 serial console changes
On 30.6.2022. 15:14, Anton Lindqvist wrote: > On Thu, Jun 30, 2022 at 01:07:46PM +0200, Mark Kettenis wrote: >> Ah right. Please commit! > Here's the complete diff, ok? Hi, with this diff : dell r620 - serial console com1 at acpi0 COMA addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo com1: console com0 at acpi0 COMB addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo works fast as before with first boot but second boot is slow... supermicro - ipmi console com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo com1: console is slow as without this diff .. i will try on few more machines this diff ...
Re: amd64 serial console changes
Forget about efi32 and efi64 (I just got permission from mlarkin to remove those). The efiboot and stand/libsa bits are ok kettenis@ > Op 30-06-2022 15:14 schreef Anton Lindqvist : > > > On Thu, Jun 30, 2022 at 01:07:46PM +0200, Mark Kettenis wrote: > > Ah right. Please commit! > > Here's the complete diff, ok? > > diff --git sys/arch/amd64/stand/efi32/exec_i386.c > sys/arch/amd64/stand/efi32/exec_i386.c > index 8349d97fefb..21f13cd273b 100644 > --- sys/arch/amd64/stand/efi32/exec_i386.c > +++ sys/arch/amd64/stand/efi32/exec_i386.c > @@ -66,7 +66,7 @@ run_loadfile(uint64_t *marks, int howto) > dev_t bootdev = bootdev_dip->bootdev; > size_t ac = BOOTARG_LEN; > caddr_t av = (caddr_t)BOOTARG_OFF; > - bios_consdev_t cd; > + bios_oconsdev_t cd; > extern int com_speed; /* from bioscons.c */ > extern int com_addr; > bios_ddb_t ddb; > diff --git sys/arch/amd64/stand/efi64/exec_i386.c > sys/arch/amd64/stand/efi64/exec_i386.c > index 48e460cb040..043193f93be 100644 > --- sys/arch/amd64/stand/efi64/exec_i386.c > +++ sys/arch/amd64/stand/efi64/exec_i386.c > @@ -66,7 +66,7 @@ run_loadfile(uint64_t *marks, int howto) > dev_t bootdev = bootdev_dip->bootdev; > size_t ac = BOOTARG_LEN; > caddr_t av = (caddr_t)BOOTARG_OFF; > - bios_consdev_t cd; > + bios_oconsdev_t cd; > extern int com_speed; /* from bioscons.c */ > extern int com_addr; > bios_ddb_t ddb; > diff --git sys/arch/amd64/stand/efiboot/exec_i386.c > sys/arch/amd64/stand/efiboot/exec_i386.c > index ea8fa67820b..70ff23c9d32 100644 > --- sys/arch/amd64/stand/efiboot/exec_i386.c > +++ sys/arch/amd64/stand/efiboot/exec_i386.c > @@ -72,7 +72,7 @@ run_loadfile(uint64_t *marks, int howto) > dev_t bootdev = bootdev_dip->bootdev; > size_t ac = BOOTARG_LEN; > caddr_t av = (caddr_t)BOOTARG_OFF; > - bios_consdev_t cd; > + bios_oconsdev_t cd; > extern int com_speed; /* from bioscons.c */ > extern int com_addr; > bios_ddb_t ddb; > diff --git sys/arch/amd64/stand/libsa/exec_i386.c > sys/arch/amd64/stand/libsa/exec_i386.c > index 22067931829..25d20d359c0 100644 > --- sys/arch/amd64/stand/libsa/exec_i386.c > +++ sys/arch/amd64/stand/libsa/exec_i386.c > @@ -91,7 +91,7 @@ run_loadfile(uint64_t *marks, int howto) > dev_t bootdev = bootdev_dip->bootdev; > size_t ac = BOOTARG_LEN; > caddr_t av = (caddr_t)BOOTARG_OFF; > - bios_consdev_t cd; > + bios_oconsdev_t cd; > extern int com_speed; /* from bioscons.c */ > extern int com_addr; > bios_ddb_t ddb;
Re: amd64 serial console changes
On 30.6.2022. 10:26, Mark Kettenis wrote: > Hi Hrvoje, > > I assume it was faster before? What hardware are you seeing this on? Hi, yes, it was faster before. dell r620 - serial console com1 at acpi0 COMA addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo com1: console com0 at acpi0 COMB addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo cat /etc/boot.conf stty com1 115200 set tty com1 /etc/ttys tty01 "/usr/libexec/getty std.115200" vt220 on secure dell r430 - ipmi console com0 at acpi0 COMA addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo com1 at acpi0 COMB addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo com1: console cat /etc/boot.conf stty com1 115200 set tty com1 /etc/ttys tty01 "/usr/libexec/getty std.115200" vt200 on secure supermicro - ipmi console com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo com1: console cat /etc/boot.conf stty com1 115200 set tty com1 /etc/ttys tty01 "/usr/libexec/getty std.115200" vt220 on secure will try now anton@ last diff ..
Re: amd64 serial console changes
On Thu, Jun 30, 2022 at 01:07:46PM +0200, Mark Kettenis wrote: > Ah right. Please commit! Here's the complete diff, ok? diff --git sys/arch/amd64/stand/efi32/exec_i386.c sys/arch/amd64/stand/efi32/exec_i386.c index 8349d97fefb..21f13cd273b 100644 --- sys/arch/amd64/stand/efi32/exec_i386.c +++ sys/arch/amd64/stand/efi32/exec_i386.c @@ -66,7 +66,7 @@ run_loadfile(uint64_t *marks, int howto) dev_t bootdev = bootdev_dip->bootdev; size_t ac = BOOTARG_LEN; caddr_t av = (caddr_t)BOOTARG_OFF; - bios_consdev_t cd; + bios_oconsdev_t cd; extern int com_speed; /* from bioscons.c */ extern int com_addr; bios_ddb_t ddb; diff --git sys/arch/amd64/stand/efi64/exec_i386.c sys/arch/amd64/stand/efi64/exec_i386.c index 48e460cb040..043193f93be 100644 --- sys/arch/amd64/stand/efi64/exec_i386.c +++ sys/arch/amd64/stand/efi64/exec_i386.c @@ -66,7 +66,7 @@ run_loadfile(uint64_t *marks, int howto) dev_t bootdev = bootdev_dip->bootdev; size_t ac = BOOTARG_LEN; caddr_t av = (caddr_t)BOOTARG_OFF; - bios_consdev_t cd; + bios_oconsdev_t cd; extern int com_speed; /* from bioscons.c */ extern int com_addr; bios_ddb_t ddb; diff --git sys/arch/amd64/stand/efiboot/exec_i386.c sys/arch/amd64/stand/efiboot/exec_i386.c index ea8fa67820b..70ff23c9d32 100644 --- sys/arch/amd64/stand/efiboot/exec_i386.c +++ sys/arch/amd64/stand/efiboot/exec_i386.c @@ -72,7 +72,7 @@ run_loadfile(uint64_t *marks, int howto) dev_t bootdev = bootdev_dip->bootdev; size_t ac = BOOTARG_LEN; caddr_t av = (caddr_t)BOOTARG_OFF; - bios_consdev_t cd; + bios_oconsdev_t cd; extern int com_speed; /* from bioscons.c */ extern int com_addr; bios_ddb_t ddb; diff --git sys/arch/amd64/stand/libsa/exec_i386.c sys/arch/amd64/stand/libsa/exec_i386.c index 22067931829..25d20d359c0 100644 --- sys/arch/amd64/stand/libsa/exec_i386.c +++ sys/arch/amd64/stand/libsa/exec_i386.c @@ -91,7 +91,7 @@ run_loadfile(uint64_t *marks, int howto) dev_t bootdev = bootdev_dip->bootdev; size_t ac = BOOTARG_LEN; caddr_t av = (caddr_t)BOOTARG_OFF; - bios_consdev_t cd; + bios_oconsdev_t cd; extern int com_speed; /* from bioscons.c */ extern int com_addr; bios_ddb_t ddb;
Re: amd64 serial console changes
Ah right. Please commit! > Op 30-06-2022 11:55 schreef Anton Lindqvist : > > > On Thu, Jun 30, 2022 at 08:52:33AM +0200, Hrvoje Popovski wrote: > > On 27.6.2022. 23:44, Mark Kettenis wrote: > > > The Ryzen Embedded V1000 processors have an arm64-style Synposys > > > DesignWare UART instead if a PC-compatible NS16x50 UART. To make this > > > UART work as a serial console, we need to pass some more information > > > from the bootloader to the kernel. This diff adds the logic to handle > > > that information to the kernel. I'd like some folks that use a serial > > > console on their amd64 machines to test this. But testing this diff > > > on amd64 machines with a glass console doesn't hurt. > > > > > > Thanks, > > > > > > Mark > > > > > > Hi, > > > > I've sysupgrade few boxes few minutes ago and booting output is quite > > slow. Everything is working but console output needs cca 2 or 3 minutes > > to finish depends how big is dmesg. > > > > I have few console over ipmi and few connected to serial and all of them > > are slow. > > > > When boot output finish working over console backs to normal fast output. > > I would guess the problem arises after running installboot causing the > new bios_consdev_t structure to be used, whereas only the fields in the > old bios_oconsdev_t structure are populated? Maybe the rename should > have been the other way around until the new structure is populated. > > This makes the boot output "fast" again on my machine. I missed > installboot while testing the original diff. > > diff --git sys/arch/amd64/stand/libsa/exec_i386.c > sys/arch/amd64/stand/libsa/exec_i386.c > index 22067931829..25d20d359c0 100644 > --- sys/arch/amd64/stand/libsa/exec_i386.c > +++ sys/arch/amd64/stand/libsa/exec_i386.c > @@ -91,7 +91,7 @@ run_loadfile(uint64_t *marks, int howto) > dev_t bootdev = bootdev_dip->bootdev; > size_t ac = BOOTARG_LEN; > caddr_t av = (caddr_t)BOOTARG_OFF; > - bios_consdev_t cd; > + bios_oconsdev_t cd; > extern int com_speed; /* from bioscons.c */ > extern int com_addr; > bios_ddb_t ddb;
Re: amd64 serial console changes
On Thu, Jun 30, 2022 at 08:52:33AM +0200, Hrvoje Popovski wrote: > On 27.6.2022. 23:44, Mark Kettenis wrote: > > The Ryzen Embedded V1000 processors have an arm64-style Synposys > > DesignWare UART instead if a PC-compatible NS16x50 UART. To make this > > UART work as a serial console, we need to pass some more information > > from the bootloader to the kernel. This diff adds the logic to handle > > that information to the kernel. I'd like some folks that use a serial > > console on their amd64 machines to test this. But testing this diff > > on amd64 machines with a glass console doesn't hurt. > > > > Thanks, > > > > Mark > > > Hi, > > I've sysupgrade few boxes few minutes ago and booting output is quite > slow. Everything is working but console output needs cca 2 or 3 minutes > to finish depends how big is dmesg. > > I have few console over ipmi and few connected to serial and all of them > are slow. > > When boot output finish working over console backs to normal fast output. I would guess the problem arises after running installboot causing the new bios_consdev_t structure to be used, whereas only the fields in the old bios_oconsdev_t structure are populated? Maybe the rename should have been the other way around until the new structure is populated. This makes the boot output "fast" again on my machine. I missed installboot while testing the original diff. diff --git sys/arch/amd64/stand/libsa/exec_i386.c sys/arch/amd64/stand/libsa/exec_i386.c index 22067931829..25d20d359c0 100644 --- sys/arch/amd64/stand/libsa/exec_i386.c +++ sys/arch/amd64/stand/libsa/exec_i386.c @@ -91,7 +91,7 @@ run_loadfile(uint64_t *marks, int howto) dev_t bootdev = bootdev_dip->bootdev; size_t ac = BOOTARG_LEN; caddr_t av = (caddr_t)BOOTARG_OFF; - bios_consdev_t cd; + bios_oconsdev_t cd; extern int com_speed; /* from bioscons.c */ extern int com_addr; bios_ddb_t ddb;
Re: amd64 serial console changes
Hi Hrvoje, I assume it was faster before? What hardware are you seeing this on? Thanks, Mark > Op 30-06-2022 08:52 schreef Hrvoje Popovski : > > > On 27.6.2022. 23:44, Mark Kettenis wrote: > > The Ryzen Embedded V1000 processors have an arm64-style Synposys > > DesignWare UART instead if a PC-compatible NS16x50 UART. To make this > > UART work as a serial console, we need to pass some more information > > from the bootloader to the kernel. This diff adds the logic to handle > > that information to the kernel. I'd like some folks that use a serial > > console on their amd64 machines to test this. But testing this diff > > on amd64 machines with a glass console doesn't hurt. > > > > Thanks, > > > > Mark > > > Hi, > > I've sysupgrade few boxes few minutes ago and booting output is quite > slow. Everything is working but console output needs cca 2 or 3 minutes > to finish depends how big is dmesg. > > I have few console over ipmi and few connected to serial and all of them > are slow. > > When boot output finish working over console backs to normal fast output.
Re: amd64 serial console changes
On 27.6.2022. 23:44, Mark Kettenis wrote: > The Ryzen Embedded V1000 processors have an arm64-style Synposys > DesignWare UART instead if a PC-compatible NS16x50 UART. To make this > UART work as a serial console, we need to pass some more information > from the bootloader to the kernel. This diff adds the logic to handle > that information to the kernel. I'd like some folks that use a serial > console on their amd64 machines to test this. But testing this diff > on amd64 machines with a glass console doesn't hurt. > > Thanks, > > Mark Hi, I've sysupgrade few boxes few minutes ago and booting output is quite slow. Everything is working but console output needs cca 2 or 3 minutes to finish depends how big is dmesg. I have few console over ipmi and few connected to serial and all of them are slow. When boot output finish working over console backs to normal fast output.
amd64 serial console changes
The Ryzen Embedded V1000 processors have an arm64-style Synposys DesignWare UART instead if a PC-compatible NS16x50 UART. To make this UART work as a serial console, we need to pass some more information from the bootloader to the kernel. This diff adds the logic to handle that information to the kernel. I'd like some folks that use a serial console on their amd64 machines to test this. But testing this diff on amd64 machines with a glass console doesn't hurt. Thanks, Mark Index: dev/acpi/com_acpi.c === RCS file: /cvs/src/sys/dev/acpi/com_acpi.c,v retrieving revision 1.8 diff -u -p -r1.8 com_acpi.c --- dev/acpi/com_acpi.c 6 Apr 2022 18:59:27 - 1.8 +++ dev/acpi/com_acpi.c 27 Jun 2022 21:42:08 - @@ -49,6 +49,7 @@ const struct cfattach com_acpi_ca = { }; const char *com_hids[] = { + "AMDI0020", "HISI0031", "PNP0501", NULL @@ -86,10 +87,14 @@ com_acpi_attach(struct device *parent, s printf(" addr 0x%llx/0x%llx", aaa->aaa_addr[0], aaa->aaa_size[0]); printf(" irq %d", aaa->aaa_irq[0]); + sc->sc.sc_frequency = COM_FREQ; + if (strcmp(aaa->aaa_dev, "AMDI0020") == 0) + sc->sc.sc_frequency = 4800; + sc->sc.sc_iot = aaa->aaa_bst[0]; sc->sc.sc_iobase = aaa->aaa_addr[0]; sc->sc.sc_frequency = acpi_getpropint(sc->sc_node, "clock-frequency", - COM_FREQ); + sc->sc.sc_frequency); if (com_acpi_is_designware(aaa->aaa_dev)) { intr = com_acpi_intr_designware; @@ -153,7 +158,8 @@ com_acpi_is_console(struct com_acpi_soft int com_acpi_is_designware(const char *hid) { - return strcmp("HISI0031", hid) == 0; + return strcmp(hid, "AMDI0020") == 0 || + strcmp(hid, "HISI0031") == 0; } int Index: arch/amd64/amd64/bus_space.c === RCS file: /cvs/src/sys/arch/amd64/amd64/bus_space.c,v retrieving revision 1.26 diff -u -p -r1.26 bus_space.c --- arch/amd64/amd64/bus_space.c25 Apr 2015 21:31:24 - 1.26 +++ arch/amd64/amd64/bus_space.c27 Jun 2022 21:42:09 - @@ -43,6 +43,8 @@ #include #include +extern int pmap_initialized; + /* * Extent maps to manage I/O and memory space. Allocate * storage for 16 regions in each, initially. Later, ioport_malloc_safe @@ -376,6 +378,11 @@ bus_space_map(bus_space_tag_t t, bus_add return(0); } + if (!pmap_initialized && bpa < 0x1) { + *bshp = (bus_space_handle_t)PMAP_DIRECT_MAP(bpa); + return(0); + } + /* * For memory space, map the bus physical address to * a kernel virtual address. @@ -585,6 +592,11 @@ bus_space_unmap(bus_space_tag_t t, bus_s bpa = (bus_addr_t)ISA_PHYSADDR(bsh); if (IOM_BEGIN <= bpa && bpa <= IOM_END) goto ok; + + if (bsh >= PMAP_DIRECT_BASE && bsh < PMAP_DIRECT_END) { + bpa = PMAP_DIRECT_UNMAP(bsh); + goto ok; + } va = trunc_page(bsh); endva = round_page(bsh + size); Index: arch/amd64/amd64/machdep.c === RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v retrieving revision 1.277 diff -u -p -r1.277 machdep.c --- arch/amd64/amd64/machdep.c 1 Feb 2022 20:29:53 - 1.277 +++ arch/amd64/amd64/machdep.c 27 Jun 2022 21:42:09 - @@ -1945,11 +1945,40 @@ getbootinfo(char *bootinfo, int bootinfo /* generated by i386 boot loader */ break; case BOOTARG_CONSDEV: - if (q->ba_size >= sizeof(bios_consdev_t) + + if (q->ba_size > sizeof(bios_oconsdev_t) + offsetof(struct _boot_args32, ba_arg)) { #if NCOM > 0 bios_consdev_t *cdp = (bios_consdev_t*)q->ba_arg; + static const int ports[] = + { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; + int unit = minor(cdp->consdev); + uint64_t consaddr = cdp->consaddr; + if (consaddr == -1 && unit >= 0 && + unit < nitems(ports)) + consaddr = ports[unit]; + if (major(cdp->consdev) == 8 && + consaddr != -1) { + comconsunit = unit; + comconsaddr = consaddr; + comconsrate = cdp->conspeed; + comconsfreq = cdp->consfreq; +