1 /******************************************************************************
2  * edd.h
3  *
4  * Copyright (C) 2002, 2003, 2004 Dell Inc.
5  * by Matt Domsch <Matt_Domsch@dell.com>
6  *
7  * structures and definitions for the int 13h, ax={41,48}h
8  * BIOS Enhanced Disk Drive Services
9  * This is based on the T13 group document D1572 Revision 0 (August 14 2002)
10  * available at http://www.t13.org/docs2002/d1572r0.pdf.  It is
11  * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License v2.0 as published by
15  * the Free Software Foundation
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  */
22 
23 #ifndef __XEN_EDD_H__
24 #define __XEN_EDD_H__
25 
26 #ifndef __ASSEMBLY__
27 
28 struct __packed edd_info {
29     /* Int13, Fn48: Check Extensions Present. */
30     u8 device;                   /* %dl: device */
31     u8 version;                  /* %ah: major version */
32     u16 interface_support;       /* %cx: interface support bitmap */
33     /* Int13, Fn08: Legacy Get Device Parameters. */
34     u16 legacy_max_cylinder;     /* %cl[7:6]:%ch: maximum cylinder number */
35     u8 legacy_max_head;          /* %dh: maximum head number */
36     u8 legacy_sectors_per_track; /* %cl[5:0]: maximum sector number */
37     /* Int13, Fn41: Get Device Parameters (as filled into %ds:%esi). */
38     struct __packed edd_device_params {
39         u16 length;
40         u16 info_flags;
41         u32 num_default_cylinders;
42         u32 num_default_heads;
43         u32 sectors_per_track;
44         u64 number_of_sectors;
45         u16 bytes_per_sector;
46         u32 dpte_ptr;            /* 0xFFFFFFFF for our purposes */
47         u16 key;                 /* = 0xBEDD */
48         u8 device_path_info_length;
49         u8 reserved2;
50         u16 reserved3;
51         u8 host_bus_type[4];
52         u8 interface_type[8];
53         union {
54             struct __packed {
55                 u16 base_address;
56                 u16 reserved1;
57                 u32 reserved2;
58             } isa;
59             struct __packed {
60                 u8 bus;
61                 u8 slot;
62                 u8 function;
63                 u8 channel;
64                 u32 reserved;
65             } pci;
66             /* pcix is same as pci */
67             struct __packed {
68                 u64 reserved;
69             } ibnd;
70             struct __packed {
71                 u64 reserved;
72             } xprs;
73             struct __packed {
74                 u64 reserved;
75             } htpt;
76             struct __packed {
77                 u64 reserved;
78             } unknown;
79         } interface_path;
80         union {
81             struct __packed {
82                 u8 device;
83                 u8 reserved1;
84                 u16 reserved2;
85                 u32 reserved3;
86                 u64 reserved4;
87             } ata;
88             struct __packed {
89                 u8 device;
90                 u8 lun;
91                 u8 reserved1;
92                 u8 reserved2;
93                 u32 reserved3;
94                 u64 reserved4;
95             } atapi;
96             struct __packed {
97                 u16 id;
98                 u64 lun;
99                 u16 reserved1;
100                 u32 reserved2;
101             } scsi;
102             struct __packed {
103                 u64 serial_number;
104                 u64 reserved;
105             } usb;
106             struct __packed {
107                 u64 eui;
108                 u64 reserved;
109             } i1394;
110             struct __packed {
111                 u64 wwid;
112                 u64 lun;
113             } fibre;
114             struct __packed {
115                 u64 identity_tag;
116                 u64 reserved;
117             } i2o;
118             struct __packed {
119                 u32 array_number;
120                 u32 reserved1;
121                 u64 reserved2;
122             } raid;
123             struct __packed {
124                 u8 device;
125                 u8 reserved1;
126                 u16 reserved2;
127                 u32 reserved3;
128                 u64 reserved4;
129             } sata;
130             struct __packed {
131                 u64 reserved1;
132                 u64 reserved2;
133             } unknown;
134         } device_path;
135         u8 reserved4;
136         u8 checksum;
137     }  edd_device_params;
138 };
139 
140 struct __packed mbr_signature {
141     u8 device;
142     u8 pad[3];
143     u32 signature;
144 };
145 
146 /* These all reside in the boot trampoline. Access via bootsym(). */
147 extern struct mbr_signature boot_mbr_signature[];
148 extern u8 boot_mbr_signature_nr;
149 extern struct edd_info boot_edd_info[];
150 extern u8 boot_edd_info_nr;
151 
152 #endif /* __ASSEMBLY__ */
153 
154 /* Maximum number of EDD information structures at boot_edd_info. */
155 #define EDD_INFO_MAX            6
156 
157 /* Maximum number of MBR signatures at boot_mbr_signature. */
158 #define EDD_MBR_SIG_MAX         16
159 
160 /* Size of components of EDD information structure. */
161 #define EDDEXTSIZE              8
162 #define EDDPARMSIZE             74
163 
164 #endif /* __XEN_EDD_H__ */
165