Geometry for MMC and microSD

Discussion in 'UDOO X86' started by Snakebyte, Aug 6, 2018.

  1. Snakebyte

    Snakebyte Member

    Joined:
    Mar 19, 2018
    Messages:
    90
    Likes Received:
    9
    Does anyone know what are the correct C/H/S geometry for the eMMC and microSD cards? The BIOS is reporting 0 sectors

    Aug 6 04:42:22 192 kernel: bios-d1: 1023 cylinders, 256 heads, 0 sectors per track
    Aug 6 04:42:22 192 kernel: bios-d2: 1023 cylinders, 256 heads, 0 sectors per track

    If I use 63 sectors per track, I get 16498944 sectors, which is only 8G. Both should be 32G.

    Thanks!
     
  2. Snakebyte

    Snakebyte Member

    Joined:
    Mar 19, 2018
    Messages:
    90
    Likes Received:
    9
    The 8G is coming from using 512 bytes per sector for the calculation. I get 32G if I use 2048 bytes per sector. I do not know if this is supported by the controllers. Where can I find more documentation on the eMMC and microSD controllers?
     
  3. Snakebyte

    Snakebyte Member

    Joined:
    Mar 19, 2018
    Messages:
    90
    Likes Received:
    9
    More on this: I have been playing around with BIOS and Extended BIOS calls, on interrupt 0x13. This is what I get for standard BIOS Read Drive Parameters (ah = 0x08h):

    Aug 6 12:56:00 192 kernel: bios-d0: 970 cylinders, 64 heads, 63 sectors per track (total capacity 3911040 sectors), 512 bytes per sector
    Aug 6 12:56:00 192 kernel: bios-d1: 1023 cylinders, 256 heads, 0 sectors per track (total capacity 0 sectors), 0 bytes per sector
    Aug 6 12:56:00 192 kernel: bios-d2: 1023 cylinders, 256 heads, 0 sectors per track (total capacity 0 sectors), 0 bytes per sector

    The first one (bios-d0) is the 2G USB stick I am booting from. The next two are the 32G eMMC and microSD storage devices. For standard BIOS Read Drive Parameters, the total capacity is calculated by C*H*S.

    When I use the Extended Read Drive Parameters (ah = 0x48), I get:

    Aug 6 12:52:11 192 kernel: bios-d0: 64 cylinders, 65 heads, 63 sectors per track (total capacity 3915776 sectors), 512 bytes per sector
    Aug 6 12:52:11 192 kernel: bios-d1: 1 cylinders, 1 heads, 0 sectors per track (total capacity 0 sectors), 0 bytes per sector
    Aug 6 12:52:11 192 kernel: bios-d2: 1 cylinders, 1 heads, 0 sectors per track (total capacity 0 sectors), 0 bytes per sector

    The USB stick is now reporting 64 cylinders, instead of 970. The eMMC and microSD are reporting 1 cylinder and 1 head because they start at 0 (sectors start at 1). For Extended Read Drive Parameters, total capacity comes from the 0x10 to 0x17h bytes in the memory buffer. Although there is a discrepancy between the two values for bios-d0, I'm not particularly concerned. It does confirm that the memory buffer passed to interrupt 0x13 is rw accessible.

    These values are coming from the driver talking to the BIOS. What am I missing? Which values take priority, standard or extended BIOS?
     

Share This Page