mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 07:15:58 +08:00
Update to FreeBSD head 2018-11-15
Git mirror commit a18b0830c4be01b39489a891b63d6023ada6358a. Update #3472.
This commit is contained in:
@@ -460,7 +460,13 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear)
|
||||
ntxd = scctx->isc_ntxd[0];
|
||||
do {
|
||||
delta = (int32_t)cur - (int32_t)prev;
|
||||
/*
|
||||
* XXX This appears to be a hack for first-packet.
|
||||
* A correct fix would prevent prev == cur in the first place.
|
||||
*/
|
||||
MPASS(prev == 0 || delta != 0);
|
||||
if (prev == 0 && cur == 0)
|
||||
delta += 1;
|
||||
if (delta < 0)
|
||||
delta += ntxd;
|
||||
DPRINTF(iflib_get_dev(adapter->ctx),
|
||||
|
@@ -335,7 +335,13 @@ igb_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear)
|
||||
ntxd = scctx->isc_ntxd[0];
|
||||
do {
|
||||
delta = (int32_t)cur - (int32_t)prev;
|
||||
/*
|
||||
* XXX This appears to be a hack for first-packet.
|
||||
* A correct fix would prevent prev == cur in the first place.
|
||||
*/
|
||||
MPASS(prev == 0 || delta != 0);
|
||||
if (prev == 0 && cur == 0)
|
||||
delta += 1;
|
||||
if (delta < 0)
|
||||
delta += ntxd;
|
||||
|
||||
|
@@ -351,6 +351,19 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
|
||||
if (client->ec_revoked || evdev == NULL)
|
||||
return (ENODEV);
|
||||
|
||||
/*
|
||||
* Fix evdev state corrupted with discarding of kdb events.
|
||||
* EVIOCGKEY and EVIOCGLED ioctls can suffer from this.
|
||||
*/
|
||||
if (evdev->ev_kdb_active) {
|
||||
EVDEV_LOCK(evdev);
|
||||
if (evdev->ev_kdb_active) {
|
||||
evdev->ev_kdb_active = false;
|
||||
evdev_restore_after_kdb(evdev);
|
||||
}
|
||||
EVDEV_UNLOCK(evdev);
|
||||
}
|
||||
|
||||
/* file I/O ioctl handling */
|
||||
switch (cmd) {
|
||||
case FIOSETOWN:
|
||||
|
@@ -34,9 +34,11 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/bitstring.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/kdb.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
@@ -769,6 +771,30 @@ evdev_send_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
evdev_restore_after_kdb(struct evdev_dev *evdev)
|
||||
{
|
||||
int code;
|
||||
|
||||
EVDEV_LOCK_ASSERT(evdev);
|
||||
|
||||
/* Report postponed leds */
|
||||
for (code = 0; code < LED_CNT; code++)
|
||||
if (bit_test(evdev->ev_kdb_led_states, code))
|
||||
evdev_send_event(evdev, EV_LED, code,
|
||||
!bit_test(evdev->ev_led_states, code));
|
||||
bit_nclear(evdev->ev_kdb_led_states, 0, LED_MAX);
|
||||
|
||||
/* Release stuck keys (CTRL + ALT + ESC) */
|
||||
evdev_stop_repeat(evdev);
|
||||
for (code = 0; code < KEY_CNT; code++) {
|
||||
if (bit_test(evdev->ev_key_states, code)) {
|
||||
evdev_send_event(evdev, EV_KEY, code, KEY_EVENT_UP);
|
||||
evdev_send_event(evdev, EV_SYN, SYN_REPORT, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
evdev_push_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
|
||||
int32_t value)
|
||||
@@ -777,8 +803,26 @@ evdev_push_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
|
||||
if (evdev_check_event(evdev, type, code, value) != 0)
|
||||
return (EINVAL);
|
||||
|
||||
/*
|
||||
* Discard all but LEDs kdb events as unrelated to userspace.
|
||||
* Aggregate LED updates and postpone reporting until kdb deactivation.
|
||||
*/
|
||||
if (kdb_active || SCHEDULER_STOPPED()) {
|
||||
evdev->ev_kdb_active = true;
|
||||
if (type == EV_LED)
|
||||
bit_set(evdev->ev_kdb_led_states,
|
||||
bit_test(evdev->ev_led_states, code) != value);
|
||||
return (0);
|
||||
}
|
||||
|
||||
EVDEV_ENTER(evdev);
|
||||
|
||||
/* Fix evdev state corrupted with discarding of kdb events */
|
||||
if (evdev->ev_kdb_active) {
|
||||
evdev->ev_kdb_active = false;
|
||||
evdev_restore_after_kdb(evdev);
|
||||
}
|
||||
|
||||
evdev_modify_event(evdev, type, code, &value);
|
||||
if (type == EV_SYN && code == SYN_REPORT &&
|
||||
bit_test(evdev->ev_flags, EVDEV_FLAG_MT_AUTOREL))
|
||||
|
@@ -117,6 +117,10 @@ struct evdev_dev
|
||||
bitstr_t bit_decl(ev_sw_states, SW_CNT);
|
||||
bool ev_report_opened;
|
||||
|
||||
/* KDB state: */
|
||||
bool ev_kdb_active;
|
||||
bitstr_t bit_decl(ev_kdb_led_states, LED_CNT);
|
||||
|
||||
/* Multitouch protocol type B state: */
|
||||
struct evdev_mt * ev_mt;
|
||||
|
||||
@@ -132,9 +136,14 @@ struct evdev_dev
|
||||
LIST_HEAD(, evdev_client) ev_clients;
|
||||
};
|
||||
|
||||
#define SYSTEM_CONSOLE_LOCK &Giant
|
||||
|
||||
#define EVDEV_LOCK(evdev) mtx_lock((evdev)->ev_lock)
|
||||
#define EVDEV_UNLOCK(evdev) mtx_unlock((evdev)->ev_lock)
|
||||
#define EVDEV_LOCK_ASSERT(evdev) mtx_assert((evdev)->ev_lock, MA_OWNED)
|
||||
#define EVDEV_LOCK_ASSERT(evdev) do { \
|
||||
if ((evdev)->ev_lock != SYSTEM_CONSOLE_LOCK) \
|
||||
mtx_assert((evdev)->ev_lock, MA_OWNED); \
|
||||
} while (0)
|
||||
#define EVDEV_ENTER(evdev) do { \
|
||||
if ((evdev)->ev_lock_type == EV_LOCK_INTERNAL) \
|
||||
EVDEV_LOCK(evdev); \
|
||||
@@ -185,6 +194,7 @@ int evdev_cdev_destroy(struct evdev_dev *);
|
||||
bool evdev_event_supported(struct evdev_dev *, uint16_t);
|
||||
void evdev_set_abs_bit(struct evdev_dev *, uint16_t);
|
||||
void evdev_set_absinfo(struct evdev_dev *, uint16_t, struct input_absinfo *);
|
||||
void evdev_restore_after_kdb(struct evdev_dev *);
|
||||
|
||||
/* Client interface: */
|
||||
int evdev_register_client(struct evdev_dev *, struct evdev_client *);
|
||||
|
@@ -1434,6 +1434,19 @@ dwc_otg_host_data_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
|
||||
goto receive_pkt;
|
||||
}
|
||||
} else if (td->ep_type == UE_ISOCHRONOUS) {
|
||||
if (td->hcsplt != 0) {
|
||||
/*
|
||||
* Sometimes the complete
|
||||
* split packet may be queued
|
||||
* too early and the
|
||||
* transaction translator will
|
||||
* return a NAK. Ignore
|
||||
* this message and retry the
|
||||
* complete split instead.
|
||||
*/
|
||||
DPRINTF("Retrying complete split\n");
|
||||
goto receive_pkt;
|
||||
}
|
||||
goto complete;
|
||||
}
|
||||
td->did_nak = 1;
|
||||
|
@@ -677,6 +677,8 @@ uhid_probe(device_t dev)
|
||||
{
|
||||
struct usb_attach_arg *uaa = device_get_ivars(dev);
|
||||
int error;
|
||||
void *buf;
|
||||
uint16_t len;
|
||||
|
||||
DPRINTFN(11, "\n");
|
||||
|
||||
@@ -703,6 +705,25 @@ uhid_probe(device_t dev)
|
||||
!usb_test_quirk(uaa, UQ_UMS_IGNORE))))
|
||||
return (ENXIO);
|
||||
|
||||
/* Check for mandatory multitouch usages to give wmt(4) a chance */
|
||||
if (!usb_test_quirk(uaa, UQ_WMT_IGNORE)) {
|
||||
error = usbd_req_get_hid_desc(uaa->device, NULL,
|
||||
&buf, &len, M_USBDEV, uaa->info.bIfaceIndex);
|
||||
/* Let HID decscriptor-less devices to be handled at attach */
|
||||
if (!error) {
|
||||
if (hid_locate(buf, len,
|
||||
HID_USAGE2(HUP_DIGITIZERS, HUD_CONTACT_MAX),
|
||||
hid_feature, 0, NULL, NULL, NULL) &&
|
||||
hid_locate(buf, len,
|
||||
HID_USAGE2(HUP_DIGITIZERS, HUD_CONTACTID),
|
||||
hid_input, 0, NULL, NULL, NULL)) {
|
||||
free(buf, M_USBDEV);
|
||||
return (ENXIO);
|
||||
}
|
||||
free(buf, M_USBDEV);
|
||||
}
|
||||
}
|
||||
|
||||
return (BUS_PROBE_GENERIC);
|
||||
}
|
||||
|
||||
|
@@ -1363,7 +1363,7 @@ ukbd_attach(device_t dev)
|
||||
if (sc->sc_flags & UKBD_FLAG_SCROLLLOCK)
|
||||
evdev_support_led(evdev, LED_SCROLLL);
|
||||
|
||||
if (evdev_register(evdev))
|
||||
if (evdev_register_mtx(evdev, &Giant))
|
||||
evdev_free(evdev);
|
||||
else
|
||||
sc->sc_evdev = evdev;
|
||||
|
Reference in New Issue
Block a user