Re: [Qemu-devel] Help me about the FDC

2012-02-22 Thread 陳韋任
> 2: explain the struct of FDCtrl;

  In order to know what those fields in FDCtrl mean, you might need to read
  ftp://download.intel.com/design/archives/periphrl/docs/29047504.pdf first.
As the comment in hw/fdc.c says, it's Intel 82078 floppy disk controller
emulation.

Regards,
chenwj 

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj



Re: [Qemu-devel] Help me about the FDC

2012-02-22 Thread 陳韋任
> 3: or give me some introduce of FDC.

  http://en.wikipedia.org/wiki/Floppy_disk_controller

HTH,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj



Re: [Qemu-devel] Help me about the FDC

2012-02-22 Thread Stefan Hajnoczi
On Wed, Feb 22, 2012 at 6:16 AM, Zhi Hui Li  wrote:
> 1: explain the difference between :
>
>    type_register_static(&isa_fdc_info);
>    type_register_static(&sysbus_fdc_info);
>    type_register_static(&sun4m_fdc_info);

The floppy disk controller is used by several different targets,
including x86 PC, SPARC, and others.  Look at the TypeInfo
declarations for isa_fdc_info and the others to see how they differ.

For example the sun4m (SPARC) fdc sets up an memory-mapped I/O (MMIO)
region and an interrupt.  The isa (PC) fdc sets up programmed I/O
(PIO) and an interrupt.

Basically, both sun4m and PCs have similar fdc hardware but the
hardware registers are mapped to different places.  This is why there
are different setup functions to make sure the MMIO, PIO, and/or
interrupts are set up for a specific target.

> 2: explain the struct of FDCtrl;

FDCtrl is the main struct for an emulated floppy disk controller.  In
order to understand it you need to know how the floppy disk controller
behaves, what hardware registers it has, etc.

You need to read the floppy disk controler hardware datasheet first
before looking at QEMU device emulation code - otherwise you will not
know what QEMU is trying to emulate :).

This leads to your next question...

> 3: or give me some introduce of FDC.

Start here:

http://en.wikipedia.org/wiki/Floppy_disk_controller
http://wiki.osdev.org/Floppy_Disk_Controller

Then look at the datasheet:

http://wiki.qemu.org/images/f/f0/29047403.pdf

Learn how the device is supposed to operate first, then the QEMU
device emulation code will make sense.

I suggest getting an overview of how the device works without learning
all the hardware register details.  Then read the datasheet for
details on those parts of the device that you will need to modify -
there's probably too much information to learn everything about the
device, just focus on what you need.

Stefan