Page 1 of 1

SD cards, SPI, the BIOS

Posted: Sun Jan 27, 2013 9:44 pm
by bizzigul
Sorry for posting 2 topics in a row, but I thought this might be interesting as I can't find any info on this topic.

Basically, I'd like to have an OS that boots from SD cards only (don't ask me why, I'll tell you guys later when I have something to show you... hope so :wink: )

I'd like to have your opinion about:

1) being sure that the boot device is an SD card (could be optional if impossible). Is there a (de facto) spec somewhere saying "SD cards have BIOS device codes formatted like this..."?
2) accessing the SD card using BIOS (I'm planning on using int 13h but if you know other SPI-specific access methods, let me know)
3) accessing the SD card in protected mode (no matter the slot)

I need most help concerning 3). The thing is, I'm totally lost when it comes to finding the memory map/IO port of a device I want to access. What is the standard method? There seems to be no SPI spec, and I'm not even sure that all the SD card readers are accessed in a same way for all PCs.
... No, I'm definitely not parsing ACPI tables :lol:

Thanks for your help, especially concerning the standard method for accessing a given device and finding MMIO info.

Re: SD cards, SPI, the BIOS

Posted: Sun Jan 27, 2013 10:14 pm
by FallenAvatar
Well, I know that a lot of Card Readers run thru the USB Hosts on the motherboard. So for true support there in Protected mode, that would mean implementing atleast the USB 1.0 Spec (namely UHCI and/or OHCI. Though if you are doing a lot of File I/O I would recommend also implementing the USB 2.0 spec) You can see the Wiki page on USB for that info.

- Monk

Re: SD cards, SPI, the BIOS

Posted: Mon Jan 28, 2013 5:34 am
by bizzigul
That means I need to implement both SPI and USB to read those cards on most platforms... Am I right?
I think I'll have to implement an xCHI then (and switch to USB devices)... The SD format seems to be a pain in the @$$. Too bad that it's the only common format that can be inserted somewhere.

Also, any information about the SD card's "Protected Area"? I'm wondering in what LBA/CHS it is in...