Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / common / boot / grub2 / grub2-aros.diff
blob1440589de0510b8ab6e99906e6314c245a1040e8
1 diff -ur -x .svn ./grub2-1919/fs/affs.c ./grub2/fs/affs.c
2 --- ./grub2-1919/fs/affs.c 2008-11-20 16:40:19.000000000 +0100
3 +++ ./grub2/fs/affs.c 2008-11-20 19:16:38.000000000 +0100
4 @@ -25,6 +25,9 @@
5 #include <grub/dl.h>
6 #include <grub/types.h>
7 #include <grub/fshelp.h>
8 +#ifdef __AROS__
9 +#include <grub/partition.h>
10 +#endif
12 /* The affs bootblock. */
13 struct grub_affs_bblock
14 @@ -210,8 +213,22 @@
15 rblock = (struct grub_affs_rblock *) rootblock;
17 /* Read the rootblock. */
18 +#ifdef __AROS__
19 + grub_uint64_t reservedblocks = 2;
20 + grub_uint64_t countblocks;
21 + if (disk->partition)
22 + countblocks = disk->partition->len;
23 + else
24 + countblocks = disk->total_sectors;
26 + grub_disk_addr_t rblknum = (countblocks - 1 + reservedblocks) / 2;
28 + grub_disk_read (disk, rblknum, 0,
29 + GRUB_DISK_SECTOR_SIZE * 16, (char *) rootblock);
30 +#else
31 grub_disk_read (disk, (disk->total_sectors >> 1) + blocksize, 0,
32 GRUB_DISK_SECTOR_SIZE * 16, (char *) rootblock);
33 +#endif
34 if (grub_errno)
35 goto fail;
37 @@ -242,7 +259,11 @@
38 data->disk = disk;
39 data->htsize = grub_be_to_cpu32 (rblock->htsize);
40 data->diropen.data = data;
41 +#ifdef __AROS__
42 + data->diropen.block = rblknum;
43 +#else
44 data->diropen.block = (disk->total_sectors >> 1);
45 +#endif
47 grub_free (rootblock);
49 @@ -381,7 +402,7 @@
50 fail:
51 grub_free (node);
52 grub_free (hashtable);
53 - return 1;
54 + return 0;
58 diff -ur -x .svn ./grub2-1919/fs/sfs.c ./grub2/fs/sfs.c
59 --- ./grub2-1919/fs/sfs.c 2008-11-20 16:40:19.000000000 +0100
60 +++ ./grub2/fs/sfs.c 2008-11-20 19:21:53.000000000 +0100
61 @@ -172,7 +172,8 @@
62 return grub_errno;
65 - for (i = 0; i < grub_be_to_cpu16 (tree->nodes); i++)
66 + grub_uint16_t nodescount = grub_be_to_cpu16(tree->nodes);
67 + for (i = nodescount - 1; i >= 0; i--)
70 #define EXTNODE(tree, index) \
71 @@ -180,17 +181,9 @@
72 + (index) * (tree)->nodesize))
74 /* Follow the tree down to the leaf level. */
75 - if ((grub_be_to_cpu32 (EXTNODE(tree, i)->key) >= block)
76 + if ((grub_be_to_cpu32 (EXTNODE(tree, i)->key) <= block)
77 && !tree->leaf)
79 - next = grub_be_to_cpu32 (EXTNODE (tree, i - 1)->data);
80 - break;
81 - }
83 - /* In case the last node is reached just use that one, it is
84 - the right match. */
85 - if (i + 1 == grub_be_to_cpu16 (tree->nodes) && !tree->leaf)
86 - {
87 next = grub_be_to_cpu32 (EXTNODE (tree, i)->data);
88 break;
90 @@ -451,7 +444,7 @@
92 fail:
93 grub_free (objc_data);
94 - return 1;
95 + return 0;
99 diff -ur -x .svn ./grub2-1919/include/grub/pc_partition.h ./grub2/include/grub/pc_partition.h
100 --- ./grub2-1919/include/grub/pc_partition.h 2008-11-20 16:40:22.000000000 +0100
101 +++ ./grub2/include/grub/pc_partition.h 2008-11-20 18:41:04.000000000 +0100
102 @@ -206,4 +206,10 @@
103 || type == GRUB_PC_PARTITION_TYPE_NETBSD);
106 +static inline int
107 +grub_pc_partition_is_rdb(int type)
109 + return (type == 0x30 || type == 0x76);
112 #endif /* ! GRUB_PC_PARTITION_HEADER */
113 diff -ur -x .svn ./grub2-1919/loader/i386/pc/multiboot.c ./grub2/loader/i386/pc/multiboot.c
114 --- ./grub2-1919/loader/i386/pc/multiboot.c 2008-11-20 16:40:28.000000000 +0100
115 +++ ./grub2/loader/i386/pc/multiboot.c 2008-11-20 19:48:44.000000000 +0100
116 @@ -189,8 +189,8 @@
117 return grub_error (GRUB_ERR_BAD_OS,
118 "invalid offset in program header");
120 - if (grub_file_read (file, load_this_module_at, phdr(i)->p_filesz)
121 - != (grub_ssize_t) phdr(i)->p_filesz)
122 + if ((phdr(i)->p_filesz > 0) && (grub_file_read (file, load_this_module_at, phdr(i)->p_filesz)
123 + != (grub_ssize_t) phdr(i)->p_filesz))
124 return grub_error (GRUB_ERR_BAD_OS,
125 "couldn't read segment from file");
127 @@ -274,9 +274,9 @@
128 return grub_error (GRUB_ERR_BAD_OS,
129 "invalid offset in program header");
131 - if (grub_file_read (file, (void *) ((grub_uint32_t) phdr(i)->p_paddr),
132 + if ((phdr(i)->p_filesz > 0) && (grub_file_read (file, (void *) ((grub_uint32_t) phdr(i)->p_paddr),
133 phdr(i)->p_filesz)
134 - != (grub_ssize_t) phdr(i)->p_filesz)
135 + != (grub_ssize_t) phdr(i)->p_filesz))
136 return grub_error (GRUB_ERR_BAD_OS,
137 "couldn't read segment from file");
139 diff -ur -x .svn ./grub2-1919/partmap/amiga.c ./grub2/partmap/amiga.c
140 --- ./grub2-1919/partmap/amiga.c 2008-11-20 16:40:26.000000000 +0100
141 +++ ./grub2/partmap/amiga.c 2008-11-20 18:44:40.000000000 +0100
142 @@ -87,7 +87,10 @@
144 /* Enforce raw disk access. */
145 raw = *disk;
146 +#ifndef __AROS__
147 raw.partition = 0;
148 +#endif
149 + part.data = NULL;
151 /* The RDSK block is one of the first 15 blocks. */
152 for (pos = 0; pos < 15; pos++)
153 @@ -210,6 +213,10 @@
155 GRUB_MOD_INIT(amiga_partition_map)
157 +#ifdef __AROS__
158 + extern struct grub_partition_map *grub_rdb_partition_map;
159 + grub_rdb_partition_map = &grub_amiga_partition_map;
160 +#endif
161 grub_partition_map_register (&grub_amiga_partition_map);
162 #ifndef GRUB_UTIL
163 my_mod = mod;
164 diff -ur -x .svn ./grub2-1919/partmap/pc.c ./grub2/partmap/pc.c
165 --- ./grub2-1919/partmap/pc.c 2008-11-20 16:40:26.000000000 +0100
166 +++ ./grub2/partmap/pc.c 2008-11-20 18:54:46.000000000 +0100
167 @@ -24,6 +24,9 @@
168 #include <grub/misc.h>
169 #include <grub/dl.h>
171 +/* RDB partition tables for AROS */
172 +struct grub_partition_map *grub_rdb_partition_map = NULL;
174 static struct grub_partition_map grub_pc_partition_map;
176 #ifndef GRUB_UTIL
177 @@ -152,8 +155,45 @@
179 pcdata.dos_part++;
181 - if (hook (disk, &p))
182 - return 1;
185 + /* Check if this is a RDB partition table. */
186 + if (grub_rdb_partition_map && grub_pc_partition_is_rdb(e->type))
188 + struct grub_partition p2;
189 + struct grub_disk raw2;
190 + int ok = 0;
192 + auto int rdb_hook(grub_disk_t disk, const grub_partition_t p);
194 + int rdb_hook(grub_disk_t disk __attribute__((unused)),
195 + const grub_partition_t part)
197 + p2 = *part;
198 + pcdata.bsd_part = part->index;
200 + p2.start += p.start;
201 + p2.offset += p.offset;
202 + p2.data = &pcdata;
203 + p2.partmap = &grub_pc_partition_map;
205 + grub_dprintf("partition", "RDB part %c start=%ld\n",
206 + (char)('a' + part->index), (long)p2.start);
208 + ok = hook(disk, &p2);
209 + return ok;
212 + raw2 = raw;
213 + raw2.partition = &p;
215 + grub_rdb_partition_map->iterate(&raw2, rdb_hook);
216 + if (ok)
217 + goto finish;
219 + else
220 + if (hook (disk, &p))
221 + return 1;
223 /* Check if this is a BSD partition. */
224 if (grub_pc_partition_is_bsd (e->type))
225 diff -ur -x .svn ./grub2-1919/util/grub-fstest.c ./grub2/util/grub-fstest.c
226 --- ./grub2-1919/util/grub-fstest.c 2008-11-20 16:40:31.000000000 +0100
227 +++ ./grub2/util/grub-fstest.c 2008-11-20 18:10:15.000000000 +0100
228 @@ -53,13 +53,13 @@
229 return -1;
232 -grub_term_t
233 +grub_term_input_t
234 grub_term_get_current_input (void)
236 return 0;
239 -grub_term_t
240 +grub_term_output_t
241 grub_term_get_current_output (void)
243 return 0;