diff --git a/board-qemu/slof/virtio-serial.fs b/board-qemu/slof/virtio-serial.fs index ac55ffc..06bfe76 100644 --- a/board-qemu/slof/virtio-serial.fs +++ b/board-qemu/slof/virtio-serial.fs @@ -19,9 +19,11 @@ virtio-setup-vd VALUE virtiodev \ Quiescence the virtqueue of this device so that no more background \ transactions can be pending. : shutdown ( -- ) - virtiodev virtio-serial-shutdown - FALSE to initialized? - 0 to virtiodev + initialized? IF + virtiodev virtio-serial-shutdown + FALSE to initialized? + 0 to virtiodev + THEN ; : virtio-serial-term-emit @@ -31,10 +33,16 @@ virtio-setup-vd VALUE virtiodev : virtio-serial-term-key? virtiodev virtio-serial-haschar ; : virtio-serial-term-key BEGIN virtio-serial-term-key? UNTIL virtiodev virtio-serial-getchar ; +: virtio-serial-close-stdout s" stdout" get-chosen IF decode-int nip nip close-dev THEN ; + \ Basic device initialization - which has only to be done once : init ( -- ) virtiodev virtio-serial-init drop TRUE to initialized? + \ Linux closes stdin at some point in prom_init(). This internally triggers a + \ quiesce in SLOF. We must ensure stdout gets closed as well otherwise the + \ device cannot be reset properly and the boot will hang. + ['] virtio-serial-close-stdout add-quiesce-xt ; 0 VALUE open-count diff --git a/slof/fs/client.fs b/slof/fs/client.fs index 76231f9..db7a192 100644 --- a/slof/fs/client.fs +++ b/slof/fs/client.fs @@ -203,11 +203,6 @@ ALSO client-voc DEFINITIONS \ End of life of SLOF now, call platform quiesce as quiesce \ is an undocumented extension and not everybody supports it close-dev - \ Some device, eg. virtio-serial, need all instances to be - \ closed in order to be reset properly - s" stdout" get-chosen IF - decode-int nip nip close-dev - THEN quiesce ELSE close-dev