mirror of https://github.com/xemu-project/xemu.git
cuda: Move ADB bus into CUDA state
Replace the global adb_bus with a CUDA-internal one, accessed using regular qdev child bus accessor. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
2e4a7c9c5d
commit
293c867d8c
1
hw/adb.h
1
hw/adb.h
|
@ -84,5 +84,4 @@ int adb_poll(ADBBusState *s, uint8_t *buf_out);
|
||||||
#define TYPE_ADB_KEYBOARD "adb-keyboard"
|
#define TYPE_ADB_KEYBOARD "adb-keyboard"
|
||||||
#define TYPE_ADB_MOUSE "adb-mouse"
|
#define TYPE_ADB_MOUSE "adb-mouse"
|
||||||
|
|
||||||
extern ADBBusState adb_bus;
|
|
||||||
#endif /* !defined(__ADB_H__) */
|
#endif /* !defined(__ADB_H__) */
|
||||||
|
|
|
@ -108,8 +108,6 @@
|
||||||
/* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */
|
/* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */
|
||||||
#define RTC_OFFSET 2082844800
|
#define RTC_OFFSET 2082844800
|
||||||
|
|
||||||
ADBBusState adb_bus;
|
|
||||||
|
|
||||||
static void cuda_update(CUDAState *s);
|
static void cuda_update(CUDAState *s);
|
||||||
static void cuda_receive_packet_from_host(CUDAState *s,
|
static void cuda_receive_packet_from_host(CUDAState *s,
|
||||||
const uint8_t *data, int len);
|
const uint8_t *data, int len);
|
||||||
|
@ -459,7 +457,7 @@ static void cuda_adb_poll(void *opaque)
|
||||||
uint8_t obuf[ADB_MAX_OUT_LEN + 2];
|
uint8_t obuf[ADB_MAX_OUT_LEN + 2];
|
||||||
int olen;
|
int olen;
|
||||||
|
|
||||||
olen = adb_poll(&adb_bus, obuf + 2);
|
olen = adb_poll(&s->adb_bus, obuf + 2);
|
||||||
if (olen > 0) {
|
if (olen > 0) {
|
||||||
obuf[0] = ADB_PACKET;
|
obuf[0] = ADB_PACKET;
|
||||||
obuf[1] = 0x40; /* polled data */
|
obuf[1] = 0x40; /* polled data */
|
||||||
|
@ -555,7 +553,7 @@ static void cuda_receive_packet_from_host(CUDAState *s,
|
||||||
{
|
{
|
||||||
uint8_t obuf[ADB_MAX_OUT_LEN + 2];
|
uint8_t obuf[ADB_MAX_OUT_LEN + 2];
|
||||||
int olen;
|
int olen;
|
||||||
olen = adb_request(&adb_bus, obuf + 2, data + 1, len - 1);
|
olen = adb_request(&s->adb_bus, obuf + 2, data + 1, len - 1);
|
||||||
if (olen > 0) {
|
if (olen > 0) {
|
||||||
obuf[0] = ADB_PACKET;
|
obuf[0] = ADB_PACKET;
|
||||||
obuf[1] = 0x00;
|
obuf[1] = 0x00;
|
||||||
|
@ -713,7 +711,7 @@ static void cuda_initfn(Object *obj)
|
||||||
s->timers[i].index = i;
|
s->timers[i].index = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
qbus_create_inplace((BusState *)&adb_bus, TYPE_ADB_BUS, DEVICE(obj),
|
qbus_create_inplace((BusState *)&s->adb_bus, TYPE_ADB_BUS, DEVICE(obj),
|
||||||
"adb.0");
|
"adb.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "exec/memory.h"
|
#include "exec/memory.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "hw/ide/internal.h"
|
#include "hw/ide/internal.h"
|
||||||
|
#include "hw/adb.h"
|
||||||
|
|
||||||
/* SMP is not enabled, for now */
|
/* SMP is not enabled, for now */
|
||||||
#define MAX_CPUS 1
|
#define MAX_CPUS 1
|
||||||
|
@ -93,6 +94,7 @@ typedef struct CUDAState {
|
||||||
uint8_t ier;
|
uint8_t ier;
|
||||||
uint8_t anh;
|
uint8_t anh;
|
||||||
|
|
||||||
|
ADBBusState adb_bus;
|
||||||
CUDATimer timers[2];
|
CUDATimer timers[2];
|
||||||
|
|
||||||
uint32_t tick_offset;
|
uint32_t tick_offset;
|
||||||
|
|
|
@ -149,6 +149,7 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
|
||||||
PCIBus *pci_bus;
|
PCIBus *pci_bus;
|
||||||
PCIDevice *macio;
|
PCIDevice *macio;
|
||||||
MACIOIDEState *macio_ide;
|
MACIOIDEState *macio_ide;
|
||||||
|
BusState *adb_bus;
|
||||||
MacIONVRAMState *nvr;
|
MacIONVRAMState *nvr;
|
||||||
int bios_size;
|
int bios_size;
|
||||||
MemoryRegion *pic_mem, *escc_mem;
|
MemoryRegion *pic_mem, *escc_mem;
|
||||||
|
@ -381,9 +382,11 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
|
||||||
"ide[1]"));
|
"ide[1]"));
|
||||||
macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]);
|
macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]);
|
||||||
|
|
||||||
dev = qdev_create(BUS(&adb_bus), TYPE_ADB_KEYBOARD);
|
dev = DEVICE(object_resolve_path_component(OBJECT(macio), "cuda"));
|
||||||
|
adb_bus = qdev_get_child_bus(dev, "adb.0");
|
||||||
|
dev = qdev_create(adb_bus, TYPE_ADB_KEYBOARD);
|
||||||
qdev_init_nofail(dev);
|
qdev_init_nofail(dev);
|
||||||
dev = qdev_create(BUS(&adb_bus), TYPE_ADB_MOUSE);
|
dev = qdev_create(adb_bus, TYPE_ADB_MOUSE);
|
||||||
qdev_init_nofail(dev);
|
qdev_init_nofail(dev);
|
||||||
|
|
||||||
if (usb_enabled(machine_arch == ARCH_MAC99_U3)) {
|
if (usb_enabled(machine_arch == ARCH_MAC99_U3)) {
|
||||||
|
|
|
@ -92,6 +92,7 @@ static void ppc_heathrow_init(QEMUMachineInitArgs *args)
|
||||||
PCIDevice *macio;
|
PCIDevice *macio;
|
||||||
MACIOIDEState *macio_ide;
|
MACIOIDEState *macio_ide;
|
||||||
DeviceState *dev;
|
DeviceState *dev;
|
||||||
|
BusState *adb_bus;
|
||||||
int bios_size;
|
int bios_size;
|
||||||
MemoryRegion *pic_mem;
|
MemoryRegion *pic_mem;
|
||||||
MemoryRegion *escc_mem, *escc_bar = g_new(MemoryRegion, 1);
|
MemoryRegion *escc_mem, *escc_bar = g_new(MemoryRegion, 1);
|
||||||
|
@ -281,9 +282,11 @@ static void ppc_heathrow_init(QEMUMachineInitArgs *args)
|
||||||
hd[3] = hd[2] = NULL;
|
hd[3] = hd[2] = NULL;
|
||||||
pci_cmd646_ide_init(pci_bus, hd, 0);
|
pci_cmd646_ide_init(pci_bus, hd, 0);
|
||||||
|
|
||||||
dev = qdev_create(BUS(&adb_bus), TYPE_ADB_KEYBOARD);
|
dev = DEVICE(object_resolve_path_component(OBJECT(macio), "cuda"));
|
||||||
|
adb_bus = qdev_get_child_bus(dev, "adb.0");
|
||||||
|
dev = qdev_create(adb_bus, TYPE_ADB_KEYBOARD);
|
||||||
qdev_init_nofail(dev);
|
qdev_init_nofail(dev);
|
||||||
dev = qdev_create(BUS(&adb_bus), TYPE_ADB_MOUSE);
|
dev = qdev_create(adb_bus, TYPE_ADB_MOUSE);
|
||||||
qdev_init_nofail(dev);
|
qdev_init_nofail(dev);
|
||||||
|
|
||||||
if (usb_enabled(false)) {
|
if (usb_enabled(false)) {
|
||||||
|
|
Loading…
Reference in New Issue