direct-io.hg

view xen/drivers/ide/ide-xeno.c @ 898:db4b686bbf64

bitkeeper revision 1.566 (3fa9179e50emTfPyuQMw53twIxyaxA)

ide-xeno.c:
tweak
author smh22@labyrinth.cl.cam.ac.uk
date Wed Nov 05 15:30:38 2003 +0000 (2003-11-05)
parents 352a82eb57ad
children 4aba3a48d64f 0a901de56d7c
line source
1 #include <xeno/config.h>
2 #include <xeno/types.h>
3 #include <xeno/lib.h>
4 #include <xeno/ide.h>
5 #include <xeno/vbd.h>
6 #include <asm/domain_page.h>
7 #include <asm/io.h>
9 #define NR_IDE_DEVS 20
11 static kdev_t ide_devs[NR_IDE_DEVS] = {
12 MKDEV(IDE0_MAJOR, 0), MKDEV(IDE0_MAJOR, 64), /* hda, hdb */
13 MKDEV(IDE1_MAJOR, 0), MKDEV(IDE1_MAJOR, 64), /* hdc, hdd */
14 MKDEV(IDE2_MAJOR, 0), MKDEV(IDE2_MAJOR, 64), /* hde, hdf */
15 MKDEV(IDE3_MAJOR, 0), MKDEV(IDE3_MAJOR, 64), /* hdg, hdh */
16 MKDEV(IDE4_MAJOR, 0), MKDEV(IDE4_MAJOR, 64), /* hdi, hdj */
17 MKDEV(IDE5_MAJOR, 0), MKDEV(IDE5_MAJOR, 64), /* hdk, hdl */
18 MKDEV(IDE6_MAJOR, 0), MKDEV(IDE6_MAJOR, 64), /* hdm, hdn */
19 MKDEV(IDE7_MAJOR, 0), MKDEV(IDE7_MAJOR, 64), /* hdo, hdp */
20 MKDEV(IDE8_MAJOR, 0), MKDEV(IDE8_MAJOR, 64), /* hdq, hdr */
21 MKDEV(IDE9_MAJOR, 0), MKDEV(IDE9_MAJOR, 64) /* hds, hdt */
22 };
27 void ide_probe_devices(xen_disk_info_t* xdi)
28 {
29 int loop;
30 unsigned int unit;
31 unsigned long capacity;
32 unsigned short device, type;
33 ide_drive_t *drive;
35 for ( loop = 0; loop < MAX_HWIFS; loop++ )
36 {
37 ide_hwif_t *hwif = &ide_hwifs[loop];
38 if ( !hwif->present ) continue;
40 for ( unit = 0; unit < MAX_DRIVES; unit++ )
41 {
42 drive = &hwif->drives[unit];
44 if ( !drive->present ) continue;
46 /*
47 ** NB: we use the ide 'media' field (ide_disk, ide_cdrom, etc)
48 ** as our 'type' field (XD_TYPE_DISK, XD_TYPE_CDROM, etc).
49 ** Hence must ensure these are kept in sync.
50 */
52 /* SMH: we export 'raw' linux device numbers to domain 0 */
53 device = ide_devs[(loop * MAX_DRIVES) + unit];
54 type = drive->media;
55 capacity = current_capacity(drive);
57 xdi->disks[xdi->count].device = device;
58 xdi->disks[xdi->count].info = type;
60 if(type == XD_TYPE_CDROM)
61 xdi->disks[xdi->count].info |= XD_FLAG_RO;
63 xdi->disks[xdi->count].capacity = capacity;
64 xdi->count++;
66 printk("Device %d: IDE-XENO (%s) capacity %ldkB (%ldMB)\n",
67 xdi->count, (type == XD_TYPE_DISK) ? "disk" :
68 ((type == XD_TYPE_CDROM) ? "cdrom" : "unknown"),
69 capacity>>1, capacity>>11);
70 }
71 }
73 return;
74 }