lba 2 chs values
Posted: Thu May 03, 2012 3:46 pm
hi, while doing some work on my vfs and fat12 driver i'm having trouble figuring out where to put my lba2chs routine. i thought it was dead simple. i put it in the fdc driver, so that the fs/vfs code can use lba when talking to the fdc driver - but the values needed for the conversion is loaded from the bootsector in my fat12 code with direct chs values for now.
i feel like i got a chicken and egg scenario here. i need to load the bootsector to get the sectors per track and heads values, but i can't do that if i don't use direct chs. and i want to remove chs from the fdc.. so erhm.. also, when adding support for more file systems i would need another way of getting this. i would imagine that the same applies for a future hdd driver, at least if i'm supporting the older types.
i'm guessing the bios has this information somewhere, but would i really have to go back to 16 bit mode when initializing the fdc driver and in the future also for my hdd driver? and if not, if i try to get all this before entering pmode, how would i even know what drive number corresponds to what values, what drives there is to begin with, and that the bios actually has support for everything where i might need those values?
i haven't slept for quite a while so tell me if i'm having some kind of braindead moment here, or what the hell i'm suposed to do about this. i could just use hardcoded values for 1.44mb floppies right now and pretend like nothing.. but no, that just feels wrong, what if i found some old 386 or 486 with a 5.25" floppy and decides to add support for it.
advice from wiser (and more well rested) men appreciated!
i feel like i got a chicken and egg scenario here. i need to load the bootsector to get the sectors per track and heads values, but i can't do that if i don't use direct chs. and i want to remove chs from the fdc.. so erhm.. also, when adding support for more file systems i would need another way of getting this. i would imagine that the same applies for a future hdd driver, at least if i'm supporting the older types.
i'm guessing the bios has this information somewhere, but would i really have to go back to 16 bit mode when initializing the fdc driver and in the future also for my hdd driver? and if not, if i try to get all this before entering pmode, how would i even know what drive number corresponds to what values, what drives there is to begin with, and that the bios actually has support for everything where i might need those values?
i haven't slept for quite a while so tell me if i'm having some kind of braindead moment here, or what the hell i'm suposed to do about this. i could just use hardcoded values for 1.44mb floppies right now and pretend like nothing.. but no, that just feels wrong, what if i found some old 386 or 486 with a 5.25" floppy and decides to add support for it.
advice from wiser (and more well rested) men appreciated!