1302025Swma/* 2302025Swma * Copyright (C) 2016 Cavium Inc. 3302025Swma * All rights reserved. 4302025Swma * 5302025Swma * Developed by Semihalf. 6302025Swma * Based on work by Nathan Whitehorn. 7302025Swma * 8302025Swma * Redistribution and use in source and binary forms, with or without 9302025Swma * modification, are permitted provided that the following conditions 10302025Swma * are met: 11302025Swma * 1. Redistributions of source code must retain the above copyright 12302025Swma * notice, this list of conditions and the following disclaimer. 13302025Swma * 2. Redistributions in binary form must reproduce the above copyright 14302025Swma * notice, this list of conditions and the following disclaimer in the 15302025Swma * documentation and/or other materials provided with the distribution. 16302025Swma * 17302025Swma * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18302025Swma * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19302025Swma * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20302025Swma * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21302025Swma * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22302025Swma * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23302025Swma * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24302025Swma * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25302025Swma * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26302025Swma * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27302025Swma * SUCH DAMAGE. 28302025Swma * 29302025Swma * $FreeBSD: stable/11/usr.sbin/bsdinstall/partedit/partedit_arm64.c 320088 2017-06-19 03:07:00Z emaste $ 30302025Swma */ 31302025Swma 32302025Swma#include <sys/types.h> 33302025Swma#include <string.h> 34302025Swma 35302025Swma#include "partedit.h" 36302025Swma 37320088Semaste/* EFI partition size in bytes */ 38320088Semaste#define EFI_BOOTPART_SIZE (200 * 1024 * 1024) 39302025Swma#define EFI_BOOTPART_PATH "/boot/boot1.efifat" 40302025Swma 41302025Swmaconst char * 42302025Swmadefault_scheme(void) 43302025Swma{ 44302025Swma 45302025Swma return ("GPT"); 46302025Swma} 47302025Swma 48302025Swmaint 49302025Swmais_scheme_bootable(const char *part_type) 50302025Swma{ 51302025Swma 52302025Swma if (strcmp(part_type, "GPT") == 0) 53302025Swma return (1); 54302025Swma 55302025Swma return (0); 56302025Swma} 57302025Swma 58302025Swmaint 59302025Swmais_fs_bootable(const char *part_type, const char *fs) 60302025Swma{ 61302025Swma 62302025Swma if (strcmp(fs, "freebsd-ufs") == 0) 63302025Swma return (1); 64302025Swma 65302025Swma return (0); 66302025Swma} 67302025Swma 68302025Swmasize_t 69302025Swmabootpart_size(const char *scheme) 70302025Swma{ 71302025Swma 72302025Swma /* We only support GPT with EFI */ 73302025Swma if (strcmp(scheme, "GPT") != 0) 74302025Swma return (0); 75302025Swma 76320088Semaste return (EFI_BOOTPART_SIZE); 77302025Swma} 78302025Swma 79302025Swmaconst char * 80302025Swmabootpart_type(const char *scheme) 81302025Swma{ 82302025Swma 83302025Swma /* Only EFI is supported as boot partition */ 84302025Swma return ("efi"); 85302025Swma} 86302025Swma 87302025Swmaconst char * 88302025Swmabootcode_path(const char *part_type) 89302025Swma{ 90302025Swma 91302025Swma return (NULL); 92302025Swma} 93302025Swma 94302025Swmaconst char * 95302025Swmapartcode_path(const char *part_type, const char *fs_type) 96302025Swma{ 97302025Swma 98302025Swma if (strcmp(part_type, "GPT") == 0) 99302025Swma return (EFI_BOOTPART_PATH); 100302025Swma 101302025Swma /* No boot partition data for non-GPT */ 102302025Swma return (NULL); 103302025Swma} 104302025Swma 105