Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * linux/include/linux/edd.h
0004  *  Copyright (C) 2002, 2003, 2004 Dell Inc.
0005  *  by Matt Domsch <Matt_Domsch@dell.com>
0006  *
0007  * structures and definitions for the int 13h, ax={41,48}h
0008  * BIOS Enhanced Disk Drive Services
0009  * This is based on the T13 group document D1572 Revision 0 (August 14 2002)
0010  * available at http://www.t13.org/docs2002/d1572r0.pdf.  It is
0011  * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf
0012  *
0013  * In a nutshell, arch/{i386,x86_64}/boot/setup.S populates a scratch
0014  * table in the boot_params that contains a list of BIOS-enumerated
0015  * boot devices.
0016  * In arch/{i386,x86_64}/kernel/setup.c, this information is
0017  * transferred into the edd structure, and in drivers/firmware/edd.c, that
0018  * information is used to identify BIOS boot disk.  The code in setup.S
0019  * is very sensitive to the size of these structures.
0020  *
0021  * This program is free software; you can redistribute it and/or modify
0022  * it under the terms of the GNU General Public License v2.0 as published by
0023  * the Free Software Foundation
0024  *
0025  * This program is distributed in the hope that it will be useful,
0026  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0027  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0028  * GNU General Public License for more details.
0029  *
0030  */
0031 #ifndef _UAPI_LINUX_EDD_H
0032 #define _UAPI_LINUX_EDD_H
0033 
0034 #include <linux/types.h>
0035 
0036 #define EDDNR 0x1e9     /* addr of number of edd_info structs at EDDBUF
0037                    in boot_params - treat this as 1 byte  */
0038 #define EDDBUF  0xd00       /* addr of edd_info structs in boot_params */
0039 #define EDDMAXNR 6      /* number of edd_info structs starting at EDDBUF  */
0040 #define EDDEXTSIZE 8        /* change these if you muck with the structures */
0041 #define EDDPARMSIZE 74
0042 #define CHECKEXTENSIONSPRESENT 0x41
0043 #define GETDEVICEPARAMETERS 0x48
0044 #define LEGACYGETDEVICEPARAMETERS 0x08
0045 #define EDDMAGIC1 0x55AA
0046 #define EDDMAGIC2 0xAA55
0047 
0048 
0049 #define READ_SECTORS 0x02         /* int13 AH=0x02 is READ_SECTORS command */
0050 #define EDD_MBR_SIG_OFFSET 0x1B8  /* offset of signature in the MBR */
0051 #define EDD_MBR_SIG_BUF    0x290  /* addr in boot params */
0052 #define EDD_MBR_SIG_MAX 16        /* max number of signatures to store */
0053 #define EDD_MBR_SIG_NR_BUF 0x1ea  /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF
0054                      in boot_params - treat this as 1 byte  */
0055 
0056 #ifndef __ASSEMBLY__
0057 
0058 #define EDD_EXT_FIXED_DISK_ACCESS           (1 << 0)
0059 #define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1)
0060 #define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2)
0061 #define EDD_EXT_64BIT_EXTENSIONS            (1 << 3)
0062 
0063 #define EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT (1 << 0)
0064 #define EDD_INFO_GEOMETRY_VALID                (1 << 1)
0065 #define EDD_INFO_REMOVABLE                     (1 << 2)
0066 #define EDD_INFO_WRITE_VERIFY                  (1 << 3)
0067 #define EDD_INFO_MEDIA_CHANGE_NOTIFICATION     (1 << 4)
0068 #define EDD_INFO_LOCKABLE                      (1 << 5)
0069 #define EDD_INFO_NO_MEDIA_PRESENT              (1 << 6)
0070 #define EDD_INFO_USE_INT13_FN50                (1 << 7)
0071 
0072 struct edd_device_params {
0073     __u16 length;
0074     __u16 info_flags;
0075     __u32 num_default_cylinders;
0076     __u32 num_default_heads;
0077     __u32 sectors_per_track;
0078     __u64 number_of_sectors;
0079     __u16 bytes_per_sector;
0080     __u32 dpte_ptr;     /* 0xFFFFFFFF for our purposes */
0081     __u16 key;      /* = 0xBEDD */
0082     __u8 device_path_info_length;   /* = 44 */
0083     __u8 reserved2;
0084     __u16 reserved3;
0085     __u8 host_bus_type[4];
0086     __u8 interface_type[8];
0087     union {
0088         struct {
0089             __u16 base_address;
0090             __u16 reserved1;
0091             __u32 reserved2;
0092         } __attribute__ ((packed)) isa;
0093         struct {
0094             __u8 bus;
0095             __u8 slot;
0096             __u8 function;
0097             __u8 channel;
0098             __u32 reserved;
0099         } __attribute__ ((packed)) pci;
0100         /* pcix is same as pci */
0101         struct {
0102             __u64 reserved;
0103         } __attribute__ ((packed)) ibnd;
0104         struct {
0105             __u64 reserved;
0106         } __attribute__ ((packed)) xprs;
0107         struct {
0108             __u64 reserved;
0109         } __attribute__ ((packed)) htpt;
0110         struct {
0111             __u64 reserved;
0112         } __attribute__ ((packed)) unknown;
0113     } interface_path;
0114     union {
0115         struct {
0116             __u8 device;
0117             __u8 reserved1;
0118             __u16 reserved2;
0119             __u32 reserved3;
0120             __u64 reserved4;
0121         } __attribute__ ((packed)) ata;
0122         struct {
0123             __u8 device;
0124             __u8 lun;
0125             __u8 reserved1;
0126             __u8 reserved2;
0127             __u32 reserved3;
0128             __u64 reserved4;
0129         } __attribute__ ((packed)) atapi;
0130         struct {
0131             __u16 id;
0132             __u64 lun;
0133             __u16 reserved1;
0134             __u32 reserved2;
0135         } __attribute__ ((packed)) scsi;
0136         struct {
0137             __u64 serial_number;
0138             __u64 reserved;
0139         } __attribute__ ((packed)) usb;
0140         struct {
0141             __u64 eui;
0142             __u64 reserved;
0143         } __attribute__ ((packed)) i1394;
0144         struct {
0145             __u64 wwid;
0146             __u64 lun;
0147         } __attribute__ ((packed)) fibre;
0148         struct {
0149             __u64 identity_tag;
0150             __u64 reserved;
0151         } __attribute__ ((packed)) i2o;
0152         struct {
0153             __u32 array_number;
0154             __u32 reserved1;
0155             __u64 reserved2;
0156         } __attribute__ ((packed)) raid;
0157         struct {
0158             __u8 device;
0159             __u8 reserved1;
0160             __u16 reserved2;
0161             __u32 reserved3;
0162             __u64 reserved4;
0163         } __attribute__ ((packed)) sata;
0164         struct {
0165             __u64 reserved1;
0166             __u64 reserved2;
0167         } __attribute__ ((packed)) unknown;
0168     } device_path;
0169     __u8 reserved4;
0170     __u8 checksum;
0171 } __attribute__ ((packed));
0172 
0173 struct edd_info {
0174     __u8 device;
0175     __u8 version;
0176     __u16 interface_support;
0177     __u16 legacy_max_cylinder;
0178     __u8 legacy_max_head;
0179     __u8 legacy_sectors_per_track;
0180     struct edd_device_params params;
0181 } __attribute__ ((packed));
0182 
0183 struct edd {
0184     unsigned int mbr_signature[EDD_MBR_SIG_MAX];
0185     struct edd_info edd_info[EDDMAXNR];
0186     unsigned char mbr_signature_nr;
0187     unsigned char edd_info_nr;
0188 };
0189 
0190 #endif              /*!__ASSEMBLY__ */
0191 
0192 #endif /* _UAPI_LINUX_EDD_H */