| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: hvkbd.c,v 1.6 2019/11/22 12:40:07 nonaka Exp $ */ | | 1 | /* $NetBSD: hvkbd.c,v 1.7 2021/01/29 04:38:18 nonaka Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2017 Microsoft Corp. | | 4 | * Copyright (c) 2017 Microsoft Corp. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice unmodified, this list of conditions, and the following | | 11 | * notice unmodified, this list of conditions, and the following |
12 | * disclaimer. | | 12 | * disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -26,27 +26,27 @@ | | | @@ -26,27 +26,27 @@ |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | * | | 27 | * |
28 | * $FreeBSD: head/sys/dev/hyperv/input/hv_kbd.c 317821 2017-05-05 03:28:30Z sephe $ | | 28 | * $FreeBSD: head/sys/dev/hyperv/input/hv_kbd.c 317821 2017-05-05 03:28:30Z sephe $ |
29 | * $FreeBSD: head/sys/dev/hyperv/input/hv_kbdc.c 320490 2017-06-30 03:01:22Z sephe $ | | 29 | * $FreeBSD: head/sys/dev/hyperv/input/hv_kbdc.c 320490 2017-06-30 03:01:22Z sephe $ |
30 | * $FreeBSD: head/sys/dev/hyperv/input/hv_kbdc.h 316515 2017-04-05 05:01:23Z sephe $ | | 30 | * $FreeBSD: head/sys/dev/hyperv/input/hv_kbdc.h 316515 2017-04-05 05:01:23Z sephe $ |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #ifdef _KERNEL_OPT | | 33 | #ifdef _KERNEL_OPT |
34 | #include "opt_pckbd_layout.h" | | 34 | #include "opt_pckbd_layout.h" |
35 | #include "opt_wsdisplay_compat.h" | | 35 | #include "opt_wsdisplay_compat.h" |
36 | #endif /* _KERNEL_OPT */ | | 36 | #endif /* _KERNEL_OPT */ |
37 | | | 37 | |
38 | #include <sys/cdefs.h> | | 38 | #include <sys/cdefs.h> |
39 | __KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.6 2019/11/22 12:40:07 nonaka Exp $"); | | 39 | __KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.7 2021/01/29 04:38:18 nonaka Exp $"); |
40 | | | 40 | |
41 | #include <sys/param.h> | | 41 | #include <sys/param.h> |
42 | #include <sys/systm.h> | | 42 | #include <sys/systm.h> |
43 | #include <sys/device.h> | | 43 | #include <sys/device.h> |
44 | #include <sys/mutex.h> | | 44 | #include <sys/mutex.h> |
45 | #include <sys/kernel.h> | | 45 | #include <sys/kernel.h> |
46 | #include <sys/kmem.h> | | 46 | #include <sys/kmem.h> |
47 | #include <sys/module.h> | | 47 | #include <sys/module.h> |
48 | #include <sys/pmf.h> | | 48 | #include <sys/pmf.h> |
49 | #include <sys/proc.h> | | 49 | #include <sys/proc.h> |
50 | #include <sys/queue.h> | | 50 | #include <sys/queue.h> |
51 | | | 51 | |
52 | #include <dev/hyperv/vmbusvar.h> | | 52 | #include <dev/hyperv/vmbusvar.h> |
| @@ -340,27 +340,28 @@ hvkbd_connect(struct hvkbd_softc *sc) | | | @@ -340,27 +340,28 @@ hvkbd_connect(struct hvkbd_softc *sc) |
340 | if (error) { | | 340 | if (error) { |
341 | aprint_error_dev(sc->sc_dev, "failed to send connect: %d\n", | | 341 | aprint_error_dev(sc->sc_dev, "failed to send connect: %d\n", |
342 | error); | | 342 | error); |
343 | return error; | | 343 | return error; |
344 | } | | 344 | } |
345 | | | 345 | |
346 | do { | | 346 | do { |
347 | if (cold) { | | 347 | if (cold) { |
348 | delay(1000); | | 348 | delay(1000); |
349 | s = spltty(); | | 349 | s = spltty(); |
350 | hvkbd_intr(sc); | | 350 | hvkbd_intr(sc); |
351 | splx(s); | | 351 | splx(s); |
352 | } else | | 352 | } else |
353 | tsleep(sc, PRIBIO | PCATCH, "hvkbdcon", mstohz(1)); | | 353 | tsleep(sc, PRIBIO | PCATCH, "hvkbdcon", |
| | | 354 | uimax(1, mstohz(1))); |
354 | } while (--timo > 0 && sc->sc_connected == 0); | | 355 | } while (--timo > 0 && sc->sc_connected == 0); |
355 | | | 356 | |
356 | if (timo == 0 && sc->sc_connected == 0) { | | 357 | if (timo == 0 && sc->sc_connected == 0) { |
357 | aprint_error_dev(sc->sc_dev, "connect timed out\n"); | | 358 | aprint_error_dev(sc->sc_dev, "connect timed out\n"); |
358 | return ETIMEDOUT; | | 359 | return ETIMEDOUT; |
359 | } | | 360 | } |
360 | | | 361 | |
361 | if (!(sc->sc_connect_status & RESP_STATUS_ACCEPTED)) { | | 362 | if (!(sc->sc_connect_status & RESP_STATUS_ACCEPTED)) { |
362 | aprint_error_dev(sc->sc_dev, "protocol request failed\n"); | | 363 | aprint_error_dev(sc->sc_dev, "protocol request failed\n"); |
363 | return ENODEV; | | 364 | return ENODEV; |
364 | } | | 365 | } |
365 | | | 366 | |
366 | return 0; | | 367 | return 0; |