18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * linux/include/linux/edd.h 48c2ecf20Sopenharmony_ci * Copyright (C) 2002, 2003, 2004 Dell Inc. 58c2ecf20Sopenharmony_ci * by Matt Domsch <Matt_Domsch@dell.com> 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * structures and definitions for the int 13h, ax={41,48}h 88c2ecf20Sopenharmony_ci * BIOS Enhanced Disk Drive Services 98c2ecf20Sopenharmony_ci * This is based on the T13 group document D1572 Revision 0 (August 14 2002) 108c2ecf20Sopenharmony_ci * available at http://www.t13.org/docs2002/d1572r0.pdf. It is 118c2ecf20Sopenharmony_ci * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * In a nutshell, arch/{i386,x86_64}/boot/setup.S populates a scratch 148c2ecf20Sopenharmony_ci * table in the boot_params that contains a list of BIOS-enumerated 158c2ecf20Sopenharmony_ci * boot devices. 168c2ecf20Sopenharmony_ci * In arch/{i386,x86_64}/kernel/setup.c, this information is 178c2ecf20Sopenharmony_ci * transferred into the edd structure, and in drivers/firmware/edd.c, that 188c2ecf20Sopenharmony_ci * information is used to identify BIOS boot disk. The code in setup.S 198c2ecf20Sopenharmony_ci * is very sensitive to the size of these structures. 208c2ecf20Sopenharmony_ci * 218c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 228c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License v2.0 as published by 238c2ecf20Sopenharmony_ci * the Free Software Foundation 248c2ecf20Sopenharmony_ci * 258c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, 268c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 278c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 288c2ecf20Sopenharmony_ci * GNU General Public License for more details. 298c2ecf20Sopenharmony_ci * 308c2ecf20Sopenharmony_ci */ 318c2ecf20Sopenharmony_ci#ifndef _UAPI_LINUX_EDD_H 328c2ecf20Sopenharmony_ci#define _UAPI_LINUX_EDD_H 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#include <linux/types.h> 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#define EDDNR 0x1e9 /* addr of number of edd_info structs at EDDBUF 378c2ecf20Sopenharmony_ci in boot_params - treat this as 1 byte */ 388c2ecf20Sopenharmony_ci#define EDDBUF 0xd00 /* addr of edd_info structs in boot_params */ 398c2ecf20Sopenharmony_ci#define EDDMAXNR 6 /* number of edd_info structs starting at EDDBUF */ 408c2ecf20Sopenharmony_ci#define EDDEXTSIZE 8 /* change these if you muck with the structures */ 418c2ecf20Sopenharmony_ci#define EDDPARMSIZE 74 428c2ecf20Sopenharmony_ci#define CHECKEXTENSIONSPRESENT 0x41 438c2ecf20Sopenharmony_ci#define GETDEVICEPARAMETERS 0x48 448c2ecf20Sopenharmony_ci#define LEGACYGETDEVICEPARAMETERS 0x08 458c2ecf20Sopenharmony_ci#define EDDMAGIC1 0x55AA 468c2ecf20Sopenharmony_ci#define EDDMAGIC2 0xAA55 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#define READ_SECTORS 0x02 /* int13 AH=0x02 is READ_SECTORS command */ 508c2ecf20Sopenharmony_ci#define EDD_MBR_SIG_OFFSET 0x1B8 /* offset of signature in the MBR */ 518c2ecf20Sopenharmony_ci#define EDD_MBR_SIG_BUF 0x290 /* addr in boot params */ 528c2ecf20Sopenharmony_ci#define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */ 538c2ecf20Sopenharmony_ci#define EDD_MBR_SIG_NR_BUF 0x1ea /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF 548c2ecf20Sopenharmony_ci in boot_params - treat this as 1 byte */ 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci#define EDD_EXT_FIXED_DISK_ACCESS (1 << 0) 598c2ecf20Sopenharmony_ci#define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1) 608c2ecf20Sopenharmony_ci#define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2) 618c2ecf20Sopenharmony_ci#define EDD_EXT_64BIT_EXTENSIONS (1 << 3) 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#define EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT (1 << 0) 648c2ecf20Sopenharmony_ci#define EDD_INFO_GEOMETRY_VALID (1 << 1) 658c2ecf20Sopenharmony_ci#define EDD_INFO_REMOVABLE (1 << 2) 668c2ecf20Sopenharmony_ci#define EDD_INFO_WRITE_VERIFY (1 << 3) 678c2ecf20Sopenharmony_ci#define EDD_INFO_MEDIA_CHANGE_NOTIFICATION (1 << 4) 688c2ecf20Sopenharmony_ci#define EDD_INFO_LOCKABLE (1 << 5) 698c2ecf20Sopenharmony_ci#define EDD_INFO_NO_MEDIA_PRESENT (1 << 6) 708c2ecf20Sopenharmony_ci#define EDD_INFO_USE_INT13_FN50 (1 << 7) 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_cistruct edd_device_params { 738c2ecf20Sopenharmony_ci __u16 length; 748c2ecf20Sopenharmony_ci __u16 info_flags; 758c2ecf20Sopenharmony_ci __u32 num_default_cylinders; 768c2ecf20Sopenharmony_ci __u32 num_default_heads; 778c2ecf20Sopenharmony_ci __u32 sectors_per_track; 788c2ecf20Sopenharmony_ci __u64 number_of_sectors; 798c2ecf20Sopenharmony_ci __u16 bytes_per_sector; 808c2ecf20Sopenharmony_ci __u32 dpte_ptr; /* 0xFFFFFFFF for our purposes */ 818c2ecf20Sopenharmony_ci __u16 key; /* = 0xBEDD */ 828c2ecf20Sopenharmony_ci __u8 device_path_info_length; /* = 44 */ 838c2ecf20Sopenharmony_ci __u8 reserved2; 848c2ecf20Sopenharmony_ci __u16 reserved3; 858c2ecf20Sopenharmony_ci __u8 host_bus_type[4]; 868c2ecf20Sopenharmony_ci __u8 interface_type[8]; 878c2ecf20Sopenharmony_ci union { 888c2ecf20Sopenharmony_ci struct { 898c2ecf20Sopenharmony_ci __u16 base_address; 908c2ecf20Sopenharmony_ci __u16 reserved1; 918c2ecf20Sopenharmony_ci __u32 reserved2; 928c2ecf20Sopenharmony_ci } __attribute__ ((packed)) isa; 938c2ecf20Sopenharmony_ci struct { 948c2ecf20Sopenharmony_ci __u8 bus; 958c2ecf20Sopenharmony_ci __u8 slot; 968c2ecf20Sopenharmony_ci __u8 function; 978c2ecf20Sopenharmony_ci __u8 channel; 988c2ecf20Sopenharmony_ci __u32 reserved; 998c2ecf20Sopenharmony_ci } __attribute__ ((packed)) pci; 1008c2ecf20Sopenharmony_ci /* pcix is same as pci */ 1018c2ecf20Sopenharmony_ci struct { 1028c2ecf20Sopenharmony_ci __u64 reserved; 1038c2ecf20Sopenharmony_ci } __attribute__ ((packed)) ibnd; 1048c2ecf20Sopenharmony_ci struct { 1058c2ecf20Sopenharmony_ci __u64 reserved; 1068c2ecf20Sopenharmony_ci } __attribute__ ((packed)) xprs; 1078c2ecf20Sopenharmony_ci struct { 1088c2ecf20Sopenharmony_ci __u64 reserved; 1098c2ecf20Sopenharmony_ci } __attribute__ ((packed)) htpt; 1108c2ecf20Sopenharmony_ci struct { 1118c2ecf20Sopenharmony_ci __u64 reserved; 1128c2ecf20Sopenharmony_ci } __attribute__ ((packed)) unknown; 1138c2ecf20Sopenharmony_ci } interface_path; 1148c2ecf20Sopenharmony_ci union { 1158c2ecf20Sopenharmony_ci struct { 1168c2ecf20Sopenharmony_ci __u8 device; 1178c2ecf20Sopenharmony_ci __u8 reserved1; 1188c2ecf20Sopenharmony_ci __u16 reserved2; 1198c2ecf20Sopenharmony_ci __u32 reserved3; 1208c2ecf20Sopenharmony_ci __u64 reserved4; 1218c2ecf20Sopenharmony_ci } __attribute__ ((packed)) ata; 1228c2ecf20Sopenharmony_ci struct { 1238c2ecf20Sopenharmony_ci __u8 device; 1248c2ecf20Sopenharmony_ci __u8 lun; 1258c2ecf20Sopenharmony_ci __u8 reserved1; 1268c2ecf20Sopenharmony_ci __u8 reserved2; 1278c2ecf20Sopenharmony_ci __u32 reserved3; 1288c2ecf20Sopenharmony_ci __u64 reserved4; 1298c2ecf20Sopenharmony_ci } __attribute__ ((packed)) atapi; 1308c2ecf20Sopenharmony_ci struct { 1318c2ecf20Sopenharmony_ci __u16 id; 1328c2ecf20Sopenharmony_ci __u64 lun; 1338c2ecf20Sopenharmony_ci __u16 reserved1; 1348c2ecf20Sopenharmony_ci __u32 reserved2; 1358c2ecf20Sopenharmony_ci } __attribute__ ((packed)) scsi; 1368c2ecf20Sopenharmony_ci struct { 1378c2ecf20Sopenharmony_ci __u64 serial_number; 1388c2ecf20Sopenharmony_ci __u64 reserved; 1398c2ecf20Sopenharmony_ci } __attribute__ ((packed)) usb; 1408c2ecf20Sopenharmony_ci struct { 1418c2ecf20Sopenharmony_ci __u64 eui; 1428c2ecf20Sopenharmony_ci __u64 reserved; 1438c2ecf20Sopenharmony_ci } __attribute__ ((packed)) i1394; 1448c2ecf20Sopenharmony_ci struct { 1458c2ecf20Sopenharmony_ci __u64 wwid; 1468c2ecf20Sopenharmony_ci __u64 lun; 1478c2ecf20Sopenharmony_ci } __attribute__ ((packed)) fibre; 1488c2ecf20Sopenharmony_ci struct { 1498c2ecf20Sopenharmony_ci __u64 identity_tag; 1508c2ecf20Sopenharmony_ci __u64 reserved; 1518c2ecf20Sopenharmony_ci } __attribute__ ((packed)) i2o; 1528c2ecf20Sopenharmony_ci struct { 1538c2ecf20Sopenharmony_ci __u32 array_number; 1548c2ecf20Sopenharmony_ci __u32 reserved1; 1558c2ecf20Sopenharmony_ci __u64 reserved2; 1568c2ecf20Sopenharmony_ci } __attribute__ ((packed)) raid; 1578c2ecf20Sopenharmony_ci struct { 1588c2ecf20Sopenharmony_ci __u8 device; 1598c2ecf20Sopenharmony_ci __u8 reserved1; 1608c2ecf20Sopenharmony_ci __u16 reserved2; 1618c2ecf20Sopenharmony_ci __u32 reserved3; 1628c2ecf20Sopenharmony_ci __u64 reserved4; 1638c2ecf20Sopenharmony_ci } __attribute__ ((packed)) sata; 1648c2ecf20Sopenharmony_ci struct { 1658c2ecf20Sopenharmony_ci __u64 reserved1; 1668c2ecf20Sopenharmony_ci __u64 reserved2; 1678c2ecf20Sopenharmony_ci } __attribute__ ((packed)) unknown; 1688c2ecf20Sopenharmony_ci } device_path; 1698c2ecf20Sopenharmony_ci __u8 reserved4; 1708c2ecf20Sopenharmony_ci __u8 checksum; 1718c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_cistruct edd_info { 1748c2ecf20Sopenharmony_ci __u8 device; 1758c2ecf20Sopenharmony_ci __u8 version; 1768c2ecf20Sopenharmony_ci __u16 interface_support; 1778c2ecf20Sopenharmony_ci __u16 legacy_max_cylinder; 1788c2ecf20Sopenharmony_ci __u8 legacy_max_head; 1798c2ecf20Sopenharmony_ci __u8 legacy_sectors_per_track; 1808c2ecf20Sopenharmony_ci struct edd_device_params params; 1818c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_cistruct edd { 1848c2ecf20Sopenharmony_ci unsigned int mbr_signature[EDD_MBR_SIG_MAX]; 1858c2ecf20Sopenharmony_ci struct edd_info edd_info[EDDMAXNR]; 1868c2ecf20Sopenharmony_ci unsigned char mbr_signature_nr; 1878c2ecf20Sopenharmony_ci unsigned char edd_info_nr; 1888c2ecf20Sopenharmony_ci}; 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci#endif /*!__ASSEMBLY__ */ 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci#endif /* _UAPI_LINUX_EDD_H */ 193