mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-12-17' into staging
* Removal of the deprecated bluetooth code * Some qtest and misc patches # gpg: Signature made Tue 17 Dec 2019 08:09:08 GMT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * remotes/huth-gitlab/tags/pull-request-2019-12-17: tests: use g_test_rand_int tests/Makefile: Fix check-report.* targets shown in check-help glib: use portable g_setenv() hw/misc/ivshmem: Bury dead legacy INTx code pseries: disable migration-test if /dev/kvm cannot be used tests: fix modules-test 'duplicate test case' error Remove libbluetooth / bluez from the CI tests Remove the core bluetooth code hw/usb: Remove the USB bluetooth dongle device hw/arm/nseries: Replace the bluetooth chardev with a "null" chardev Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ build-disabled:
|
||||
|
||||
build-tcg-disabled:
|
||||
script:
|
||||
- apt-get install -y -qq clang libgtk-3-dev libbluetooth-dev libusb-dev
|
||||
- apt-get install -y -qq clang libgtk-3-dev libusb-dev
|
||||
- ./configure --cc=clang --enable-werror --disable-tcg --audio-drv-list=""
|
||||
- make -j2
|
||||
- make check-unit
|
||||
|
||||
@@ -65,8 +65,6 @@ common-obj-y += replay/
|
||||
|
||||
common-obj-y += ui/
|
||||
common-obj-m += ui/
|
||||
common-obj-y += bt-host.o bt-vhci.o
|
||||
bt-host.o-cflags := $(BLUEZ_CFLAGS)
|
||||
|
||||
common-obj-y += dma-helpers.o
|
||||
common-obj-y += vl.o
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
/*
|
||||
* Wrap a host Bluetooth HCI socket in a struct HCIInfo.
|
||||
*
|
||||
* Copyright (C) 2008 Andrzej Zaborowski <balrog@zabor.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 or
|
||||
* (at your option) version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "sysemu/bt.h"
|
||||
#include "qemu/main-loop.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <sys/ioctl.h>
|
||||
# include <sys/uio.h>
|
||||
# ifdef CONFIG_BLUEZ
|
||||
# include <bluetooth/bluetooth.h>
|
||||
# include <bluetooth/hci.h>
|
||||
# include <bluetooth/hci_lib.h>
|
||||
# else
|
||||
# include "hw/bt.h"
|
||||
# define HCI_MAX_FRAME_SIZE 1028
|
||||
# endif
|
||||
|
||||
struct bt_host_hci_s {
|
||||
struct HCIInfo hci;
|
||||
int fd;
|
||||
|
||||
uint8_t hdr[HCI_MAX_FRAME_SIZE];
|
||||
int len;
|
||||
};
|
||||
|
||||
static void bt_host_send(struct HCIInfo *hci,
|
||||
int type, const uint8_t *data, int len)
|
||||
{
|
||||
struct bt_host_hci_s *s = (struct bt_host_hci_s *) hci;
|
||||
uint8_t pkt = type;
|
||||
struct iovec iv[2];
|
||||
|
||||
iv[0].iov_base = (void *)&pkt;
|
||||
iv[0].iov_len = 1;
|
||||
iv[1].iov_base = (void *) data;
|
||||
iv[1].iov_len = len;
|
||||
|
||||
while (writev(s->fd, iv, 2) < 0) {
|
||||
if (errno != EAGAIN && errno != EINTR) {
|
||||
fprintf(stderr, "qemu: error %i writing bluetooth packet.\n",
|
||||
errno);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void bt_host_cmd(struct HCIInfo *hci, const uint8_t *data, int len)
|
||||
{
|
||||
bt_host_send(hci, HCI_COMMAND_PKT, data, len);
|
||||
}
|
||||
|
||||
static void bt_host_acl(struct HCIInfo *hci, const uint8_t *data, int len)
|
||||
{
|
||||
bt_host_send(hci, HCI_ACLDATA_PKT, data, len);
|
||||
}
|
||||
|
||||
static void bt_host_sco(struct HCIInfo *hci, const uint8_t *data, int len)
|
||||
{
|
||||
bt_host_send(hci, HCI_SCODATA_PKT, data, len);
|
||||
}
|
||||
|
||||
static void bt_host_read(void *opaque)
|
||||
{
|
||||
struct bt_host_hci_s *s = (struct bt_host_hci_s *) opaque;
|
||||
uint8_t *pkt;
|
||||
int pktlen;
|
||||
|
||||
/* Seems that we can't read only the header first and then the amount
|
||||
* of data indicated in the header because Linux will discard everything
|
||||
* that's not been read in one go. */
|
||||
s->len = read(s->fd, s->hdr, sizeof(s->hdr));
|
||||
|
||||
if (s->len < 0) {
|
||||
fprintf(stderr, "qemu: error %i reading HCI frame\n", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
pkt = s->hdr;
|
||||
while (s->len --)
|
||||
switch (*pkt ++) {
|
||||
case HCI_EVENT_PKT:
|
||||
if (s->len < 2)
|
||||
goto bad_pkt;
|
||||
|
||||
pktlen = MIN(pkt[1] + 2, s->len);
|
||||
s->hci.evt_recv(s->hci.opaque, pkt, pktlen);
|
||||
s->len -= pktlen;
|
||||
pkt += pktlen;
|
||||
|
||||
/* TODO: if this is an Inquiry Result event, it's also
|
||||
* interpreted by Linux kernel before we received it, possibly
|
||||
* we should clean the kernel Inquiry cache through
|
||||
* ioctl(s->fd, HCI_INQUIRY, ...). */
|
||||
break;
|
||||
|
||||
case HCI_ACLDATA_PKT:
|
||||
if (s->len < 4)
|
||||
goto bad_pkt;
|
||||
|
||||
pktlen = MIN(((pkt[3] << 8) | pkt[2]) + 4, s->len);
|
||||
s->hci.acl_recv(s->hci.opaque, pkt, pktlen);
|
||||
s->len -= pktlen;
|
||||
pkt += pktlen;
|
||||
break;
|
||||
|
||||
case HCI_SCODATA_PKT:
|
||||
if (s->len < 3)
|
||||
goto bad_pkt;
|
||||
|
||||
pktlen = MIN(pkt[2] + 3, s->len);
|
||||
s->len -= pktlen;
|
||||
pkt += pktlen;
|
||||
break;
|
||||
|
||||
default:
|
||||
bad_pkt:
|
||||
fprintf(stderr, "qemu: bad HCI packet type %02x\n", pkt[-1]);
|
||||
}
|
||||
}
|
||||
|
||||
static int bt_host_bdaddr_set(struct HCIInfo *hci, const uint8_t *bd_addr)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
struct HCIInfo *bt_host_hci(const char *id)
|
||||
{
|
||||
struct bt_host_hci_s *s;
|
||||
int fd = -1;
|
||||
# ifdef CONFIG_BLUEZ
|
||||
int dev_id = hci_devid(id);
|
||||
struct hci_filter flt;
|
||||
|
||||
if (dev_id < 0) {
|
||||
fprintf(stderr, "qemu: `%s' not available\n", id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fd = hci_open_dev(dev_id);
|
||||
|
||||
/* XXX: can we ensure nobody else has the device opened? */
|
||||
# endif
|
||||
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "qemu: Can't open `%s': %s (%i)\n",
|
||||
id, strerror(errno), errno);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
# ifdef CONFIG_BLUEZ
|
||||
hci_filter_clear(&flt);
|
||||
hci_filter_all_ptypes(&flt);
|
||||
hci_filter_all_events(&flt);
|
||||
|
||||
if (qemu_setsockopt(fd, SOL_HCI, HCI_FILTER, &flt, sizeof(flt)) < 0) {
|
||||
fprintf(stderr, "qemu: Can't set HCI filter on socket (%i)\n", errno);
|
||||
return 0;
|
||||
}
|
||||
# endif
|
||||
|
||||
s = g_malloc0(sizeof(struct bt_host_hci_s));
|
||||
s->fd = fd;
|
||||
s->hci.cmd_send = bt_host_cmd;
|
||||
s->hci.sco_send = bt_host_sco;
|
||||
s->hci.acl_send = bt_host_acl;
|
||||
s->hci.bdaddr_set = bt_host_bdaddr_set;
|
||||
|
||||
qemu_set_fd_handler(s->fd, bt_host_read, NULL, s);
|
||||
|
||||
return &s->hci;
|
||||
}
|
||||
#else
|
||||
struct HCIInfo *bt_host_hci(const char *id)
|
||||
{
|
||||
fprintf(stderr, "qemu: bluetooth passthrough not supported (yet)\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -1,167 +0,0 @@
|
||||
/*
|
||||
* Support for host VHCIs inside qemu scatternets.
|
||||
*
|
||||
* Copyright (C) 2008 Andrzej Zaborowski <balrog@zabor.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 or
|
||||
* (at your option) version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "sysemu/bt.h"
|
||||
#include "hw/bt.h"
|
||||
#include "qemu/main-loop.h"
|
||||
|
||||
#define VHCI_DEV "/dev/vhci"
|
||||
#define VHCI_UDEV "/dev/hci_vhci"
|
||||
|
||||
struct bt_vhci_s {
|
||||
int fd;
|
||||
struct HCIInfo *info;
|
||||
|
||||
uint8_t hdr[4096];
|
||||
int len;
|
||||
};
|
||||
|
||||
static void vhci_read(void *opaque)
|
||||
{
|
||||
struct bt_vhci_s *s = (struct bt_vhci_s *) opaque;
|
||||
uint8_t *pkt;
|
||||
int pktlen;
|
||||
|
||||
/* Seems that we can't read only the header first and then the amount
|
||||
* of data indicated in the header because Linux will discard everything
|
||||
* that's not been read in one go. */
|
||||
s->len = read(s->fd, s->hdr, sizeof(s->hdr));
|
||||
|
||||
if (s->len < 0) {
|
||||
fprintf(stderr, "qemu: error %i reading the PDU\n", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
pkt = s->hdr;
|
||||
while (s->len --)
|
||||
switch (*pkt ++) {
|
||||
case HCI_COMMAND_PKT:
|
||||
if (s->len < 3)
|
||||
goto bad_pkt;
|
||||
|
||||
pktlen = MIN(pkt[2] + 3, s->len);
|
||||
s->info->cmd_send(s->info, pkt, pktlen);
|
||||
s->len -= pktlen;
|
||||
pkt += pktlen;
|
||||
break;
|
||||
|
||||
case HCI_ACLDATA_PKT:
|
||||
if (s->len < 4)
|
||||
goto bad_pkt;
|
||||
|
||||
pktlen = MIN(((pkt[3] << 8) | pkt[2]) + 4, s->len);
|
||||
s->info->acl_send(s->info, pkt, pktlen);
|
||||
s->len -= pktlen;
|
||||
pkt += pktlen;
|
||||
break;
|
||||
|
||||
case HCI_SCODATA_PKT:
|
||||
if (s->len < 3)
|
||||
goto bad_pkt;
|
||||
|
||||
pktlen = MIN(pkt[2] + 3, s->len);
|
||||
s->info->sco_send(s->info, pkt, pktlen);
|
||||
s->len -= pktlen;
|
||||
pkt += pktlen;
|
||||
break;
|
||||
|
||||
default:
|
||||
bad_pkt:
|
||||
fprintf(stderr, "qemu: bad HCI packet type %02x\n", pkt[-1]);
|
||||
}
|
||||
}
|
||||
|
||||
static void vhci_host_send(void *opaque,
|
||||
int type, const uint8_t *data, int len)
|
||||
{
|
||||
struct bt_vhci_s *s = (struct bt_vhci_s *) opaque;
|
||||
#if 0
|
||||
uint8_t pkt = type;
|
||||
struct iovec iv[2];
|
||||
|
||||
iv[0].iov_base = &pkt;
|
||||
iv[0].iov_len = 1;
|
||||
iv[1].iov_base = (void *) data;
|
||||
iv[1].iov_len = len;
|
||||
|
||||
while (writev(s->fd, iv, 2) < 0)
|
||||
if (errno != EAGAIN && errno != EINTR) {
|
||||
fprintf(stderr, "qemu: error %i writing bluetooth packet.\n",
|
||||
errno);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
/* Apparently VHCI wants us to write everything in one chunk :-( */
|
||||
static uint8_t buf[4096];
|
||||
|
||||
buf[0] = type;
|
||||
memcpy(buf + 1, data, len);
|
||||
|
||||
while (write(s->fd, buf, len + 1) < 0)
|
||||
if (errno != EAGAIN && errno != EINTR) {
|
||||
fprintf(stderr, "qemu: error %i writing bluetooth packet.\n",
|
||||
errno);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void vhci_out_hci_packet_event(void *opaque,
|
||||
const uint8_t *data, int len)
|
||||
{
|
||||
vhci_host_send(opaque, HCI_EVENT_PKT, data, len);
|
||||
}
|
||||
|
||||
static void vhci_out_hci_packet_acl(void *opaque,
|
||||
const uint8_t *data, int len)
|
||||
{
|
||||
vhci_host_send(opaque, HCI_ACLDATA_PKT, data, len);
|
||||
}
|
||||
|
||||
void bt_vhci_init(struct HCIInfo *info)
|
||||
{
|
||||
struct bt_vhci_s *s;
|
||||
int err[2];
|
||||
int fd;
|
||||
|
||||
fd = open(VHCI_DEV, O_RDWR);
|
||||
err[0] = errno;
|
||||
if (fd < 0) {
|
||||
fd = open(VHCI_UDEV, O_RDWR);
|
||||
err[1] = errno;
|
||||
}
|
||||
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "qemu: Can't open `%s': %s (%i)\n",
|
||||
VHCI_DEV, strerror(err[0]), err[0]);
|
||||
fprintf(stderr, "qemu: Can't open `%s': %s (%i)\n",
|
||||
VHCI_UDEV, strerror(err[1]), err[1]);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
s = g_malloc0(sizeof(struct bt_vhci_s));
|
||||
s->fd = fd;
|
||||
s->info = info ?: qemu_next_hci();
|
||||
s->info->opaque = s;
|
||||
s->info->evt_recv = vhci_out_hci_packet_event;
|
||||
s->info->acl_recv = vhci_out_hci_packet_acl;
|
||||
|
||||
qemu_set_fd_handler(s->fd, vhci_read, NULL, s);
|
||||
}
|
||||
@@ -349,7 +349,6 @@ unset target_list_exclude
|
||||
# Distributions want to ensure that several features are compiled in, and it
|
||||
# is impossible without a --enable-foo that exits if a feature is not found.
|
||||
|
||||
bluez=""
|
||||
brlapi=""
|
||||
curl=""
|
||||
curses=""
|
||||
@@ -1151,10 +1150,6 @@ for opt do
|
||||
;;
|
||||
--enable-brlapi) brlapi="yes"
|
||||
;;
|
||||
--disable-bluez) bluez="no"
|
||||
;;
|
||||
--enable-bluez) bluez="yes"
|
||||
;;
|
||||
--disable-kvm) kvm="no"
|
||||
;;
|
||||
--enable-kvm) kvm="yes"
|
||||
@@ -1762,7 +1757,6 @@ disabled with --disable-FEATURE, default is enabled if available:
|
||||
curl curl connectivity
|
||||
membarrier membarrier system call (for Linux 4.14+ or Windows)
|
||||
fdt fdt device tree
|
||||
bluez bluez stack connectivity
|
||||
kvm KVM acceleration support
|
||||
hax HAX acceleration support
|
||||
hvf Hypervisor.framework acceleration support
|
||||
@@ -3665,26 +3659,6 @@ EOF
|
||||
fi
|
||||
fi # test "$curl"
|
||||
|
||||
##########################################
|
||||
# bluez support probe
|
||||
if test "$bluez" != "no" ; then
|
||||
cat > $TMPC << EOF
|
||||
#include <bluetooth/bluetooth.h>
|
||||
int main(void) { return bt_error(0); }
|
||||
EOF
|
||||
bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null)
|
||||
bluez_libs=$($pkg_config --libs bluez 2>/dev/null)
|
||||
if compile_prog "$bluez_cflags" "$bluez_libs" ; then
|
||||
bluez=yes
|
||||
libs_softmmu="$bluez_libs $libs_softmmu"
|
||||
else
|
||||
if test "$bluez" = "yes" ; then
|
||||
feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
|
||||
fi
|
||||
bluez="no"
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# glib support probe
|
||||
|
||||
@@ -6493,7 +6467,6 @@ if test "$xen" = "yes" ; then
|
||||
echo "xen ctrl version $xen_ctrl_version"
|
||||
fi
|
||||
echo "brlapi support $brlapi"
|
||||
echo "bluez support $bluez"
|
||||
echo "Documentation $docs"
|
||||
echo "PIE $pie"
|
||||
echo "vde support $vde"
|
||||
@@ -6917,10 +6890,6 @@ if test "$brlapi" = "yes" ; then
|
||||
echo "CONFIG_BRLAPI=y" >> $config_host_mak
|
||||
echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
|
||||
fi
|
||||
if test "$bluez" = "yes" ; then
|
||||
echo "CONFIG_BLUEZ=y" >> $config_host_mak
|
||||
echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
|
||||
fi
|
||||
if test "$gtk" = "yes" ; then
|
||||
echo "CONFIG_GTK=m" >> $config_host_mak
|
||||
echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
|
||||
|
||||
@@ -4,7 +4,6 @@ source acpi/Kconfig
|
||||
source adc/Kconfig
|
||||
source audio/Kconfig
|
||||
source block/Kconfig
|
||||
source bt/Kconfig
|
||||
source char/Kconfig
|
||||
source core/Kconfig
|
||||
source display/Kconfig
|
||||
|
||||
@@ -5,7 +5,6 @@ devices-dirs-y += acpi/
|
||||
devices-dirs-y += adc/
|
||||
devices-dirs-y += audio/
|
||||
devices-dirs-y += block/
|
||||
devices-dirs-y += bt/
|
||||
devices-dirs-y += char/
|
||||
devices-dirs-y += cpu/
|
||||
devices-dirs-y += display/
|
||||
|
||||
+7
-9
@@ -21,6 +21,7 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "cpu.h"
|
||||
#include "chardev/char.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/bswap.h"
|
||||
#include "sysemu/reset.h"
|
||||
@@ -39,7 +40,6 @@
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/block/flash.h"
|
||||
#include "hw/hw.h"
|
||||
#include "hw/bt.h"
|
||||
#include "hw/loader.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "qemu/log.h"
|
||||
@@ -792,13 +792,11 @@ static void n8x0_cbus_setup(struct n800_s *s)
|
||||
|
||||
static void n8x0_uart_setup(struct n800_s *s)
|
||||
{
|
||||
Chardev *radio = uart_hci_init();
|
||||
|
||||
qdev_connect_gpio_out(s->mpu->gpio, N8X0_BT_RESET_GPIO,
|
||||
csrhci_pins_get(radio)[csrhci_pin_reset]);
|
||||
qdev_connect_gpio_out(s->mpu->gpio, N8X0_BT_WKUP_GPIO,
|
||||
csrhci_pins_get(radio)[csrhci_pin_wakeup]);
|
||||
|
||||
Chardev *radio = qemu_chr_new("bt-dummy-uart", "null", NULL);
|
||||
/*
|
||||
* Note: We used to connect N8X0_BT_RESET_GPIO and N8X0_BT_WKUP_GPIO
|
||||
* here, but this code has been removed with the bluetooth backend.
|
||||
*/
|
||||
omap_uart_attach(s->mpu->uart[BT_UART], radio);
|
||||
}
|
||||
|
||||
@@ -1137,7 +1135,7 @@ static struct omap_partition_info_s {
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
static bdaddr_t n8x0_bd_addr = {{ N8X0_BD_ADDR }};
|
||||
static uint8_t n8x0_bd_addr[6] = { N8X0_BD_ADDR };
|
||||
|
||||
static int n8x0_atag_setup(void *p, int model)
|
||||
{
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
config BLUETOOTH
|
||||
bool
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
common-obj-y += core.o l2cap.o sdp.o hci.o hid.o
|
||||
common-obj-y += hci-csr.o
|
||||
|
||||
-143
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
* Convenience functions for bluetooth.
|
||||
*
|
||||
* Copyright (C) 2008 Andrzej Zaborowski <balrog@zabor.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 or
|
||||
* (at your option) version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/bt.h"
|
||||
#include "hw/bt.h"
|
||||
|
||||
/* Slave implementations can ignore this */
|
||||
static void bt_dummy_lmp_mode_change(struct bt_link_s *link)
|
||||
{
|
||||
}
|
||||
|
||||
/* Slaves should never receive these PDUs */
|
||||
static void bt_dummy_lmp_connection_complete(struct bt_link_s *link)
|
||||
{
|
||||
if (link->slave->reject_reason)
|
||||
error_report("%s: stray LMP_not_accepted received, fixme", __func__);
|
||||
else
|
||||
error_report("%s: stray LMP_accepted received, fixme", __func__);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
static void bt_dummy_lmp_disconnect_master(struct bt_link_s *link)
|
||||
{
|
||||
error_report("%s: stray LMP_detach received, fixme", __func__);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
static void bt_dummy_lmp_acl_resp(struct bt_link_s *link,
|
||||
const uint8_t *data, int start, int len)
|
||||
{
|
||||
error_report("%s: stray ACL response PDU, fixme", __func__);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Slaves that don't hold any additional per link state can use these */
|
||||
static void bt_dummy_lmp_connection_request(struct bt_link_s *req)
|
||||
{
|
||||
struct bt_link_s *link = g_malloc0(sizeof(struct bt_link_s));
|
||||
|
||||
link->slave = req->slave;
|
||||
link->host = req->host;
|
||||
|
||||
req->host->reject_reason = 0;
|
||||
req->host->lmp_connection_complete(link);
|
||||
}
|
||||
|
||||
static void bt_dummy_lmp_disconnect_slave(struct bt_link_s *link)
|
||||
{
|
||||
g_free(link);
|
||||
}
|
||||
|
||||
static void bt_dummy_destroy(struct bt_device_s *device)
|
||||
{
|
||||
bt_device_done(device);
|
||||
g_free(device);
|
||||
}
|
||||
|
||||
static int bt_dev_idx = 0;
|
||||
|
||||
void bt_device_init(struct bt_device_s *dev, struct bt_scatternet_s *net)
|
||||
{
|
||||
memset(dev, 0, sizeof(*dev));
|
||||
dev->inquiry_scan = 1;
|
||||
dev->page_scan = 1;
|
||||
|
||||
dev->bd_addr.b[0] = bt_dev_idx & 0xff;
|
||||
dev->bd_addr.b[1] = bt_dev_idx >> 8;
|
||||
dev->bd_addr.b[2] = 0xd0;
|
||||
dev->bd_addr.b[3] = 0xba;
|
||||
dev->bd_addr.b[4] = 0xbe;
|
||||
dev->bd_addr.b[5] = 0xba;
|
||||
bt_dev_idx ++;
|
||||
|
||||
/* Simple slave-only devices need to implement only .lmp_acl_data */
|
||||
dev->lmp_connection_complete = bt_dummy_lmp_connection_complete;
|
||||
dev->lmp_disconnect_master = bt_dummy_lmp_disconnect_master;
|
||||
dev->lmp_acl_resp = bt_dummy_lmp_acl_resp;
|
||||
dev->lmp_mode_change = bt_dummy_lmp_mode_change;
|
||||
dev->lmp_connection_request = bt_dummy_lmp_connection_request;
|
||||
dev->lmp_disconnect_slave = bt_dummy_lmp_disconnect_slave;
|
||||
|
||||
dev->handle_destroy = bt_dummy_destroy;
|
||||
|
||||
dev->net = net;
|
||||
dev->next = net->slave;
|
||||
net->slave = dev;
|
||||
}
|
||||
|
||||
void bt_device_done(struct bt_device_s *dev)
|
||||
{
|
||||
struct bt_device_s **p = &dev->net->slave;
|
||||
|
||||
while (*p && *p != dev)
|
||||
p = &(*p)->next;
|
||||
if (*p != dev) {
|
||||
error_report("%s: bad bt device \"%s\"", __func__,
|
||||
dev->lmp_name ?: "(null)");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
*p = dev->next;
|
||||
}
|
||||
|
||||
static struct bt_vlan_s {
|
||||
struct bt_scatternet_s net;
|
||||
int id;
|
||||
struct bt_vlan_s *next;
|
||||
} *first_bt_vlan;
|
||||
|
||||
/* find or alloc a new bluetooth "VLAN" */
|
||||
struct bt_scatternet_s *qemu_find_bt_vlan(int id)
|
||||
{
|
||||
struct bt_vlan_s **pvlan, *vlan;
|
||||
for (vlan = first_bt_vlan; vlan != NULL; vlan = vlan->next) {
|
||||
if (vlan->id == id)
|
||||
return &vlan->net;
|
||||
}
|
||||
vlan = g_malloc0(sizeof(struct bt_vlan_s));
|
||||
vlan->id = id;
|
||||
pvlan = &first_bt_vlan;
|
||||
while (*pvlan != NULL)
|
||||
pvlan = &(*pvlan)->next;
|
||||
*pvlan = vlan;
|
||||
return &vlan->net;
|
||||
}
|
||||
-512
File diff suppressed because it is too large
Load Diff
-2263
File diff suppressed because it is too large
Load Diff
-553
File diff suppressed because it is too large
Load Diff
-1367
File diff suppressed because it is too large
Load Diff
-989
File diff suppressed because it is too large
Load Diff
@@ -136,44 +136,11 @@ static inline bool ivshmem_is_master(IVShmemState *s)
|
||||
return s->master == ON_OFF_AUTO_ON;
|
||||
}
|
||||
|
||||
static void ivshmem_update_irq(IVShmemState *s)
|
||||
{
|
||||
PCIDevice *d = PCI_DEVICE(s);
|
||||
uint32_t isr = s->intrstatus & s->intrmask;
|
||||
|
||||
/*
|
||||
* Do nothing unless the device actually uses INTx. Here's how
|
||||
* the device variants signal interrupts, what they put in PCI
|
||||
* config space:
|
||||
* Device variant Interrupt Interrupt Pin MSI-X cap.
|
||||
* ivshmem-plain none 0 no
|
||||
* ivshmem-doorbell MSI-X 1 yes(1)
|
||||
* ivshmem,msi=off INTx 1 no
|
||||
* ivshmem,msi=on MSI-X 1(2) yes(1)
|
||||
* (1) if guest enabled MSI-X
|
||||
* (2) the device lies
|
||||
* Leads to the condition for doing nothing:
|
||||
*/
|
||||
if (ivshmem_has_feature(s, IVSHMEM_MSI)
|
||||
|| !d->config[PCI_INTERRUPT_PIN]) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* don't print ISR resets */
|
||||
if (isr) {
|
||||
IVSHMEM_DPRINTF("Set IRQ to %d (%04x %04x)\n",
|
||||
isr ? 1 : 0, s->intrstatus, s->intrmask);
|
||||
}
|
||||
|
||||
pci_set_irq(d, isr != 0);
|
||||
}
|
||||
|
||||
static void ivshmem_IntrMask_write(IVShmemState *s, uint32_t val)
|
||||
{
|
||||
IVSHMEM_DPRINTF("IntrMask write(w) val = 0x%04x\n", val);
|
||||
|
||||
s->intrmask = val;
|
||||
ivshmem_update_irq(s);
|
||||
}
|
||||
|
||||
static uint32_t ivshmem_IntrMask_read(IVShmemState *s)
|
||||
@@ -189,7 +156,6 @@ static void ivshmem_IntrStatus_write(IVShmemState *s, uint32_t val)
|
||||
IVSHMEM_DPRINTF("IntrStatus write(w) val = 0x%04x\n", val);
|
||||
|
||||
s->intrstatus = val;
|
||||
ivshmem_update_irq(s);
|
||||
}
|
||||
|
||||
static uint32_t ivshmem_IntrStatus_read(IVShmemState *s)
|
||||
@@ -198,7 +164,6 @@ static uint32_t ivshmem_IntrStatus_read(IVShmemState *s)
|
||||
|
||||
/* reading ISR clears all interrupts */
|
||||
s->intrstatus = 0;
|
||||
ivshmem_update_irq(s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,11 +82,6 @@ config USB_NETWORK
|
||||
default y
|
||||
depends on USB
|
||||
|
||||
config USB_BLUETOOTH
|
||||
bool
|
||||
default y
|
||||
depends on USB
|
||||
|
||||
config USB_SMARTCARD
|
||||
bool
|
||||
default y
|
||||
|
||||
@@ -25,7 +25,6 @@ common-obj-$(CONFIG_USB_STORAGE_UAS) += dev-uas.o
|
||||
common-obj-$(CONFIG_USB_AUDIO) += dev-audio.o
|
||||
common-obj-$(CONFIG_USB_SERIAL) += dev-serial.o
|
||||
common-obj-$(CONFIG_USB_NETWORK) += dev-network.o
|
||||
common-obj-$(CONFIG_USB_BLUETOOTH) += dev-bluetooth.o
|
||||
|
||||
ifeq ($(CONFIG_USB_SMARTCARD),y)
|
||||
common-obj-y += dev-smartcard-reader.o
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user