Revision 2be37833 hw/fdc.c
b/hw/fdc.c | ||
---|---|---|
699 | 699 |
} |
700 | 700 |
}; |
701 | 701 |
|
702 |
static void fdctrl_external_reset(void *opaque)
|
|
702 |
static void fdctrl_external_reset_sysbus(DeviceState *d)
|
|
703 | 703 |
{ |
704 |
fdctrl_t *s = opaque; |
|
704 |
fdctrl_sysbus_t *sys = container_of(d, fdctrl_sysbus_t, busdev.qdev); |
|
705 |
fdctrl_t *s = &sys->state; |
|
706 |
|
|
707 |
fdctrl_reset(s, 0); |
|
708 |
} |
|
709 |
|
|
710 |
static void fdctrl_external_reset_isa(DeviceState *d) |
|
711 |
{ |
|
712 |
fdctrl_isabus_t *isa = container_of(d, fdctrl_isabus_t, busdev.qdev); |
|
713 |
fdctrl_t *s = &isa->state; |
|
705 | 714 |
|
706 | 715 |
fdctrl_reset(s, 0); |
707 | 716 |
} |
... | ... | |
1923 | 1932 |
DMA_register_channel(fdctrl->dma_chann, &fdctrl_transfer_handler, fdctrl); |
1924 | 1933 |
fdctrl_connect_drives(fdctrl); |
1925 | 1934 |
|
1926 |
fdctrl_external_reset(fdctrl); |
|
1927 |
vmstate_register(-1, &vmstate_fdc, fdctrl); |
|
1928 |
qemu_register_reset(fdctrl_external_reset, fdctrl); |
|
1929 | 1935 |
return 0; |
1930 | 1936 |
} |
1931 | 1937 |
|
... | ... | |
1936 | 1942 |
int iobase = 0x3f0; |
1937 | 1943 |
int isairq = 6; |
1938 | 1944 |
int dma_chann = 2; |
1945 |
int ret; |
|
1939 | 1946 |
|
1940 | 1947 |
register_ioport_read(iobase + 0x01, 5, 1, |
1941 | 1948 |
&fdctrl_read_port, fdctrl); |
... | ... | |
1948 | 1955 |
isa_init_irq(&isa->busdev, &fdctrl->irq, isairq); |
1949 | 1956 |
fdctrl->dma_chann = dma_chann; |
1950 | 1957 |
|
1951 |
return fdctrl_init_common(fdctrl); |
|
1958 |
ret = fdctrl_init_common(fdctrl); |
|
1959 |
fdctrl_external_reset_isa(&isa->busdev.qdev); |
|
1960 |
|
|
1961 |
return ret; |
|
1952 | 1962 |
} |
1953 | 1963 |
|
1954 | 1964 |
static int sysbus_fdc_init1(SysBusDevice *dev) |
1955 | 1965 |
{ |
1956 |
fdctrl_t *fdctrl = &(FROM_SYSBUS(fdctrl_sysbus_t, dev)->state); |
|
1966 |
fdctrl_sysbus_t *sys = DO_UPCAST(fdctrl_sysbus_t, busdev, dev); |
|
1967 |
fdctrl_t *fdctrl = &sys->state; |
|
1957 | 1968 |
int io; |
1969 |
int ret; |
|
1958 | 1970 |
|
1959 | 1971 |
io = cpu_register_io_memory(fdctrl_mem_read, fdctrl_mem_write, fdctrl); |
1960 | 1972 |
sysbus_init_mmio(dev, 0x08, io); |
... | ... | |
1962 | 1974 |
qdev_init_gpio_in(&dev->qdev, fdctrl_handle_tc, 1); |
1963 | 1975 |
fdctrl->dma_chann = -1; |
1964 | 1976 |
|
1965 |
return fdctrl_init_common(fdctrl); |
|
1977 |
ret = fdctrl_init_common(fdctrl); |
|
1978 |
fdctrl_external_reset_sysbus(&sys->busdev.qdev); |
|
1979 |
|
|
1980 |
return ret; |
|
1966 | 1981 |
} |
1967 | 1982 |
|
1968 | 1983 |
static int sun4m_fdc_init1(SysBusDevice *dev) |
... | ... | |
1984 | 1999 |
.init = isabus_fdc_init1, |
1985 | 2000 |
.qdev.name = "isa-fdc", |
1986 | 2001 |
.qdev.size = sizeof(fdctrl_isabus_t), |
2002 |
.qdev.vmsd = &vmstate_fdc, |
|
2003 |
.qdev.reset = fdctrl_external_reset_isa, |
|
1987 | 2004 |
.qdev.props = (Property[]) { |
1988 | 2005 |
DEFINE_PROP_DRIVE("driveA", fdctrl_isabus_t, state.drives[0].dinfo), |
1989 | 2006 |
DEFINE_PROP_DRIVE("driveB", fdctrl_isabus_t, state.drives[1].dinfo), |
... | ... | |
1995 | 2012 |
.init = sysbus_fdc_init1, |
1996 | 2013 |
.qdev.name = "sysbus-fdc", |
1997 | 2014 |
.qdev.size = sizeof(fdctrl_sysbus_t), |
2015 |
.qdev.vmsd = &vmstate_fdc, |
|
2016 |
.qdev.reset = fdctrl_external_reset_sysbus, |
|
1998 | 2017 |
.qdev.props = (Property[]) { |
1999 | 2018 |
DEFINE_PROP_DRIVE("driveA", fdctrl_sysbus_t, state.drives[0].dinfo), |
2000 | 2019 |
DEFINE_PROP_DRIVE("driveB", fdctrl_sysbus_t, state.drives[1].dinfo), |
... | ... | |
2006 | 2025 |
.init = sun4m_fdc_init1, |
2007 | 2026 |
.qdev.name = "SUNW,fdtwo", |
2008 | 2027 |
.qdev.size = sizeof(fdctrl_sysbus_t), |
2028 |
.qdev.vmsd = &vmstate_fdc, |
|
2029 |
.qdev.reset = fdctrl_external_reset_sysbus, |
|
2009 | 2030 |
.qdev.props = (Property[]) { |
2010 | 2031 |
DEFINE_PROP_DRIVE("drive", fdctrl_sysbus_t, state.drives[0].dinfo), |
2011 | 2032 |
DEFINE_PROP_END_OF_LIST(), |
Also available in: Unified diff