aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board-qemu/slof/virtio-serial.fs12
1 files changed, 5 insertions, 7 deletions
diff --git a/board-qemu/slof/virtio-serial.fs b/board-qemu/slof/virtio-serial.fs
index 41e2e04..de42cc7 100644
--- a/board-qemu/slof/virtio-serial.fs
+++ b/board-qemu/slof/virtio-serial.fs
@@ -33,16 +33,14 @@ 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
+ \ virtiodev must be shutdown at quiesce so the device is reset properly.
+ \ The read and write methods can be called after quiesce so must handle
+ \ virtiodev being closed.
+ ['] shutdown add-quiesce-xt
;
0 VALUE open-count
@@ -62,8 +60,8 @@ virtiodev virtio-serial-init drop
open-count 0> IF
open-count 1 - dup to open-count
0= IF shutdown THEN
+ close
THEN
- close
;
: write ( addr len -- actual )