16 #include <linux/adfs_fs.h>
24 #define PARTITION_RISCIX_MFM 1
25 #define PARTITION_RISCIX_SCSI 2
26 #define PARTITION_LINUX 9
28 #if defined(CONFIG_ACORN_PARTITION_CUMANA) || \
29 defined(CONFIG_ACORN_PARTITION_ADFS)
32 unsigned long first_sector,
int slot)
35 unsigned int nr_sects;
37 if (adfs_checkbblk(data))
53 put_partition(state, slot, first_sector, nr_sects);
58 #ifdef CONFIG_ACORN_PARTITION_RISCIX
67 struct riscix_record {
69 #define RISCIX_MAGIC cpu_to_le32(0x4a657320)
71 struct riscix_part
part[8];
74 #if defined(CONFIG_ACORN_PARTITION_CUMANA) || \
75 defined(CONFIG_ACORN_PARTITION_ADFS)
77 unsigned long first_sect,
int slot,
78 unsigned long nr_sects)
81 struct riscix_record *rr;
83 rr = read_part_sector(state, first_sect, §);
90 if (rr->magic == RISCIX_MAGIC) {
91 unsigned long size = nr_sects > 2 ? 2 : nr_sects;
96 put_partition(state, slot++, first_sect, size);
97 for (part = 0; part < 8; part++) {
98 if (rr->part[part].one &&
99 memcmp(rr->part[part].name,
"All\0", 4)) {
100 put_partition(state, slot++,
111 put_partition(state, slot++, first_sect, nr_sects);
114 put_dev_sector(sect);
120 #define LINUX_NATIVE_MAGIC 0xdeafa1de
121 #define LINUX_SWAP_MAGIC 0xdeafab1e
129 #if defined(CONFIG_ACORN_PARTITION_CUMANA) || \
130 defined(CONFIG_ACORN_PARTITION_ADFS)
132 unsigned long first_sect,
int slot,
133 unsigned long nr_sects)
137 unsigned long size = nr_sects > 2 ? 2 :
nr_sects;
141 put_partition(state, slot++, first_sect, size);
143 linuxp = read_part_sector(state, first_sect, §);
150 if (slot == state->
limit)
152 put_partition(state, slot++, first_sect +
159 put_dev_sector(sect);
164 #ifdef CONFIG_ACORN_PARTITION_CUMANA
167 unsigned long first_sector = 0;
168 unsigned int start_blk = 0;
171 char *
name =
"CUMANA/ADFS";
190 unsigned int nr_sects;
192 data = read_part_sector(state, start_blk * 2 + 6, §);
196 if (slot == state->
limit)
199 dr = adfs_partition(state, name, data, first_sector, slot++);
205 nr_sects = (data[0x1fd] + (data[0x1fe] << 8)) *
213 first_sector += nr_sects;
217 switch (data[0x1fc] & 15) {
221 #ifdef CONFIG_ACORN_PARTITION_RISCIX
224 slot = riscix_partition(state, first_sector, slot,
230 slot = linux_partition(state, first_sector, slot,
234 put_dev_sector(sect);
238 put_dev_sector(sect);
239 return first ? 0 : 1;
243 #ifdef CONFIG_ACORN_PARTITION_ADFS
258 unsigned long start_sect, nr_sects, sectscyl,
heads;
265 data = read_part_sector(state, 6, §);
269 dr = adfs_partition(state,
"ADFS", data, 0, slot++);
271 put_dev_sector(sect);
277 start_sect = ((data[0x1fe] << 8) + data[0x1fd]) * sectscyl;
278 id = data[0x1fc] & 15;
279 put_dev_sector(sect);
284 nr_sects = (state->
bdev->bd_inode->i_size >> 9) - start_sect;
288 #ifdef CONFIG_ACORN_PARTITION_RISCIX
291 slot = riscix_partition(state, start_sect, slot,
297 slot = linux_partition(state, start_sect, slot,
307 #ifdef CONFIG_ACORN_PARTITION_ICS
318 unsigned char *data = read_part_sector(state, block, §);
322 if (
memcmp(data,
"LinuxPart", 9) == 0)
324 put_dev_sector(sect);
333 static inline int valid_ics_sector(
const unsigned char *data)
338 for (i = 0, sum = 0x50617274; i < 508; i++)
358 const unsigned char *
data;
359 const struct ics_part *
p;
366 data = read_part_sector(state, 0, §);
370 if (!valid_ics_sector(data)) {
371 put_dev_sector(sect);
377 for (slot = 1, p = (
const struct ics_part *)data; p->size; p++) {
381 if (slot == state->
limit)
398 if (size > 1 && adfspart_check_ICSLinux(state, start)) {
405 put_partition(state, slot++, start, size);
408 put_dev_sector(sect);
414 #ifdef CONFIG_ACORN_PARTITION_POWERTEC
424 static inline int valid_ptec_sector(
const unsigned char *data)
433 if (data[510] == 0x55 && data[511] == 0xaa)
436 for (i = 0; i < 511; i++)
439 return checksum == data[511];
455 const unsigned char *
data;
456 const struct ptec_part *
p;
460 data = read_part_sector(state, 0, §);
464 if (!valid_ptec_sector(data)) {
465 put_dev_sector(sect);
471 for (i = 0, p = (
const struct ptec_part *)data; i < 12; i++, p++) {
476 put_partition(state, slot++, start, size);
479 put_dev_sector(sect);
485 #ifdef CONFIG_ACORN_PARTITION_EESOX
498 static const char eesox_name[] = {
499 'N',
'e',
'i',
'l',
' ',
500 'C',
'r',
'i',
't',
'c',
'h',
'e',
'l',
'l',
' ',
' '
516 const unsigned char *
data;
517 unsigned char buffer[256];
518 struct eesox_part *
p;
522 data = read_part_sector(state, 7, §);
529 for (i = 0; i < 256; i++)
530 buffer[i] = data[i] ^ eesox_name[i & 15];
532 put_dev_sector(sect);
534 for (i = 0, p = (
struct eesox_part *)buffer; i < 8; i++, p++) {
537 if (
memcmp(p->magic,
"Eesox", 6))
542 put_partition(state, slot++, start, next - start);
549 size = get_capacity(state->
bdev->bd_disk);
550 put_partition(state, slot++, start, size - start);