Comment # 10 on bug 1230345 from Nikolay Gueorguiev
zipl/include/install.h

* * *
/* Determine SCSI disk layout from the specified BOOTBLOCK. */
static inline enum scsi_layout get_scsi_layout(unsigned char *bootblock)
{
        if ((bootblock[510] == 0x55) && (bootblock[511] == 0xaa))
                return scsi_layout_pcbios;
        else if ((bootblock[508] == 0xda) && (bootblock[509] == 0xbe))
                return scsi_layout_sun;
        else if ((bootblock[0] == 0x0b) && (bootblock[1] == 0xe5) &&
                 (bootblock[2] == 0xa9) && (bootblock[3] == 0x41))
                return scsi_layout_sgi;
        return scsi_layout_unknown;
}

* * *
/* Types of SCSI disk layouts */ 
enum scsi_layout {
        scsi_layout_pcbios,
        scsi_layout_sun,
        scsi_layout_sgi,
        scsi_layout_unknown
};


* * *


zipl/src/install.c
* * *
/* Create an IPL master boot record data structure for SCSI MBRs in memory
 * at location BUFFER. TABLE contains a pointer to the program table. INFO
 * provides information about the disk. */
static int
update_scsi_mbr(void* bootblock, disk_blockptr_t* table,
                struct disk_info* info, disk_blockptr_t* scsi_dump_sb_blockptr)
{
        struct scsi_mbr *mbr;
        struct scsi_dump_param param;
        void* buffer;

        switch (get_scsi_layout(bootblock)) {
        case scsi_layout_pcbios:
                if (verbose)
                        printf("Detected SCSI PCBIOS disk layout.\n");
                buffer = bootblock;
                break;
        case scsi_layout_sun:
        case scsi_layout_sgi:
                error_reason("Unsupported SCSI disk layout");
                return -1;
        default:
                if (info->partnum) {
                        error_reason("Unsupported SCSI disk layout");
                        return -1;
                } else {
                        if (verbose)
                                printf ("Detected plain SCSI partition.\n");
                        buffer=bootblock;
                }
        }

        mbr = (struct scsi_mbr *) buffer;
        memset(buffer, 0, sizeof(struct scsi_mbr));
        memcpy(&mbr->magic, ZIPL_MAGIC, ZIPL_MAGIC_SIZE);
        mbr->version_id = DISK_LAYOUT_ID;
        bootmap_store_blockptr(&mbr->program_table_pointer, table, info,
                               0 /* this argument is ignored for scsi */);
        if (scsi_dump_sb_blockptr && scsi_dump_sb_blockptr->linear.block != 0)
{
                /* Write dump boot_info */
                param.block = scsi_dump_sb_blockptr->linear.block *
                              scsi_dump_sb_blockptr->linear.size;
                boot_get_dump_info(&mbr->boot_info, BOOT_INFO_DEV_TYPE_SCSI,
                                   &param);
        }
        return 0;
}


You are receiving this mail because: