Add externs to avoid multiple definitions, and then add missing definitions.
[rrq/maintain_lilo.git] / src / lilo.h
1 /* lilo.h  -  LILO constants
2  * 
3  * Copyright 1992-1998 Werner Almesberger
4  * Copyright 1999-2006 John Coffman
5  * Copyright 2009-2015 Joachim Wiedorn
6  * All rights reserved.
7  * 
8  * Licensed under the terms contained in the file 'COPYING'
9  * in the source directory.
10  */
11
12 /* This file is also included by the boot loader assembler code. Put
13    everything that isn't legal C syntax or isn't swallowed by the
14    preprocessor into #ifdef LILO_ASM ... #endif */
15
16 #ifndef LILO_H
17 #define LILO_H
18
19 #if !__MSDOS__
20 #define INT4 int
21 #else
22 #define INT4 int32_t
23 #endif /* !__MSDOS__ */
24
25 /* This is the stuff to check the configuration:
26  */
27 #if defined(LCF_READONLY) && defined(LCF_REWRITE_TABLE)
28 #error "Incompatible Makefile options: READONLY and REWRITE_TABLE"
29 #endif
30 #ifdef LCF_LARGE_EBDA
31 #error "Configuration option '-DLARGE_EBDA' is deprecated"
32 #endif
33
34 /*
35  * Starting with 2.1.something, Linux kernels put VGA constants and segment
36  * definitions into asm/boot.h instead of linux/config.h
37  */
38
39 #if 0
40
41 #ifdef HAS_BOOT_H
42 #include <asm/boot.h>
43 #else
44 #include <linux/config.h>
45 #endif
46
47 #else
48
49 /* Don't touch these, unless you really know what you're doing. */
50 #define DEF_INITSEG     0x9000
51 #define DEF_SYSSEG      0x1000
52 #define DEF_SETUPSEG    0x9020
53 #define DEF_SYSSIZE     0x7F00
54
55 /* Internal svga startup constants */
56 #define NORMAL_VGA      0xffff          /* 80x25 mode */
57 #define EXTENDED_VGA    0xfffe          /* 80x50 mode */
58 #define ASK_VGA         0xfffd          /* ask for it at bootup */
59
60 #endif
61
62 #if defined(HAS_VERSION_H) && !__MSDOS__
63 #include <linux/version.h>
64 #endif /* !__MSDOS__ */
65
66 #ifndef LINUX_VERSION_CODE
67 #define LINUX_VERSION_CODE 0
68 #endif
69 #ifndef KERNEL_VERSION
70 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
71 #endif
72
73 #define nelem(a) (sizeof(a)/sizeof((a)[0]))
74 #define S2(x) #x
75 #define SA(x) S2(x)
76
77 #include "version.h"
78 #define VERSION 256*VERSION_MINOR+VERSION_MAJOR
79 #if VERSION_MINOR >= 50
80 # define BETA_TEST 1
81 #else
82 # define BETA_TEST 0
83 #endif
84
85 /* definitions for pf_hard_disk_scan in device.c  */
86 #ifdef DEBUG_PARTITIONS
87 #define PARTITIONS "./devfs_partitions"
88 #else
89 #define PARTITIONS "/proc/partitions"
90 #endif
91
92
93 /* the known major device numbers of block devices */
94 /* see: linux-3.xx/Documentation/devices.txt */
95 #define MAJMIN_RAM          0x101 /* RAM disk */
96
97 #ifdef LCF_MDPRAID
98 #define MAJOR_MDP_SORT   1    /*** Convert MAJOR_MDP to this for sorting ***/
99 #endif
100 #define MAJOR_EMD_SORT   2    /*** Convert MAJOR_EMD to this for sorting ***/
101 #define MAJOR_HPT370_SORT 2   /*** Convert MAJOR_HPT370 to this for sorting ***/
102
103 #define MAJOR_FD         2    /* floppy disks               (dev/fd..) */
104 #define MAJOR_IDE        3    /* first IDE hard disk iface  (/dev/hd..) */
105 #define MAJOR_LOOP       7    /* loopback devices 0-15      (dev/loop..) */
106 #define MAJOR_SD         8    /* SCSI disks 0-15            (dev/sd..) */
107 #define MAJOR_MD         9    /* metadisk RAID devices      (/dev/md..) */
108
109 #define MAJOR_SCD       11    /* SCSI CD-ROM devices        (/dev/scd..) */
110 #define MAJOR_XT        13    /* XT hard disks drives  (deleted since kernel v3.9) */
111 #define MAJOR_SONY      15    /* Sony CDU-31A/CDU-33A CD-ROM (/dev/sonycd) */
112 #define MAJOR_GSCD      16    /* GoldStar CD-ROM            (/dev/gscd) */
113 #define MAJOR_OPT       17    /* Optics Storage CD-ROM      (/dev/optcd) */
114 #define MAJOR_SJCD      18    /* Sanyo CD-ROM               (/dev/sjcd) */
115 #define MAJOR_HIT       20    /* Hitachi CD-ROM             (/dev/hitcd) */
116
117 #define MAJOR_ACORN     21    /* Acorn MFM hard drives      (/dev/mfm..) */
118 #define MAJOR_IDE2      22    /* second IDE hard disk iface (/dev/hd..) */
119
120 #define MAJOR_CDU       24    /* Sony CDU-535 CD-ROM        (/dev/cdu535) */
121 #define MAJOR_MAT       25    /* First Matsushita CD-ROM    (/dev/sbpcd..) */
122 #define MAJOR_MAT2      26    /* Second Matsushita CD-ROM   (/dev/sbpcd..) */
123 #define MAJOR_MAT3      27    /* Third Matsushita CD-ROM    (/dev/sbpcd..) */
124 #define MAJOR_MAT4      28    /* Fourth Matsushita CD-ROM   (/dev/sbpcd..) */
125 #define MAJOR_CM205     30    /* Philips LMS CM-205 CD-ROM  (/dev/cm205cd) */
126 #define MAJOR_CM206     32    /* Philips LMS CM-206 CD-ROM  (/dev/cm206cd) */
127
128 #define MAJOR_IDE3      33    /* third  IDE hard disk iface (/dev/hd..) */
129 #define MAJOR_IDE4      34    /* fourth IDE hard disk iface (/dev/hd..) */
130
131 #define MAJOR_ESDI      36    /* PS/2 ESDI hard disk drives  (obsolete) */
132 #define MAJOR_FTL       44    /* Flash Transition Layer on Memory Technology Device */
133 #define MAJOR_PP        45    /* Parallel Port IDE disk devices (/dev/pd..) */
134 #define MAJOR_PPCD      46    /* Parallel Port ATAPI CD-ROM devices (/dev/pcd..) */
135 #define MAJOR_PPFD      47    /* Parallel Port ATAPI floppy drive (/dev/pf..) */
136
137 #define MAJOR_DAC       48    /* First Mylex DAC960 PCI RAID iface  (/dev/rd/c0..) */
138 #define MAJOR_DAC2      49    /* Second Mylex DAC960 PCI RAID iface (/dev/rd/c1..) */
139 #define MAJOR_DAC3      50    /* Third Mylex DAC960 PCI RAID iface  (/dev/rd/c2..) */
140 #define MAJOR_DAC4      51    /* Fourth Mylex DAC960 PCI RAID iface (/dev/rd/c3..) */
141 #define MAJOR_DAC5      52    /* Fifth Mylex DAC960 PCI RAID iface  (/dev/rd/c4..) */
142 #define MAJOR_DAC6      53    /* Sixth Mylex DAC960 PCI RAID iface  (/dev/rd/c5..) */
143 #define MAJOR_DAC7      54    /* Seventh Mylex DAC960 PCI RAID iface (/dev/rd/c6..) */
144 #define MAJOR_DAC8      55    /* Eighth Mylex DAC960 PCI RAID iface (/dev/rd/c7..) */
145
146 #define MAJOR_IDE5      56    /* fifth IDE hard disk iface  (/dev/hd..) */
147 #define MAJOR_IDE6      57    /* sixth IDE hard disk iface  (/dev/hd..) */
148 #define MAJOR_LVM       58    /* Logical Volume Manager block device */
149
150 #define MAJOR_EXPR      60    /* Experimental devices (without official numbers) */
151 #define MAJOR_EXPR2     61    /* Experimental devices (without official numbers) */
152 #define MAJOR_EXPR3     62    /* Experimental devices (without official numbers) */
153 #define MAJOR_EXPR4     63    /* Experimental devices (without official numbers) */
154
155 #define MAJOR_SD_SORT   64    /*** MAJOR_SD converted to this for sorting ***/
156
157 #define MAJOR_SD2       65    /* SCSI disks 16-31           (/dev/sd..) */
158 #define MAJOR_SD3       66    /* SCSI disks 32-47           (/dev/sd..) */
159 #define MAJOR_SD4       67    /* SCSI disks 48-63           (/dev/sd..) */
160 #define MAJOR_SD5       68    /* SCSI disks 64-79           (/dev/sd..) */
161 #define MAJOR_SD6       69    /* SCSI disks 80-95           (/dev/sd..) */
162 #define MAJOR_SD7       70    /* SCSI disks 96-111          (/dev/sd..) */
163 #define MAJOR_SD8       71    /* SCSI disks 112-127         (/dev/sd..) */
164
165 #define MAJOR_SMART     72    /* First Compaq Smart/2 iface (/dev/ida/c0d..) */
166 #define MAJOR_SMART2    73    /* Second Compaq Smart/2 iface (/dev/ida/c1d..) */
167 #define MAJOR_SMART3    74    /* Third Compaq Smart/2 iface (/dev/ida/c1d..) */
168 #define MAJOR_SMART4    75    /* Fourth Compaq Smart/2 iface (/dev/ida/c1d..) */
169 #define MAJOR_SMART5    76    /* Fifth Compaq Smart/2 iface (/dev/ida/c1d..) */
170 #define MAJOR_SMART6    77    /* Sixth Compaq Smart/2 iface (/dev/ida/c1d..) */
171 #define MAJOR_SMART7    78    /* Seventh Compaq Smart/2 iface (/dev/ida/c1d..) */
172 #define MAJOR_SMART8    79    /* Eighth Compaq Smart/2 iface (/dev/ida/c1d..) */
173
174 #define MAJOR_I2O       80    /* First I2O hard disk iface  (/dev/i2o/hd..) */
175 #define MAJOR_I2O2      81    /* Second I2O hard disk iface (/dev/i2o/hd..) */
176 #define MAJOR_I2O3      82    /* Third I2O hard disk iface  (/dev/i2o/hd..) */
177 #define MAJOR_I2O4      83    /* Fourth I2O hard disk iface (/dev/i2o/hd..) */
178 #define MAJOR_I2O5      84    /* Fifth I2O hard disk iface  (/dev/i2o/hd..) */
179 #define MAJOR_I2O6      85    /* Sixth I2O hard disk iface  (/dev/i2o/hd..) */
180 #define MAJOR_I2O7      86    /* Seventh I2O hard disk iface (/dev/i2o/hd..) */
181 #define MAJOR_I2O8      87    /* Eighth I2O hard disk iface (/dev/i2o/hd..) */
182
183 #define MAJOR_IDE7      88    /* Seventh IDE hard disk iface (/dev/hd..) */
184 #define MAJOR_IDE8      89    /* Eighth IDE hard disk iface (/dev/hd..) */
185 #define MAJOR_IDE9      90    /* Ninth IDE hard disk iface (/dev/hd..) */
186 #define MAJOR_IDE10     91    /* Tenth IDE hard disk iface (/dev/hd..) */
187
188 #define MAJOR_PPDD      92    /* PPDD encrypted disks  (not supported) */
189 #define MAJOR_NFTL      93    /* NAND Flash Translation Layer (Disk-On-Chip) */
190 #define MAJOR_DOC      100    /* Disk-On-Chip driver  (obsolete) */
191 #define MAJOR_AMI      101    /* AMI Hyper Disk RAID controller (/dev/amiraid/ar..) */
192
193 #define MAJOR_CISS     104    /* First CCISS Drive Array iface  (/dev/cciss/c0..) */
194 #define MAJOR_CISS2    105    /* Second CCISS Drive Array iface (/dev/cciss/c1..) */
195 #define MAJOR_CISS3    106    /* Third CCISS Drive Array iface  (/dev/cciss/c2..) */
196 #define MAJOR_CISS4    107    /* Fourth CCISS Drive Array iface (/dev/cciss/c3..) */
197 #define MAJOR_CISS5    108    /* Fifth CCISS Drive Array iface  (/dev/cciss/c4..) */
198 #define MAJOR_CISS6    109    /* Sixth CCISS Drive Array iface  (/dev/cciss/c5..) */
199 #define MAJOR_CISS7    110    /* Seventh CCISS Drive Array iface (/dev/cciss/c6..) */
200 #define MAJOR_CISS8    111    /* Seventh CCISS Drive Array iface (/dev/cciss/c7..) */
201
202 #define MAJOR_IBM_ISER 112    /* IBM iSeries virtual disk   (/dev/iseries/vd..) */
203 #define MAJOR_HPT370   114    /* Software RAID interfaces e.g.HPT370 (/dev/ataraid/..) */
204 #define MAJOR_EVMS     117    /* Enterprise Volume Management System (/dev/evms/EVM..) */
205
206 #define MAJOR_EXPR5    120    /* Experimental devices (without official numbers) */
207 #define MAJOR_EXPR6    121    /* Experimental devices (without official numbers) */
208 #define MAJOR_EXPR7    122    /* Experimental devices (without official numbers) */
209 #define MAJOR_EXPR8    123    /* Experimental devices (without official numbers) */
210 #define MAJOR_EXPR9    124    /* Experimental devices (without official numbers) */
211 #define MAJOR_EXPR10   125    /* Experimental devices (without official numbers) */
212 #define MAJOR_EXPR11   126    /* Experimental devices (without official numbers) */
213 #define MAJOR_EXPR12   127    /* Experimental devices (without official numbers) */
214
215 #define MAJOR_SD9      128    /* SCSI disks 128-143         (/dev/sd..) */
216 #define MAJOR_SD10     129    /* SCSI disks 144-159         (/dev/sd..) */
217 #define MAJOR_SD11     130    /* SCSI disks 160-175         (/dev/sd..) */
218 #define MAJOR_SD12     131    /* SCSI disks 176-191         (/dev/sd..) */
219 #define MAJOR_SD13     132    /* SCSI disks 192-207         (/dev/sd..) */
220 #define MAJOR_SD14     133    /* SCSI disks 208-223         (/dev/sd..) */
221 #define MAJOR_SD15     134    /* SCSI disks 224-239         (/dev/sd..) */
222 #define MAJOR_SD16     135    /* SCSI disks 240-255         (/dev/sd..) */
223
224 #define MAJOR_DAC9     136    /* Ninth Mylex DAC960 PCI RAID iface (/dev/rd/c8..) */
225 #define MAJOR_DAC10    137    /* Tenth Mylex DAC960 PCI RAID iface (/dev/rd/c9..) */
226 #define MAJOR_DAC11    138    /* Eleventh Mylex DAC960 PCI RAID iface (/dev/rd/c10..) */
227 #define MAJOR_DAC12    139    /* Twelfth Mylex DAC960 PCI RAID iface  (/dev/rd/c11..) */
228 #define MAJOR_DAC13    140    /* Thirteenth Mylex DAC960 PCI RAID iface (/dev/rd/c12..) */
229 #define MAJOR_DAC14    141    /* Fourteenth Mylex DAC960 PCI RAID iface (/dev/rd/c13..) */
230 #define MAJOR_DAC15    142    /* Fifteenth Mylex DAC960 PCI RAID iface (/dev/rd/c14..) */
231 #define MAJOR_DAC16    143    /* Sixteenth Mylex DAC960 PCI RAID iface (/dev/rd/c15..) */
232
233 #define MAJOR_EMD      153    /* Enhanced multi-disk RAID sets (/dev/emd/..) */
234 #define MAJOR_CARM1    160    /* First Carmel SATA Disk controller (/dev/carmel/..) */
235 #define MAJOR_CARM2    161    /* Second Carmel SATA Disk controller (/dev/carmel/..) */
236 #define MAJOR_MMC      179    /* MMC card block devices     (/dev/mmcblk..) */
237 #define MAJOR_USB      180    /* USB block devices          (/dev/ub..) */
238
239 #define MAJOR_VXDSK    199    /* Veritas volume manager (VxVM) volumes (/dev/vx/dsk/..) */
240 #define MAJOR_VXDMP    201    /* Veritas VxVM dynamic multipath devices (/dev/vx/dmp/..) */
241 #define MAJOR_XVD      202    /* Xen Virtual Block Device Disks (/dev/xv..) */
242
243 /* don't use the following */
244 #define MAJOR_MDP      254    /* Enhanced multi-disk RAID sets [experimental] */
245
246 /* high partitions (>15) on SATA hard disks */
247 #define MAJOR_SATA1    259    /* high SATA disk partitions (Block Extended Major) */
248 #define MAJOR_SATA2    260    /* high SATA disk partitions (Block Extended Major) (obsolete) */
249
250
251 #define MAX_TOKEN     1023    /* max device Token length */
252 #define MAX_IMAGE_NAME  15    /* maximum name length (w/o terminating NUL) */
253 #define MAX_DESCR_SECTORS 12  /* upper limit on MAX_DESCR_SECS */
254
255 #ifdef LCF_PASS160
256 #undef SHS_PASSWORDS
257 #define SHS_PASSWORDS         /* use this one if SHS passwords are in use */
258 #define MAX_PW_CRC       5    /* max # of longwords in password digest */
259 #define PW_FILE_SUFFIX ".shs" /* suffix for the file that saves password digest */
260 #else
261 #define CRC_PASSWORDS         /* use this one if CRC passwords are in use */
262 #define MAX_PW_CRC       2    /* max # of CRC-32's in password */
263 #define PW_FILE_SUFFIX ".crc" /* suffix for the file that saves password CRC's */
264 #endif
265
266 #ifdef LCF_DSECS
267 #define MAX_DESCR_SECS LCF_DSECS
268 #else
269 #define MAX_DESCR_SECS 2        /* maximum # of descriptor sectors */
270 #endif
271 #if MAX_DESCR_SECS > MAX_DESCR_SECTORS
272 #error "Maximum DSECS=x exceeded."
273 #endif
274 #define MAX_IMAGES      ((int)((SECTOR_SIZE*MAX_DESCR_SECS-sizeof(INT4)-1)/sizeof(IMAGE_DESCR)))
275                           /* maximum number of images */
276
277 #define COMMAND_LINE_SIZE       512     /* CL_LENGTH */
278 #define SECTOR_SIZE     512 /* disk sector size */
279 #ifndef BLOCK_SIZE /* may also come from linux/fs.h */
280 #define BLOCK_SIZE      1024 /* disk block size */
281 #endif
282
283 #define PARTITION_ENTRY    16   /* size of one partition entry */
284 #define PARTITION_ENTRIES  4    /* number of partition entries */
285 #define PART_TABLE_SIZE    (PARTITION_ENTRY*PARTITION_ENTRIES)
286 #define PART_TABLE_OFFSET  0x1be /* offset in the master boot sector */
287 #define PART_ACT_ENT_OFF   0    /* offset in entry for active flag */
288 #define PART_TYPE_ENT_OFF  4    /* offset in entry for partition type */
289
290 #define P_MASK(x) ((~has_partitions(x))&0xFFFFFFFF)
291 #define D_MASK(x) (has_partitions(x))
292 #define PART_MAX PARTITION_ENTRIES /* biggest primary partition number */
293 #define PART_MAX_MAX    63      /* max. partition number (on IDE disks) */
294
295 #define MAX_BOOT_SIZE   0x1b6   /* (leave some space for NT's and DR DOS' dirty
296                                    hacks) scream if the boot sector gets any
297                                    bigger -- (22.5 - we now use those hacks) */
298
299 #define BOOT_SIGNATURE  0xAA55  /* boot signature */
300 #define BOOT_SIG_OFFSET 510     /* boot signature offset */
301 #define MAGIC_SERIAL    0xC9CF  /* LILO installed serial number */
302 #define PRIME           271     /* prime number used for serial no generation */
303 #define SMALL_PRIME     17      /* another prime, but a small one */
304 #if VERSION_MINOR>90
305 #define MAX_BIOS_DEVICES  2     /* max hard disk devices used by BIOS */
306 #define MAX_DEVICES     4       /* max hard disk devices, total */
307 #else
308 #define MAX_BIOS_DEVICES  16    /* max hard disk devices used by BIOS */
309 #define MAX_DEVICES     64      /* max hard disk devices, total */
310 #endif
311 #define MAX_RAID        30      /* max number of RAID disks in a set */
312 #if 0
313 #define MAX_RAID_DEVICES  6     /* max raid devices reported to second.S */
314 #else
315 #define MAX_RAID_DEVICES MAX_DESCR_SECTORS-MAX_DESCR_SECS+6     /* max raid devices reported to second.S */
316 #endif
317
318 #define PART_LINUX_MINIX  0x81  /* Linux/MINIX partition */
319 #define PART_LINUX_SWAP   0x82  /* Linux swap partition */
320 #define PART_LINUX_NATIVE 0x83  /* Linux native (file system) */
321 #define PART_DOS_EXTD     5     /* DOS Extended partition */
322 #define PART_WIN_EXTD_LBA 0xF   /* Win95/98 Extended partition */
323 #define PART_LINUX_EXTD   0x85  /* Linux Extended partition */
324 #define PART_LINUX_LVM    0x8E /* Linux LVM partition */
325 /* #define PART_OS2_BOOTMGR  0xA        -  OS/2 Boot Manager */
326
327 #define PART_DOS12        1     /* DOS 12 bit FAT partition type */
328 #define PART_DOS16_SMALL  4     /* DOS 16 bit FAT partition type, < 32 MB */
329 #define PART_DOS16_BIG    6     /* DOS 16 bit FAT partition type, >= 32 MB */
330 #define PART_HPFS         7     /* OS/2 High Performance File System */
331 #define PART_NTFS         7     /* WinNT File System */
332 #define PART_FAT32        0xB   /* Win95/98 FAT32 partition on small disk */
333 #define PART_FAT32_LBA    0xC   /* Win95/98 FAT32 partition on large disk */
334 #define PART_FAT16_LBA    0xE   /* Win95/98 FAT16 partition on large disk */
335 #define PART_INVALID      98    /* invalid partition type */
336
337 #define HIDDEN_OFF      0x10    /* type offset to hide partition (OS/2 BM) */
338 #define PART_HDOS12     (PART_DOS12+HIDDEN_OFF)
339 #define PART_HDOS16_SMALL (PART_DOS16_SMALL+HIDDEN_OFF)
340 #define PART_HDOS16_BIG (PART_DOS16_BIG+HIDDEN_OFF)
341
342 #define STAGE_FIRST     1       /* first stage loader code */
343 #define STAGE_SECOND    2       /* second stage loader code */
344 #define STAGE_CHAIN     0x10    /* chain loader code */
345 #define STAGE_DRIVE_MAP 0x11    /* chain loader drive mapper */
346 #define STAGE_MBR       0x12    /* mbr loader */
347 #define STAGE_MBR2      0x13    /* mbr2 loader (extended) */
348 #define STAGE_FLAG_SERIAL  0x0100       /* boot loader supports serial i/o */
349 #define STAGE_FLAG_MENU 0x0200  /* boot loader supports menu interface */
350 #define STAGE_FLAG_BMP4 0x0400  /* boot loader supports 640x480x4 bitmaps */
351
352 #define VSS_NUM         497     /* address where variable setup size is stored */
353 #define VGA_SET         506     /* address of initial kernel VGA mode */
354 #define SETUPSECS       4       /* default number of setup sectors */
355 #define MAX_SETUPSECS   63      /* maximum number of sectors in kernel
356                                    setup code (+ bootsect)  (for kernel >= 2.4.0) */
357 #define MAX_KERNEL_SECS 1024    /* absolute maximum kernel size */
358 #define SPECIAL_SECTORS 2       /* special sectors (don't compact) at beginning
359                                    of map sections */
360 #define SPECIAL_BOOTSECT 1      /* INITSEG bootsect.S bootloader at beginning
361                                    of all kernels, ahead of SETUPSECS */
362
363 #define LINEAR_FLAG     0x40    /* mark linear address */
364 #define LBA32_FLAG      0x20    /* mark lba 32-bit address */
365 #define LBA32_NOCOUNT   0x40    /* mark address with count absent */
366 #define RAID_REL_FLAG   0x10    /* mark address raid-relocatable */
367 /*
368  *      FLAG    Description
369  *
370  *      0x00     pure geometric addressing (C:H:S)
371  *      0x40     Linear address (24-bits) converted to CHS at boot-time
372  *      0x60     LBA32 address (32-bits), count=1, sets the high nibble!!
373  *      0x20     LBA32 address (24-bits) + (8-bit) high nibble (implied)
374  *
375 */
376 #define DEV_MASK_EXP    0x80+MAX_BIOS_DEVICES-1
377 #define DEV_MASK        (DEV_MASK_EXP)
378
379 #define EX_OFF          SETUP_STACKSIZE-8+SSDIFF /* external parameter block */
380 #define EX_DL_MAG       0xfe    /* magic number in DL */
381 #define EX_MAG_L        0x494c  /* magic number at ES:SI, "LI" */
382 #define EX_MAG_H        0x4f4c  /* magic number at ES:SI+2, "LO" */
383 #define EX_MAG_HL       0x4f4c494c  /* "LILO" */
384 #define EX_MAG_STRING   "LILO"  /* magic signature string as as string */
385
386 #define BIOS_MAX_DEVS   2       /* BIOS devices (2 fd, 2 hd) */
387 #define BIOS_MAX_HEADS  256     /* 8 bits head number; really 255 */
388                         /* but must account for oddball BIOS's that allow 256 */
389 #define BIOS_MAX_CYLS   1024    /* 10 bits cylinder number */
390 #define BIOS_MAX_SECS   64      /* 6 bits sector number (really 63) */
391
392 /* these are the boot record flags in the "prompt" variable */
393 #define FLAG_PROMPT     1       /* always issue boot: prompt */
394 #define FLAG_RAID       2       /* one boot record of many */
395 #define FLAG_RAID_DEFEAT  4     /* defeat finding this RAID boot record */
396 #if 0
397 #define FLAG_RAID_NOWRITE 8     /* defeat RAID writeback of command line */
398 #endif
399 #define FLAG_NOBD       16      /* defeat BIOS data collection at boot time */
400 #define FLAG_LARGEMEM   32      /* BIOS has MoveExtMemBlk support for 386 */
401 #define FLAG_MAP_ON_BOOT 64     /* map file is on the boot device */
402 #define FLAG_BD_OKAY    128     /* BIOS data collection known to work */
403 #ifdef FLAG_RAID_NOWRITE
404 #define FLAG_SAVE (~(FLAG_RAID|FLAG_RAID_DEFEAT|FLAG_RAID_NOWRITE))  /* All but raid flags */
405 #else
406 #define FLAG_SAVE (~(FLAG_RAID|FLAG_RAID_DEFEAT))  /* All but raid flags */
407 #endif
408
409 /* these are the second-stage specific flags */
410 #define FLAG2_EL_TORITO  2      /* El Torito format bootable CD */
411 #define FLAG2_UNATTENDED 4      /* Unattended booting option */
412 #define FLAG2_VIRTUAL    8      /* vmdefault, vmdisable, vmwarn used */
413 #define FLAG2_NOKBD     16      /* nokbdefault, nokbdisable used */
414
415 /* these are the descriptor flags */
416 #define FLAG_VGA        1       /* override VGA mode */
417 #define FLAG_RESTR      2       /* restrict additional parameters */
418 #define FLAG_LOCK       4       /* lock on target */
419 #define FLAG_MODKRN     8       /* modern kernel with high memory support */
420 #define FLAG_KERNEL     16      /* image is a kernel */
421 #define FLAG_TOOBIG     32      /* initrd so big that kernel could be overwritten */
422 #define FLAG_FALLBACK   64      /* fallback command line exists */
423 #define FLAG_PASSWORD   128     /* this image requires a password */
424 #define FLAG_LOADHI     256     /* this kernel loads high (>=1Mb) */
425 #ifdef LCF_VIRTUAL
426 #define FLAG_VMDISABLE  512     /* unable to boot if virtual */
427 #define FLAG_VMWARN     1024    /* warn on virtual boot */
428 #define FLAG_VMDEFAULT  2048    /* this is the default vitual load */
429 #endif
430 #define FLAG_SINGLE     4096    /* single key activation */
431 #define FLAG_RETAIN     0x2000  /* retain BMP screen on boot */
432 #ifdef LCF_NOKEYBOARD
433 #define FLAG_NOKBDEFAULT 0x4000 /* this is the default with no keyboard */
434 #define FLAG_NOKBDISABLE 0x8000 /* unable to boot if no keyboard */
435 #endif
436
437 #define VGA_NOCOVR      0x8000  /* VGA setting not overridden on command line */
438
439 #define SER_DFL_PRM     0xa3    /* default serial parameters: 2400n8 */
440
441 #define DC_MAGIC        0xf4f2  /* magic number of default cmd. line sector */
442 #define DC_MGOFF        0x6b6d  /* magic number for disabled line */
443
444 #define MAX_MESSAGE     65535   /* maximum message length */
445 #define MAX_MENU_TITLE  37      /* maximum MENU title length */
446
447 #define NEW_HDR_SIG     "HdrS"  /* setup header signature */
448 #define NEW_HDR_VERSION 0x200   /* header version number */
449 #define NEW2_HDR_VERSION 0x202  /* new cmdline protocol */
450 #define NEW3_HDR_VERSION 0X203  /* defines CL_RAMDISK_MAX */
451 #define LOADER_VERSION  0x02    /* loader version, for SETUP_HDR.loader */
452 #define LFLAG_HIGH      1       /* SETUP_HDR.flags */
453 #define LFLAG_USE_HEAP  0x80
454
455 #define PRTMAP_SIZE     32      /* number of partition type mappings */
456 #define DRVMAP_SIZE     24      /* number of drive mappings */
457
458 #define CRC_POLY1 0x04c11db7
459 #define CRC_POLY2 0x23a55379
460 #define CRC_POLY3 0x049f21c7
461 #define CRC_POLY4 0x1c632927
462 #define CRC_POLY5 0xA3139383
463
464 #define PROBE_SIGNATURE "LiLo"  /* signature placed in low memory */
465 #define PROBESEG 0x60           /* must be in first 4k page in memory */
466 #define EDD_LTH     30          /* length of the EDD return structure (max) */
467 #define EDD_PACKET  01          /* packet calls are supported */
468 #define EDD_LOCK    02          /* removable media may be locked */
469 #define EDD_SUBSET  04          /* EDD call supported */
470
471
472
473 #ifdef LILO_ASM
474 BOOTSEG   = 0x07C0                      ! original address of boot-sector
475 PARTS_LOAD= 0x0600                      ! partition sector load address
476 PARTS_SCR = 0x0800                      ! ditto, for non-boot partitions
477 PART_TABLE= 0x07BE                      ! partition table
478
479 INITSEG   = DEF_INITSEG                 ! we move boot here - out of the way
480 SETUPSEG  = DEF_SETUPSEG                ! setup starts here
481 SYSSEG    = DEF_SYSSEG                  ! system loaded at 0x10000 (65536).
482
483 MAX_DESCR_SECS_asm = MAX_DESCR_SECS     ! **
484 MAX_DESCR_SECTORS_asm = MAX_DESCR_SECTORS ! **
485 MAX_IMAGE_NAME_asm = MAX_IMAGE_NAME     ! **
486 MAX_PW_CRC_asm  = MAX_PW_CRC            ! **
487 SECTOR_SIZE_asm = SECTOR_SIZE           ! **
488 MAX_MENU_TITLE_asm = MAX_MENU_TITLE     ! **
489 MAX_BIOS_DEVICES_asm = MAX_BIOS_DEVICES ! **
490 MAX_RAID_DEVICES_asm = MAX_RAID_DEVICES ! **
491 DEV_MASK_asm = DEV_MASK_EXP             ! **
492
493
494 STACKSEG  = 0x9000           ! MUST == INITSEG for kernel 2.0.36 (and others?)
495 SETUP_STACKSIZE = 2048          ! stacksize for kernel setup.S
496
497 #else
498 #define BOOTSEG 0x07c0                  /* for probe.c  */
499 #endif
500
501 #define FIRSTSEG BOOTSEG
502
503 #ifdef LILO_ASM
504
505 STACK     = 2048                ! amount of stack space to reserve
506 SSDIFF  = 0
507
508 BOOTSECT  = 0x200               ! kernel bootsect.S
509
510 #define SETUP_STACK_DYN  PARMLINE
511 #define SLA_SIZE_DYN  SETUP_STACK_DYN-SETUP_STACKSIZE-BOOTSECT
512
513 KBBEG     = 0x41A                       ! beginning of keyboard buffer
514 KBEND     = 0x41C                       ! end of keyboard buffer
515 KBLOW     = 0x1e
516 KBHIGH    = 0x3e
517
518 !
519 !  Memory layout
520 !
521 ! 0x007BE-0x007FD    64 B    partition table
522 ! 0x07C00-0x07DFF   0.5 kB   HD/FD boot load address
523 ! 0x10000-0x8FFFF 512.0 kB   kernel (zImage)
524 ! 0x90000-0x901FF   0.5 kB   kernel floppy boot sector (bootsect.S)
525 ! 0x90200-0x967FF  25.5 kB   kernel setup code (setup.S) and heap
526 ! 0x96800-0x969FF   0.5 kB   LILO stack
527 ! 0x96A00-0x96BFF   0.5 kB   LILO first stage loader
528 ! 0x96C00-0x985FF   6.5 kB   LILO second stage loader
529 ! 0x98600-0x987FF   0.5 kB   file map load area
530 ! 0x98800-0x98BFF     1 kB   descriptor table load area
531 ! 0x98C00-0x98DFF   0.5 kB   default command line load area
532 ! 0x98E00-0x98FFF   0.5 kB   keyboard translation table load area
533 ! 0x99000-0x991FF   0.5 kB   parameter line construction area
534 ! 0x99200-0x9FFFF  27.5 kB   Extended BIOS Data Area
535
536 ! when LILO has loaded the kernel, and control is transfered to
537 ! the kernel setup.S code at 0x9020:0000
538 !
539 ! 0x007BE-0x007FD    64 B    partition table
540 ! 0x07C00-0x07DFF   0.5 kB   HD/FD boot load address
541 ! 0x10000-0x8FFFF 512.0 kB   kernel (zImage)
542 ! 0x90000-0x901FF   0.5 kB   kernel floppy boot sector (bootsect.S)
543 ! 0x90200-0x967FF  25.5 kB   kernel setup code (setup.S) and heap
544 ! 0x96800-0x987FF   8.0 kB   additional heap space
545 ! 0x98800-0x98FFF   2.0 kB   stack created for (setup.S)
546 ! 0x99000-0x991FF   0.5 kB   parameter line for kernel
547 ! 0x99200-0x9FFFF  27.5 kB   Extended BIOS Data Area
548
549 CL_MAGIC_ADDR   = 0x20                  ! command line magic number
550 CL_MAGIC        = 0xa33f                ! very unusual command sequence
551 CL_OFFSET       = 0x22                  ! command line offset
552 CL_LENGTH       = COMMAND_LINE_SIZE     ! maximum length = 256-1
553
554 ! 0x90020-0x90021     2 by   command line magic number
555 ! 0x90022-0x90023     2 by   command line offset
556
557 CL_HEADER_ID    = 0x202                 ! "HdrS"
558 CL_HDRS_VERSION = 0x206                 ! 0x0201=old;  0x0202=new
559 NEW_VERSION     = NEW2_HDR_VERSION      ! 0x0202 for new cmdline protocol
560 CL_POINTER      = 0x228                 ! new pointer is dword address
561 CL_RAMDISK_MAX  = CL_POINTER+4          ! ramdisk_max; header version 0x0203
562
563
564 #endif
565
566 /* Bug fix needed for some S-ATA controllers with the Silicon Image
567    3112 or 3114 chipsets.  Early versions of the SI BIOS do not properly
568    update the low memory size in the BIOS Data Area at 40h:13h when
569    they allocate space in the Extended BIOS Data Area (EBDA).
570 */
571 #ifdef LCF_BUG_SI_EBDA
572 # define EBDA_EXTRA LCF_BUG_SI_EBDA
573 #else
574 # define EBDA_EXTRA 0
575 #endif
576
577
578 /* the following configuration variable are now  required
579    don't compile without them ...
580  */
581
582 #ifndef LCF_UNIFY
583 # define LCF_UNIFY
584 #endif
585 #ifndef LCF_BUILTIN
586 # define LCF_BUILTIN
587 #endif
588 #ifndef LCF_FIRST6
589 # define LCF_FIRST6
590 #endif
591
592 #endif
593