1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2607ca46eSDavid Howells /* 3607ca46eSDavid Howells * linux/include/linux/edd.h 4607ca46eSDavid Howells * Copyright (C) 2002, 2003, 2004 Dell Inc. 5607ca46eSDavid Howells * by Matt Domsch <Matt_Domsch@dell.com> 6607ca46eSDavid Howells * 7607ca46eSDavid Howells * structures and definitions for the int 13h, ax={41,48}h 8607ca46eSDavid Howells * BIOS Enhanced Disk Drive Services 9607ca46eSDavid Howells * This is based on the T13 group document D1572 Revision 0 (August 14 2002) 10607ca46eSDavid Howells * available at http://www.t13.org/docs2002/d1572r0.pdf. It is 11607ca46eSDavid Howells * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf 12607ca46eSDavid Howells * 13607ca46eSDavid Howells * In a nutshell, arch/{i386,x86_64}/boot/setup.S populates a scratch 14607ca46eSDavid Howells * table in the boot_params that contains a list of BIOS-enumerated 15607ca46eSDavid Howells * boot devices. 16607ca46eSDavid Howells * In arch/{i386,x86_64}/kernel/setup.c, this information is 17607ca46eSDavid Howells * transferred into the edd structure, and in drivers/firmware/edd.c, that 18607ca46eSDavid Howells * information is used to identify BIOS boot disk. The code in setup.S 19607ca46eSDavid Howells * is very sensitive to the size of these structures. 20607ca46eSDavid Howells * 21607ca46eSDavid Howells * This program is free software; you can redistribute it and/or modify 22607ca46eSDavid Howells * it under the terms of the GNU General Public License v2.0 as published by 23607ca46eSDavid Howells * the Free Software Foundation 24607ca46eSDavid Howells * 25607ca46eSDavid Howells * This program is distributed in the hope that it will be useful, 26607ca46eSDavid Howells * but WITHOUT ANY WARRANTY; without even the implied warranty of 27607ca46eSDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28607ca46eSDavid Howells * GNU General Public License for more details. 29607ca46eSDavid Howells * 30607ca46eSDavid Howells */ 31607ca46eSDavid Howells #ifndef _UAPI_LINUX_EDD_H 32607ca46eSDavid Howells #define _UAPI_LINUX_EDD_H 33607ca46eSDavid Howells 34607ca46eSDavid Howells #include <linux/types.h> 35607ca46eSDavid Howells 36607ca46eSDavid Howells #define EDDNR 0x1e9 /* addr of number of edd_info structs at EDDBUF 37607ca46eSDavid Howells in boot_params - treat this as 1 byte */ 38607ca46eSDavid Howells #define EDDBUF 0xd00 /* addr of edd_info structs in boot_params */ 39607ca46eSDavid Howells #define EDDMAXNR 6 /* number of edd_info structs starting at EDDBUF */ 40607ca46eSDavid Howells #define EDDEXTSIZE 8 /* change these if you muck with the structures */ 41607ca46eSDavid Howells #define EDDPARMSIZE 74 42607ca46eSDavid Howells #define CHECKEXTENSIONSPRESENT 0x41 43607ca46eSDavid Howells #define GETDEVICEPARAMETERS 0x48 44607ca46eSDavid Howells #define LEGACYGETDEVICEPARAMETERS 0x08 45607ca46eSDavid Howells #define EDDMAGIC1 0x55AA 46607ca46eSDavid Howells #define EDDMAGIC2 0xAA55 47607ca46eSDavid Howells 48607ca46eSDavid Howells 49607ca46eSDavid Howells #define READ_SECTORS 0x02 /* int13 AH=0x02 is READ_SECTORS command */ 50607ca46eSDavid Howells #define EDD_MBR_SIG_OFFSET 0x1B8 /* offset of signature in the MBR */ 51607ca46eSDavid Howells #define EDD_MBR_SIG_BUF 0x290 /* addr in boot params */ 52607ca46eSDavid Howells #define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */ 53607ca46eSDavid Howells #define EDD_MBR_SIG_NR_BUF 0x1ea /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF 54607ca46eSDavid Howells in boot_params - treat this as 1 byte */ 55607ca46eSDavid Howells 56607ca46eSDavid Howells #ifndef __ASSEMBLY__ 57607ca46eSDavid Howells 58607ca46eSDavid Howells #define EDD_EXT_FIXED_DISK_ACCESS (1 << 0) 59607ca46eSDavid Howells #define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1) 60607ca46eSDavid Howells #define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2) 61607ca46eSDavid Howells #define EDD_EXT_64BIT_EXTENSIONS (1 << 3) 62607ca46eSDavid Howells 63607ca46eSDavid Howells #define EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT (1 << 0) 64607ca46eSDavid Howells #define EDD_INFO_GEOMETRY_VALID (1 << 1) 65607ca46eSDavid Howells #define EDD_INFO_REMOVABLE (1 << 2) 66607ca46eSDavid Howells #define EDD_INFO_WRITE_VERIFY (1 << 3) 67607ca46eSDavid Howells #define EDD_INFO_MEDIA_CHANGE_NOTIFICATION (1 << 4) 68607ca46eSDavid Howells #define EDD_INFO_LOCKABLE (1 << 5) 69607ca46eSDavid Howells #define EDD_INFO_NO_MEDIA_PRESENT (1 << 6) 70607ca46eSDavid Howells #define EDD_INFO_USE_INT13_FN50 (1 << 7) 71607ca46eSDavid Howells 72607ca46eSDavid Howells struct edd_device_params { 73607ca46eSDavid Howells __u16 length; 74607ca46eSDavid Howells __u16 info_flags; 75607ca46eSDavid Howells __u32 num_default_cylinders; 76607ca46eSDavid Howells __u32 num_default_heads; 77607ca46eSDavid Howells __u32 sectors_per_track; 78607ca46eSDavid Howells __u64 number_of_sectors; 79607ca46eSDavid Howells __u16 bytes_per_sector; 80607ca46eSDavid Howells __u32 dpte_ptr; /* 0xFFFFFFFF for our purposes */ 81607ca46eSDavid Howells __u16 key; /* = 0xBEDD */ 82607ca46eSDavid Howells __u8 device_path_info_length; /* = 44 */ 83607ca46eSDavid Howells __u8 reserved2; 84607ca46eSDavid Howells __u16 reserved3; 85607ca46eSDavid Howells __u8 host_bus_type[4]; 86607ca46eSDavid Howells __u8 interface_type[8]; 87607ca46eSDavid Howells union { 88607ca46eSDavid Howells struct { 89607ca46eSDavid Howells __u16 base_address; 90607ca46eSDavid Howells __u16 reserved1; 91607ca46eSDavid Howells __u32 reserved2; 92607ca46eSDavid Howells } __attribute__ ((packed)) isa; 93607ca46eSDavid Howells struct { 94607ca46eSDavid Howells __u8 bus; 95607ca46eSDavid Howells __u8 slot; 96607ca46eSDavid Howells __u8 function; 97607ca46eSDavid Howells __u8 channel; 98607ca46eSDavid Howells __u32 reserved; 99607ca46eSDavid Howells } __attribute__ ((packed)) pci; 100607ca46eSDavid Howells /* pcix is same as pci */ 101607ca46eSDavid Howells struct { 102607ca46eSDavid Howells __u64 reserved; 103607ca46eSDavid Howells } __attribute__ ((packed)) ibnd; 104607ca46eSDavid Howells struct { 105607ca46eSDavid Howells __u64 reserved; 106607ca46eSDavid Howells } __attribute__ ((packed)) xprs; 107607ca46eSDavid Howells struct { 108607ca46eSDavid Howells __u64 reserved; 109607ca46eSDavid Howells } __attribute__ ((packed)) htpt; 110607ca46eSDavid Howells struct { 111607ca46eSDavid Howells __u64 reserved; 112607ca46eSDavid Howells } __attribute__ ((packed)) unknown; 113607ca46eSDavid Howells } interface_path; 114607ca46eSDavid Howells union { 115607ca46eSDavid Howells struct { 116607ca46eSDavid Howells __u8 device; 117607ca46eSDavid Howells __u8 reserved1; 118607ca46eSDavid Howells __u16 reserved2; 119607ca46eSDavid Howells __u32 reserved3; 120607ca46eSDavid Howells __u64 reserved4; 121607ca46eSDavid Howells } __attribute__ ((packed)) ata; 122607ca46eSDavid Howells struct { 123607ca46eSDavid Howells __u8 device; 124607ca46eSDavid Howells __u8 lun; 125607ca46eSDavid Howells __u8 reserved1; 126607ca46eSDavid Howells __u8 reserved2; 127607ca46eSDavid Howells __u32 reserved3; 128607ca46eSDavid Howells __u64 reserved4; 129607ca46eSDavid Howells } __attribute__ ((packed)) atapi; 130607ca46eSDavid Howells struct { 131607ca46eSDavid Howells __u16 id; 132607ca46eSDavid Howells __u64 lun; 133607ca46eSDavid Howells __u16 reserved1; 134607ca46eSDavid Howells __u32 reserved2; 135607ca46eSDavid Howells } __attribute__ ((packed)) scsi; 136607ca46eSDavid Howells struct { 137607ca46eSDavid Howells __u64 serial_number; 138607ca46eSDavid Howells __u64 reserved; 139607ca46eSDavid Howells } __attribute__ ((packed)) usb; 140607ca46eSDavid Howells struct { 141607ca46eSDavid Howells __u64 eui; 142607ca46eSDavid Howells __u64 reserved; 143607ca46eSDavid Howells } __attribute__ ((packed)) i1394; 144607ca46eSDavid Howells struct { 145607ca46eSDavid Howells __u64 wwid; 146607ca46eSDavid Howells __u64 lun; 147607ca46eSDavid Howells } __attribute__ ((packed)) fibre; 148607ca46eSDavid Howells struct { 149607ca46eSDavid Howells __u64 identity_tag; 150607ca46eSDavid Howells __u64 reserved; 151607ca46eSDavid Howells } __attribute__ ((packed)) i2o; 152607ca46eSDavid Howells struct { 153607ca46eSDavid Howells __u32 array_number; 154607ca46eSDavid Howells __u32 reserved1; 155607ca46eSDavid Howells __u64 reserved2; 156607ca46eSDavid Howells } __attribute__ ((packed)) raid; 157607ca46eSDavid Howells struct { 158607ca46eSDavid Howells __u8 device; 159607ca46eSDavid Howells __u8 reserved1; 160607ca46eSDavid Howells __u16 reserved2; 161607ca46eSDavid Howells __u32 reserved3; 162607ca46eSDavid Howells __u64 reserved4; 163607ca46eSDavid Howells } __attribute__ ((packed)) sata; 164607ca46eSDavid Howells struct { 165607ca46eSDavid Howells __u64 reserved1; 166607ca46eSDavid Howells __u64 reserved2; 167607ca46eSDavid Howells } __attribute__ ((packed)) unknown; 168607ca46eSDavid Howells } device_path; 169607ca46eSDavid Howells __u8 reserved4; 170607ca46eSDavid Howells __u8 checksum; 171607ca46eSDavid Howells } __attribute__ ((packed)); 172607ca46eSDavid Howells 173607ca46eSDavid Howells struct edd_info { 174607ca46eSDavid Howells __u8 device; 175607ca46eSDavid Howells __u8 version; 176607ca46eSDavid Howells __u16 interface_support; 177607ca46eSDavid Howells __u16 legacy_max_cylinder; 178607ca46eSDavid Howells __u8 legacy_max_head; 179607ca46eSDavid Howells __u8 legacy_sectors_per_track; 180607ca46eSDavid Howells struct edd_device_params params; 181607ca46eSDavid Howells } __attribute__ ((packed)); 182607ca46eSDavid Howells 183607ca46eSDavid Howells struct edd { 184607ca46eSDavid Howells unsigned int mbr_signature[EDD_MBR_SIG_MAX]; 185607ca46eSDavid Howells struct edd_info edd_info[EDDMAXNR]; 186607ca46eSDavid Howells unsigned char mbr_signature_nr; 187607ca46eSDavid Howells unsigned char edd_info_nr; 188607ca46eSDavid Howells }; 189607ca46eSDavid Howells 190607ca46eSDavid Howells #endif /*!__ASSEMBLY__ */ 191607ca46eSDavid Howells 192607ca46eSDavid Howells #endif /* _UAPI_LINUX_EDD_H */ 193