I am making my own bios for my emulator. I have hit a bit of a snag, I don't know how you would know if a device exists..
note that the hardware on my emulator is NOT fixed, sometimes a fdd might exist and sometimes it wont!
like, well how would I detect if there is an FDD, would I just read the appropriate ports to try to get the appropriate output, or is this dangerous?
and how do you get the base address of the ports?
detecting devices? [bios development]
Hi,
For the controller you could assume one (or 2) is present, do some sort of manual probing (see if the "identify" command works perhaps), or for PCI systems check the vendor ID and device ID of the "PCI to LPC bridge".
For floppies you can do manual probing (e.g. see if the device responds to a "recalibrate" command). For real computers the user has to tell the BIOS which floppy devices are present (via. the inbuilt BIOS setup utility) - the BIOS setup utility stores this information in the CMOS and uses it each time it boots. This means that you can also cheat - for e.g. make the emulator set values in the CMOS for the BIOS to use during boot. This is what Bochs does.
BTW the FDCs and FDDs predate Plug and Play - they completely suck for autodetection as they weren't designed for it to begin with, and manufacturers haven't bothered extending these devices since. There is an exception to this - the BIOS includes descriptions of FDCs in the ACPI AML code (which makes things much worse for people developing BIOS code, rather than actually helping).
Cheers,
Brendan
For floppies there's there floppy drive controller (FDC) and the devices attached to it (e.g. the disk drives - FDDs).hckr83 wrote:so is the only way to do it chipset specific? I'm not talking right now about the plug and play stuff...
For the controller you could assume one (or 2) is present, do some sort of manual probing (see if the "identify" command works perhaps), or for PCI systems check the vendor ID and device ID of the "PCI to LPC bridge".
For floppies you can do manual probing (e.g. see if the device responds to a "recalibrate" command). For real computers the user has to tell the BIOS which floppy devices are present (via. the inbuilt BIOS setup utility) - the BIOS setup utility stores this information in the CMOS and uses it each time it boots. This means that you can also cheat - for e.g. make the emulator set values in the CMOS for the BIOS to use during boot. This is what Bochs does.
BTW the FDCs and FDDs predate Plug and Play - they completely suck for autodetection as they weren't designed for it to begin with, and manufacturers haven't bothered extending these devices since. There is an exception to this - the BIOS includes descriptions of FDCs in the ACPI AML code (which makes things much worse for people developing BIOS code, rather than actually helping).
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.