DiskOnChip 2000 and Millenium support in GRUB bootloader

Mark Meade mark at lakeshoremicro.com
Mon Mar 4 16:48:56 EST 2002


On Mon, 4 Mar 2002, Ilguiz Latypov wrote:

> What was your fix?  Do you copy %cs to %ds in
> case doc_stage1 is IPL itself?  Are there any extra things to be done to
> make the code eXecute-In-Place?

Ilguiz,

The segment issue is minor -- the original code assumed that _start was loaded at 0x20000
by the IPL, but in this case, we are executing in place, at 0xD0000 (for example).

So instead of this:

#ifndef DOC_REPLACE_IPL
    /* Store the DiskOnChip segment */
    movw %ds, %cs:doc_seg
#endif

I added the following, after the int 18/19 handler has been copied to the end of memory:

#ifdef DOC_REPLACE_IPL
    /* Store the DiskOnChip segment (XIP from the IPL area) */
    movw %cs, %es:doc_seg
#endif

When the interrupt handler is called, doc_seg is now in the correct spot.

I suppose it's possible to let the int handler XIP also, but it just seemed to fit better
with existing code to copy it to the 1K segment at the top of memory.  This way, no more
Millennium-specific changes are required in doc_stage1b.S.

> I will modify the checksum program to generate a different value when
> "--enable-diskonchip-ipl" option is supplied to the configure script.

I had to add the checksum byte and a jump to the _start routine:

#ifdef DOC_REPLACE_IPL
    /*
      * _start is in the beginning of DoC Millennium flash memory
      */
     .byte 0x55, 0xAA        /* BIOS extension signature */
     .byte 0x10                  /* DoC window is 8K (16*512) in size */
     /* BIOS will call far _start + 3 */

    jmp over
    .byte 0                       /* BIOS extension checksum goes here */
#endif
over:

> I will also add an option to hook to the diskless boot int 18h handler.

Thanks!  This makes it easier for me to test.  I had one occasion when a botched int 19
handler made it impossible to boot with the DOC installed.  I had to remove the DOC, boot
into DOS, install the DOC (with the PC turned on), and then erase it.  Needless to say,
I'm trying to avoid having to do this again.  ;-)

> Mark, my DoC Millennium modifications to the MTD GRUB patch were based on
> the doc2000.c kernel driver code from MTD repository.  Perhaps, I wasn't
> careful enough in copying the necessary operations.

I looked at that source late Friday, but I haven't had time to get real serious about it
yet.  I've found some assembly sources related to the Linux BIOS project that may help,
also.

Mark











More information about the linux-mtd mailing list