+/* GPT partition format */
+static int gpt_magic_present(unsigned char *block_buffer, unsigned int prom_blksize)
+{
+ struct gpt_header *header = (struct gpt_header *)(block_buffer + prom_blksize);
+ return cpu_to_le64(header->signature) == GPT_HEADER_SIGNATURE;
+}
+
+static inline int
+guid_cmp (gpt_part_type_t left, gpt_part_type_t right)
+{
+ return memcmp(&left, &right, sizeof (gpt_part_type_t));
+}
+
+static void partition_gpt_lookup(prom_handle disk, unsigned int prom_blksize,
+ struct partition_t **list)
+{
+ int partition;
+ struct gpt_header *header = (struct gpt_header *)(block_buffer + prom_blksize);
+
+ if (prom_readblocks(disk, cpu_to_le64(header->partitions), 1, block_buffer) != 1) {
+ prom_printf("Can't read GPT partition table %Lu\n", header->partitions);
+ return;
+ }
+ struct gpt_partition *part = (struct gpt_partition *)(block_buffer);
+
+ for (partition = 1; partition <= cpu_to_le32(header->maxpart); partition++, part++) {
+ if ((!guid_cmp(part->type, GPT_BASIC_DATA))||(!guid_cmp(part->type, GPT_LINUX_NATIVE))||(!guid_cmp(part->type, GPT_LINUX_RAID))) {
+ add_new_partition(list, partition, "Linux", 0, le64_to_cpu(part->start), \
+ cpu_to_le64(part->end) - cpu_to_le64(part->start) + 1, \
+ prom_blksize, 1);
+ }
+ }
+}
+
+