Adding upstream version 4.00~pre61+dfsg.
[syslinux-debian/hramrach.git] / com32 / modules / disk.c
blobca4b59887a5ec4f9c8327718fb2a172b3a633e37
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2009 Pierre-Alexandre Meyer - All Rights Reserved
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., 51 Franklin St, Fifth Floor,
8 * Boston MA 02110-1301, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
13 #include <stdio.h>
14 #include <console.h>
15 #include <stdlib.h>
16 #include <string.h>
17 #include <disk/geom.h>
18 #include <disk/util.h>
19 #include <disk/errno_disk.h>
20 #include <disk/error.h>
22 int main(int argc, char *argv[])
24 struct driveinfo drive;
25 struct driveinfo *d = &drive;
27 (void)argc;
28 (void)argv;
30 openconsole(&dev_null_r, &dev_stdcon_w);
32 for (int disk = 0x80; disk < 0xff; disk++) {
33 memset(d, 0, sizeof(struct driveinfo));
34 d->disk = disk;
35 get_drive_parameters(d);
37 /* Do not print output when drive does not exists */
38 if (errno_disk == -1 || !d->cbios)
39 continue;
41 if (errno_disk) {
42 get_error("reading disk");
43 continue;
46 printf("DISK 0x%X:\n", d->disk);
47 printf(" C/H/S: %d heads, %d cylinders\n",
48 d->legacy_max_head + 1, d->legacy_max_cylinder + 1);
49 printf(" %d sectors/track, %d drives\n",
50 d->legacy_sectors_per_track, d->legacy_max_drive);
51 printf(" EDD: ebios=%d, EDD version: %X\n",
52 d->ebios, d->edd_version);
53 printf(" %d heads, %d cylinders\n",
54 (int) d->edd_params.heads, (int) d->edd_params.cylinders);
55 printf(" %d sectors, %d bytes/sector, %d sectors/track\n",
56 (int) d->edd_params.sectors, (int) d->edd_params.bytes_per_sector,
57 (int) d->edd_params.sectors_per_track);
58 printf(" Host bus: %s, Interface type: %s\n\n",
59 d->edd_params.host_bus_type, d->edd_params.interface_type);
61 return 0;