1/* ----------------------------------------------------------------------- *
2 *
3 *   Copyright 2009 Shao Miller - All Rights Reserved
4 *
5 *   This program is free software; you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 *   Boston MA 02111-1307, USA; either version 2 of the License, or
9 *   (at your option) any later version; incorporated herein by reference.
10 *
11 * ----------------------------------------------------------------------- */
12
13/*
14 * eltorito.c
15 *
16 * EDD-4 El Torito structures and debugging routines
17 */
18
19#include <stdint.h>
20#include "memdisk.h"
21#include "conio.h"
22#include "eltorito.h"
23
24#ifdef DBG_ELTORITO
25void eltorito_dump(uint32_t image)
26{
27    printf("-- El Torito dump --\n", image);
28
29    /* BVD starts at sector 17. */
30    struct edd4_bvd *bvd = (struct edd4_bvd *)(image + 17 * 2048);
31
32    printf("bvd.boot_rec_ind: 0x%02x\n", bvd->boot_rec_ind);
33    printf("bvd.iso9660_id: %c%c%c%c%c\n", bvd->iso9660_id[0],
34	   bvd->iso9660_id[1], bvd->iso9660_id[2], bvd->iso9660_id[3],
35	   bvd->iso9660_id[4]);
36    printf("bvd.ver: 0x%02x\n", bvd->ver);
37    printf("bvd.eltorito: %s\n", bvd->eltorito);
38    printf("bvd.boot_cat: 0x%08x\n", bvd->boot_cat);
39
40    struct edd4_bootcat *boot_cat =
41	(struct edd4_bootcat *)(image + bvd->boot_cat * 2048);
42
43    printf("boot_cat.validation_entry\n");
44    printf("  .header_id: 0x%02x\n", boot_cat->validation_entry.header_id);
45    printf("  .platform_id: 0x%02x\n", boot_cat->validation_entry.platform_id);
46    printf("  .id_string: %s\n", boot_cat->validation_entry.id_string);
47    printf("  .checksum: 0x%04x\n", boot_cat->validation_entry.checksum);
48    printf("  .key55: 0x%02x\n", boot_cat->validation_entry.key55);
49    printf("  .keyAA: 0x%02x\n", boot_cat->validation_entry.keyAA);
50    printf("boot_cat.initial_entry\n");
51    printf("  .header_id: 0x%02x\n", boot_cat->initial_entry.header_id);
52    printf("  .media_type: 0x%02x\n", boot_cat->initial_entry.media_type);
53    printf("  .load_seg: 0x%04x\n", boot_cat->initial_entry.load_seg);
54    printf("  .system_type: 0x%02x\n", boot_cat->initial_entry.system_type);
55    printf("  .sect_count: %d\n", boot_cat->initial_entry.sect_count);
56    printf("  .load_block: 0x%08x\n", boot_cat->initial_entry.load_block);
57}
58#endif
59