summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-03-21 18:05:23 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-03-21 18:05:23 +0000
commit2be17ebded1eb5add24674cc88e4833d5afaa980 (patch)
treed4c101f4d38c2c7e5678aa9834f192c933d4f150
parentcf2be98437dc65eb1608b3dc0ec3aeefd88661ed (diff)
downloadqemu-2be17ebded1eb5add24674cc88e4833d5afaa980.tar.gz
qemu-2be17ebded1eb5add24674cc88e4833d5afaa980.tar.bz2
qemu-2be17ebded1eb5add24674cc88e4833d5afaa980.zip
Wire up TC signal from Aux1 to FDC
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4096 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--hw/fdc.c13
-rw-r--r--hw/fdc.h2
-rw-r--r--hw/slavio_misc.c14
-rw-r--r--hw/sun4m.c24
-rw-r--r--hw/sun4m.h2
5 files changed, 42 insertions, 13 deletions
diff --git a/hw/fdc.c b/hw/fdc.c
index 0bb480c262..de5238dbe0 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -766,8 +766,18 @@ fdctrl_t *fdctrl_init (qemu_irq irq, int dma_chann, int mem_mapped,
return fdctrl;
}
+static void fdctrl_handle_tc(void *opaque, int irq, int level)
+{
+ //fdctrl_t *s = opaque;
+
+ if (level) {
+ // XXX
+ FLOPPY_DPRINTF("TC pulsed\n");
+ }
+}
+
fdctrl_t *sun4m_fdctrl_init (qemu_irq irq, target_phys_addr_t io_base,
- BlockDriverState **fds)
+ BlockDriverState **fds, qemu_irq *fdc_tc)
{
fdctrl_t *fdctrl;
int io_mem;
@@ -778,6 +788,7 @@ fdctrl_t *sun4m_fdctrl_init (qemu_irq irq, target_phys_addr_t io_base,
fdctrl_mem_write_strict,
fdctrl);
cpu_register_physical_memory(io_base, 0x08, io_mem);
+ *fdc_tc = *qemu_allocate_irqs(fdctrl_handle_tc, fdctrl, 1);
return fdctrl;
}
diff --git a/hw/fdc.h b/hw/fdc.h
index 620c4061f9..7b6a9ded8e 100644
--- a/hw/fdc.h
+++ b/hw/fdc.h
@@ -7,5 +7,5 @@ fdctrl_t *fdctrl_init (qemu_irq irq, int dma_chann, int mem_mapped,
target_phys_addr_t io_base,
BlockDriverState **fds);
fdctrl_t *sun4m_fdctrl_init (qemu_irq irq, target_phys_addr_t io_base,
- BlockDriverState **fds);
+ BlockDriverState **fds, qemu_irq *fdc_tc);
int fdctrl_get_drive_type(fdctrl_t *fdctrl, int drive_num);
diff --git a/hw/slavio_misc.c b/hw/slavio_misc.c
index 71128c267d..865e5ae8bb 100644
--- a/hw/slavio_misc.c
+++ b/hw/slavio_misc.c
@@ -51,6 +51,7 @@ typedef struct MiscState {
uint32_t sysctrl;
uint16_t leds;
CPUState *env;
+ qemu_irq fdc_tc;
} MiscState;
#define MISC_SIZE 1
@@ -66,6 +67,8 @@ typedef struct MiscState {
#define MISC_MDM 0x01b00000
#define MISC_SYS 0x01f00000
+#define AUX1_TC 0x02
+
#define AUX2_PWROFF 0x01
#define AUX2_PWRINTCLR 0x02
#define AUX2_PWRFAIL 0x20
@@ -175,6 +178,14 @@ static void slavio_aux1_mem_writeb(void *opaque, target_phys_addr_t addr,
MiscState *s = opaque;
MISC_DPRINTF("Write aux1 %2.2x\n", val & 0xff);
+ if (val & AUX1_TC) {
+ // Send a pulse to floppy terminal count line
+ if (s->fdc_tc) {
+ qemu_irq_raise(s->fdc_tc);
+ qemu_irq_lower(s->fdc_tc);
+ }
+ val &= ~AUX1_TC;
+ }
s->aux1 = val & 0xff;
}
@@ -407,7 +418,7 @@ static int slavio_misc_load(QEMUFile *f, void *opaque, int version_id)
void *slavio_misc_init(target_phys_addr_t base, target_phys_addr_t power_base,
target_phys_addr_t aux1_base,
target_phys_addr_t aux2_base, qemu_irq irq,
- CPUState *env)
+ CPUState *env, qemu_irq **fdc_tc)
{
int io;
MiscState *s;
@@ -462,6 +473,7 @@ void *slavio_misc_init(target_phys_addr_t base, target_phys_addr_t power_base,
s->irq = irq;
s->env = env;
+ *fdc_tc = &s->fdc_tc;
register_savevm("slavio_misc", base, 1, slavio_misc_save, slavio_misc_load,
s);
diff --git a/hw/sun4m.c b/hw/sun4m.c
index 7900b51719..1d36f618f9 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -376,6 +376,7 @@ static void sun4m_hw_init(const struct hwdef *hwdef, int RAM_size,
qemu_irq *cpu_irqs[MAX_CPUS], *slavio_irq, *slavio_cpu_irq,
*espdma_irq, *ledma_irq;
qemu_irq *esp_reset, *le_reset;
+ qemu_irq *fdc_tc;
unsigned long prom_offset, kernel_size;
int ret;
char buf[1024];
@@ -494,6 +495,11 @@ static void sun4m_hw_init(const struct hwdef *hwdef, int RAM_size,
slavio_serial_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq],
serial_hds[1], serial_hds[0]);
+ slavio_misc = slavio_misc_init(hwdef->slavio_base, hwdef->apc_base,
+ hwdef->aux1_base, hwdef->aux2_base,
+ slavio_irq[hwdef->me_irq], envs[0],
+ &fdc_tc);
+
if (hwdef->fd_base != (target_phys_addr_t)-1) {
/* there is zero or one floppy drive */
memset(fd, 0, sizeof(fd));
@@ -501,7 +507,8 @@ static void sun4m_hw_init(const struct hwdef *hwdef, int RAM_size,
if (index != -1)
fd[0] = drives_table[index].bdrv;
- sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd);
+ sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd,
+ fdc_tc);
}
if (drive_get_max_bus(IF_SCSI) > 0) {
@@ -520,9 +527,6 @@ static void sun4m_hw_init(const struct hwdef *hwdef, int RAM_size,
esp_scsi_attach(main_esp, drives_table[index].bdrv, i);
}
- slavio_misc = slavio_misc_init(hwdef->slavio_base, hwdef->apc_base,
- hwdef->aux1_base, hwdef->aux2_base,
- slavio_irq[hwdef->me_irq], envs[0]);
if (hwdef->cs_base != (target_phys_addr_t)-1)
cs_init(hwdef->cs_base, hwdef->cs_irq, slavio_intctl);
@@ -549,6 +553,7 @@ static void sun4c_hw_init(const struct hwdef *hwdef, int RAM_size,
void *iommu, *espdma, *ledma, *main_esp, *nvram;
qemu_irq *cpu_irqs, *slavio_irq, *espdma_irq, *ledma_irq;
qemu_irq *esp_reset, *le_reset;
+ qemu_irq *fdc_tc;
unsigned long prom_offset, kernel_size;
int ret;
char buf[1024];
@@ -643,6 +648,10 @@ static void sun4c_hw_init(const struct hwdef *hwdef, int RAM_size,
slavio_serial_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq],
serial_hds[1], serial_hds[0]);
+ slavio_misc = slavio_misc_init(-1, hwdef->apc_base,
+ hwdef->aux1_base, hwdef->aux2_base,
+ slavio_irq[hwdef->me_irq], env, &fdc_tc);
+
if (hwdef->fd_base != (target_phys_addr_t)-1) {
/* there is zero or one floppy drive */
fd[1] = fd[0] = NULL;
@@ -650,7 +659,8 @@ static void sun4c_hw_init(const struct hwdef *hwdef, int RAM_size,
if (index != -1)
fd[0] = drives_table[index].bdrv;
- sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd);
+ sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd,
+ fdc_tc);
}
if (drive_get_max_bus(IF_SCSI) > 0) {
@@ -669,10 +679,6 @@ static void sun4c_hw_init(const struct hwdef *hwdef, int RAM_size,
esp_scsi_attach(main_esp, drives_table[index].bdrv, i);
}
- slavio_misc = slavio_misc_init(-1, hwdef->apc_base,
- hwdef->aux1_base, hwdef->aux2_base,
- slavio_irq[hwdef->me_irq], env);
-
kernel_size = sun4m_load_kernel(kernel_filename, kernel_cmdline,
initrd_filename);
diff --git a/hw/sun4m.h b/hw/sun4m.h
index bf2eca31e2..212e30d0f8 100644
--- a/hw/sun4m.h
+++ b/hw/sun4m.h
@@ -56,7 +56,7 @@ void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq,
void *slavio_misc_init(target_phys_addr_t base, target_phys_addr_t power_base,
target_phys_addr_t aux1_base,
target_phys_addr_t aux2_base, qemu_irq irq,
- CPUState *env);
+ CPUState *env, qemu_irq **fdc_tc);
void slavio_set_power_fail(void *opaque, int power_failing);
/* cs4231.c */