aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/hdparm.c153
1 files changed, 11 insertions, 142 deletions
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 258655689..896dcbc2d 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -28,7 +28,6 @@
28#include "busybox.h" 28#include "busybox.h"
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/hdreg.h> 30#include <linux/hdreg.h>
31#include <linux/major.h>
32#include <asm/byteorder.h> 31#include <asm/byteorder.h>
33 32
34 33
@@ -630,7 +629,7 @@ static void print_ascii(uint16_t *p, uint8_t length) {
630 others, though, were declared in hdparm.c with global scope; since other 629 others, though, were declared in hdparm.c with global scope; since other
631 functions in that file have static (file) scope, I assume the difference is 630 functions in that file have static (file) scope, I assume the difference is
632 intentional. */ 631 intentional. */
633static void identify(uint16_t *id_supplied, const char *devname) 632static void identify(uint16_t *id_supplied)
634{ 633{
635 uint16_t buf[256]; 634 uint16_t buf[256];
636 uint16_t *val, ii, jj, kk; 635 uint16_t *val, ii, jj, kk;
@@ -1200,7 +1199,7 @@ static void identify(uint16_t *id_supplied, const char *devname)
1200#endif 1199#endif
1201 1200
1202static int verbose, get_identity, get_geom, noisy = 1, quiet; 1201static int verbose, get_identity, get_geom, noisy = 1, quiet;
1203static int flagcount, do_flush, is_scsi_hd, is_xt_hd; 1202static int flagcount, do_flush;
1204static int do_ctimings, do_timings; 1203static int do_ctimings, do_timings;
1205 1204
1206static unsigned long set_readahead, get_readahead, Xreadahead; 1205static unsigned long set_readahead, get_readahead, Xreadahead;
@@ -1620,26 +1619,6 @@ quit:
1620 bb_error_msg(bb_msg_shared_mem,"detach"); /*"could not detach sharedmem buf"*/ 1619 bb_error_msg(bb_msg_shared_mem,"detach"); /*"could not detach sharedmem buf"*/
1621} 1620}
1622 1621
1623
1624static void no_scsi(void)
1625{
1626 /*" operation not supported on SCSI disks"*/
1627 if (is_scsi_hd)
1628 bb_error_msg_and_die(bb_msg_op_not_supp,"SCSI");
1629}
1630
1631static void no_xt(void)
1632{
1633 if (is_xt_hd)
1634 bb_error_msg_and_die(bb_msg_op_not_supp,"XT");
1635}
1636
1637static void no_scsi_no_xt(void)
1638{
1639 no_scsi();
1640 no_xt();
1641}
1642
1643static void on_off (unsigned int value) 1622static void on_off (unsigned int value)
1644{ 1623{
1645 printf(value ? " (on)\n" : " (off)\n"); 1624 printf(value ? " (on)\n" : " (off)\n");
@@ -1836,86 +1815,15 @@ static void interpret_xfermode(unsigned int xfermode)
1836} 1815}
1837#endif /* HDIO_DRIVE_CMD */ 1816#endif /* HDIO_DRIVE_CMD */
1838 1817
1839#ifndef VXVM_MAJOR
1840#define VXVM_MAJOR 199
1841#endif
1842
1843#ifndef CCISS_MAJOR
1844#define CCISS_MAJOR 104
1845#endif
1846
1847static void process_dev(char *devname) 1818static void process_dev(char *devname)
1848{ 1819{
1849 int fd; 1820 int fd;
1850 static long parm, multcount; 1821 static long parm, multcount;
1851 struct stat stat_buf;
1852#ifndef HDIO_DRIVE_CMD 1822#ifndef HDIO_DRIVE_CMD
1853 int force_operation = 0; 1823 int force_operation = 0;
1854#endif 1824#endif
1855 unsigned char args[4] = {WIN_SETFEATURES,0,0,0}; 1825 unsigned char args[4] = {WIN_SETFEATURES,0,0,0};
1856 1826
1857 xstat(devname,&stat_buf);
1858
1859 switch(major(stat_buf.st_rdev))
1860 {
1861#ifdef SCSI_DISK0_MAJOR
1862 case (SCSI_DISK0_MAJOR):
1863 case (SCSI_DISK1_MAJOR):
1864 case (SCSI_DISK2_MAJOR):
1865 case (SCSI_DISK3_MAJOR):
1866 case (SCSI_DISK4_MAJOR):
1867 case (SCSI_DISK5_MAJOR):
1868 case (SCSI_DISK6_MAJOR):
1869 case (SCSI_DISK7_MAJOR):
1870#else
1871 case (SCSI_DISK_MAJOR):
1872#endif
1873#ifdef MD_MAJOR
1874 case (MD_MAJOR):
1875#endif
1876 case (VXVM_MAJOR):
1877#ifdef LVM_BLK_MAJOR
1878 case (LVM_BLK_MAJOR):
1879#endif
1880 case (CCISS_MAJOR):
1881 is_scsi_hd = 1;
1882 break;
1883#ifdef XT_DISK_MAJOR
1884 case (XT_DISK_MAJOR):
1885 is_xt_hd = 1;
1886 break;
1887#endif
1888 case IDE0_MAJOR:
1889 case IDE1_MAJOR:
1890#ifdef IDE2_MAJOR
1891 case IDE2_MAJOR:
1892#endif
1893#ifdef IDE3_MAJOR
1894 case IDE3_MAJOR:
1895#endif
1896#ifdef IDE4_MAJOR
1897 case IDE4_MAJOR:
1898#endif
1899#ifdef IDE5_MAJOR
1900 case IDE5_MAJOR:
1901#endif
1902#ifdef IDE6_MAJOR
1903 case IDE6_MAJOR:
1904#endif
1905#ifdef IDE7_MAJOR
1906 case IDE7_MAJOR:
1907#endif
1908#ifdef IDE8_MAJOR
1909 case IDE8_MAJOR:
1910#endif
1911#ifdef IDE9_MAJOR
1912 case IDE9_MAJOR:
1913#endif
1914 break; /* do nothing */
1915 default:
1916 bb_error_msg_and_die("%s not supported",devname);
1917 }
1918
1919 fd = bb_xopen(devname, O_RDONLY|O_NONBLOCK); 1827 fd = bb_xopen(devname, O_RDONLY|O_NONBLOCK);
1920 if_printf(!quiet, "\n%s:\n", devname); 1828 if_printf(!quiet, "\n%s:\n", devname);
1921 1829
@@ -1927,7 +1835,6 @@ static void process_dev(char *devname)
1927#ifdef CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF 1835#ifdef CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
1928 if (unregister_hwif) 1836 if (unregister_hwif)
1929 { 1837 {
1930 no_scsi();
1931 printf(" attempting to unregister hwif#%u\n", hwif); 1838 printf(" attempting to unregister hwif#%u\n", hwif);
1932 bb_ioctl(fd, HDIO_UNREGISTER_HWIF,(int *)(unsigned long)hwif,"HDIO_UNREGISTER_HWIF"); 1839 bb_ioctl(fd, HDIO_UNREGISTER_HWIF,(int *)(unsigned long)hwif,"HDIO_UNREGISTER_HWIF");
1933 } 1840 }
@@ -1935,7 +1842,6 @@ static void process_dev(char *devname)
1935#ifdef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF 1842#ifdef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
1936 if (scan_hwif) 1843 if (scan_hwif)
1937 { 1844 {
1938 no_scsi();
1939 printf(" attempting to scan hwif (0x%x, 0x%x, %u)\n", hwif_data, hwif_ctrl, hwif_irq); 1845 printf(" attempting to scan hwif (0x%x, 0x%x, %u)\n", hwif_data, hwif_ctrl, hwif_irq);
1940 args[0] = hwif_data; 1846 args[0] = hwif_data;
1941 args[1] = hwif_ctrl; 1847 args[1] = hwif_ctrl;
@@ -1945,8 +1851,6 @@ static void process_dev(char *devname)
1945#endif 1851#endif
1946 if (set_piomode) 1852 if (set_piomode)
1947 { 1853 {
1948 no_scsi_no_xt();
1949
1950 if (noisy_piomode) 1854 if (noisy_piomode)
1951 { 1855 {
1952 printf(" attempting to "); 1856 printf(" attempting to ");
@@ -1963,13 +1867,11 @@ static void process_dev(char *devname)
1963 } 1867 }
1964 if (set_io32bit) 1868 if (set_io32bit)
1965 { 1869 {
1966 no_scsi_no_xt();
1967 if_printf(get_io32bit," setting 32-bit IO_support flag to %ld\n", io32bit); 1870 if_printf(get_io32bit," setting 32-bit IO_support flag to %ld\n", io32bit);
1968 bb_ioctl(fd, HDIO_SET_32BIT, (int *)io32bit, "HDIO_SET_32BIT"); 1871 bb_ioctl(fd, HDIO_SET_32BIT, (int *)io32bit, "HDIO_SET_32BIT");
1969 } 1872 }
1970 if (set_mult) 1873 if (set_mult)
1971 { 1874 {
1972 no_scsi_no_xt();
1973 if_printf(get_mult, " setting multcount to %ld\n", mult); 1875 if_printf(get_mult, " setting multcount to %ld\n", mult);
1974 if (ioctl(fd, HDIO_SET_MULTCOUNT, mult)) 1876 if (ioctl(fd, HDIO_SET_MULTCOUNT, mult))
1975 bb_perror_msg("HDIO_SET_MULTCOUNT"); 1877 bb_perror_msg("HDIO_SET_MULTCOUNT");
@@ -1985,40 +1887,34 @@ static void process_dev(char *devname)
1985 } 1887 }
1986 if (set_unmask) 1888 if (set_unmask)
1987 { 1889 {
1988 no_scsi_no_xt();
1989 if_printf_on_off(get_unmask," setting unmaskirq to %ld", unmask); 1890 if_printf_on_off(get_unmask," setting unmaskirq to %ld", unmask);
1990 bb_ioctl(fd, HDIO_SET_UNMASKINTR, (int *)unmask, "HDIO_SET_UNMASKINTR"); 1891 bb_ioctl(fd, HDIO_SET_UNMASKINTR, (int *)unmask, "HDIO_SET_UNMASKINTR");
1991 } 1892 }
1992#ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA 1893#ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA
1993 if (set_dma) 1894 if (set_dma)
1994 { 1895 {
1995 no_scsi();
1996 if_printf_on_off(get_dma," setting using_dma to %ld", dma); 1896 if_printf_on_off(get_dma," setting using_dma to %ld", dma);
1997 bb_ioctl(fd, HDIO_SET_DMA, (int *)dma, "HDIO_SET_DMA"); 1897 bb_ioctl(fd, HDIO_SET_DMA, (int *)dma, "HDIO_SET_DMA");
1998 } 1898 }
1999#endif /* CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA */ 1899#endif /* CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA */
2000 if (set_dma_q) 1900 if (set_dma_q)
2001 { 1901 {
2002 no_scsi();
2003 if_printf_on_off(get_dma_q," setting DMA queue_depth to %ld", dma_q); 1902 if_printf_on_off(get_dma_q," setting DMA queue_depth to %ld", dma_q);
2004 bb_ioctl(fd, HDIO_SET_QDMA, (int *)dma_q, "HDIO_SET_QDMA"); 1903 bb_ioctl(fd, HDIO_SET_QDMA, (int *)dma_q, "HDIO_SET_QDMA");
2005 } 1904 }
2006 if (set_nowerr) 1905 if (set_nowerr)
2007 { 1906 {
2008 no_scsi_no_xt();
2009 if_printf_on_off(get_nowerr," setting nowerr to %ld", nowerr); 1907 if_printf_on_off(get_nowerr," setting nowerr to %ld", nowerr);
2010 bb_ioctl(fd, HDIO_SET_NOWERR, (int *)nowerr,"HDIO_SET_NOWERR"); 1908 bb_ioctl(fd, HDIO_SET_NOWERR, (int *)nowerr,"HDIO_SET_NOWERR");
2011 } 1909 }
2012 if (set_keep) 1910 if (set_keep)
2013 { 1911 {
2014 no_scsi_no_xt();
2015 if_printf_on_off(get_keep," setting keep_settings to %ld", keep); 1912 if_printf_on_off(get_keep," setting keep_settings to %ld", keep);
2016 bb_ioctl(fd, HDIO_SET_KEEPSETTINGS, (int *)keep,"HDIO_SET_KEEPSETTINGS"); 1913 bb_ioctl(fd, HDIO_SET_KEEPSETTINGS, (int *)keep,"HDIO_SET_KEEPSETTINGS");
2017 } 1914 }
2018#ifdef HDIO_DRIVE_CMD 1915#ifdef HDIO_DRIVE_CMD
2019 if (set_doorlock) 1916 if (set_doorlock)
2020 { 1917 {
2021 no_scsi_no_xt();
2022 args[0] = doorlock ? WIN_DOORLOCK : WIN_DOORUNLOCK; 1918 args[0] = doorlock ? WIN_DOORLOCK : WIN_DOORUNLOCK;
2023 if_printf_on_off(get_doorlock," setting drive doorlock to %ld", doorlock); 1919 if_printf_on_off(get_doorlock," setting drive doorlock to %ld", doorlock);
2024 bb_ioctl(fd, HDIO_DRIVE_CMD, &args,"HDIO_DRIVE_CMD(doorlock)"); 1920 bb_ioctl(fd, HDIO_DRIVE_CMD, &args,"HDIO_DRIVE_CMD(doorlock)");
@@ -2026,21 +1922,18 @@ static void process_dev(char *devname)
2026 if (set_dkeep) 1922 if (set_dkeep)
2027 { 1923 {
2028 /* lock/unlock the drive's "feature" settings */ 1924 /* lock/unlock the drive's "feature" settings */
2029 no_scsi_no_xt();
2030 if_printf_on_off(get_dkeep," setting drive keep features to %ld", dkeep); 1925 if_printf_on_off(get_dkeep," setting drive keep features to %ld", dkeep);
2031 args[2] = dkeep ? 0x66 : 0xcc; 1926 args[2] = dkeep ? 0x66 : 0xcc;
2032 bb_ioctl(fd, HDIO_DRIVE_CMD, &args,"HDIO_DRIVE_CMD(keepsettings)"); 1927 bb_ioctl(fd, HDIO_DRIVE_CMD, &args,"HDIO_DRIVE_CMD(keepsettings)");
2033 } 1928 }
2034 if (set_defects) 1929 if (set_defects)
2035 { 1930 {
2036 no_scsi();
2037 args[2] = defects ? 0x04 : 0x84; 1931 args[2] = defects ? 0x04 : 0x84;
2038 if_printf(get_defects," setting drive defect-mgmt to %ld\n", defects); 1932 if_printf(get_defects," setting drive defect-mgmt to %ld\n", defects);
2039 bb_ioctl(fd, HDIO_DRIVE_CMD, &args,"HDIO_DRIVE_CMD(defectmgmt)"); 1933 bb_ioctl(fd, HDIO_DRIVE_CMD, &args,"HDIO_DRIVE_CMD(defectmgmt)");
2040 } 1934 }
2041 if (set_prefetch) 1935 if (set_prefetch)
2042 { 1936 {
2043 no_scsi_no_xt();
2044 args[1] = prefetch; 1937 args[1] = prefetch;
2045 args[2] = 0xab; 1938 args[2] = 0xab;
2046 if_printf(get_prefetch," setting drive prefetch to %ld\n", prefetch); 1939 if_printf(get_prefetch," setting drive prefetch to %ld\n", prefetch);
@@ -2048,7 +1941,6 @@ static void process_dev(char *devname)
2048 } 1941 }
2049 if (set_xfermode) 1942 if (set_xfermode)
2050 { 1943 {
2051 no_scsi_no_xt();
2052 args[1] = xfermode_requested; 1944 args[1] = xfermode_requested;
2053 args[2] = 3; 1945 args[2] = 3;
2054 if (get_xfermode) 1946 if (get_xfermode)
@@ -2060,14 +1952,12 @@ static void process_dev(char *devname)
2060 } 1952 }
2061 if (set_lookahead) 1953 if (set_lookahead)
2062 { 1954 {
2063 no_scsi_no_xt();
2064 args[2] = lookahead ? 0xaa : 0x55; 1955 args[2] = lookahead ? 0xaa : 0x55;
2065 if_printf_on_off(get_lookahead," setting drive read-lookahead to %ld", lookahead); 1956 if_printf_on_off(get_lookahead," setting drive read-lookahead to %ld", lookahead);
2066 bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setreadahead)"); 1957 bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setreadahead)");
2067 } 1958 }
2068 if (set_apmmode) 1959 if (set_apmmode)
2069 { 1960 {
2070 no_scsi();
2071 apmmode=check_if_min_and_set_val(apmmode,1); 1961 apmmode=check_if_min_and_set_val(apmmode,1);
2072 apmmode=check_if_maj_and_set_val(apmmode,255); 1962 apmmode=check_if_maj_and_set_val(apmmode,255);
2073 if_printf(get_apmmode," setting APM level to"); 1963 if_printf(get_apmmode," setting APM level to");
@@ -2094,7 +1984,6 @@ static void process_dev(char *devname)
2094#endif 1984#endif
2095 static unsigned char flushcache[4] = {WIN_FLUSHCACHE,0,0,0}; 1985 static unsigned char flushcache[4] = {WIN_FLUSHCACHE,0,0,0};
2096#endif /* DO_FLUSHCACHE */ 1986#endif /* DO_FLUSHCACHE */
2097 no_scsi_no_xt();
2098 args[2] = wcache ? 0x02 : 0x82; 1987 args[2] = wcache ? 0x02 : 0x82;
2099 if_printf_on_off(get_wcache," setting drive write-caching to %ld", wcache); 1988 if_printf_on_off(get_wcache," setting drive write-caching to %ld", wcache);
2100#ifdef DO_FLUSHCACHE 1989#ifdef DO_FLUSHCACHE
@@ -2115,7 +2004,6 @@ static void process_dev(char *devname)
2115#ifndef WIN_STANDBYNOW2 2004#ifndef WIN_STANDBYNOW2
2116#define WIN_STANDBYNOW2 0x94 2005#define WIN_STANDBYNOW2 0x94
2117#endif 2006#endif
2118 no_scsi();
2119 if_printf(get_standbynow," issuing standby command\n"); 2007 if_printf(get_standbynow," issuing standby command\n");
2120 args[0] = WIN_STANDBYNOW1; 2008 args[0] = WIN_STANDBYNOW1;
2121 bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args, WIN_STANDBYNOW2, "HDIO_DRIVE_CMD(standby)"); 2009 bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args, WIN_STANDBYNOW2, "HDIO_DRIVE_CMD(standby)");
@@ -2128,7 +2016,6 @@ static void process_dev(char *devname)
2128#ifndef WIN_SLEEPNOW2 2016#ifndef WIN_SLEEPNOW2
2129#define WIN_SLEEPNOW2 0x99 2017#define WIN_SLEEPNOW2 0x99
2130#endif 2018#endif
2131 no_scsi();
2132 if_printf(get_sleepnow," issuing sleep command\n"); 2019 if_printf(get_sleepnow," issuing sleep command\n");
2133 args[0] = WIN_SLEEPNOW1; 2020 args[0] = WIN_SLEEPNOW1;
2134 bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args, WIN_SLEEPNOW2, "HDIO_DRIVE_CMD(sleep)"); 2021 bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args, WIN_SLEEPNOW2, "HDIO_DRIVE_CMD(sleep)");
@@ -2136,7 +2023,6 @@ static void process_dev(char *devname)
2136 if (set_seagate) 2023 if (set_seagate)
2137 { 2024 {
2138 args[0] = 0xfb; 2025 args[0] = 0xfb;
2139 no_scsi_no_xt();
2140 if_printf(get_seagate," disabling Seagate auto powersaving mode\n"); 2026 if_printf(get_seagate," disabling Seagate auto powersaving mode\n");
2141 bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(seagatepwrsave)"); 2027 bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(seagatepwrsave)");
2142 } 2028 }
@@ -2144,7 +2030,6 @@ static void process_dev(char *devname)
2144 { 2030 {
2145 args[0] = WIN_SETIDLE1; 2031 args[0] = WIN_SETIDLE1;
2146 args[1] = standby_requested; 2032 args[1] = standby_requested;
2147 no_scsi_no_xt();
2148 if (get_standby) 2033 if (get_standby)
2149 { 2034 {
2150 printf(" setting standby to %lu", standby_requested); 2035 printf(" setting standby to %lu", standby_requested);
@@ -2165,13 +2050,12 @@ static void process_dev(char *devname)
2165 if (!flagcount) 2050 if (!flagcount)
2166 verbose = 1; 2051 verbose = 1;
2167 2052
2168 if ((verbose && !is_scsi_hd && !is_xt_hd) || get_mult || get_identity) 2053 if (verbose || get_mult || get_identity)
2169 { 2054 {
2170 no_scsi();
2171 multcount = -1; 2055 multcount = -1;
2172 if (ioctl(fd, HDIO_GET_MULTCOUNT, &multcount)) 2056 if (ioctl(fd, HDIO_GET_MULTCOUNT, &multcount))
2173 { 2057 {
2174 if ((verbose && !is_xt_hd) || get_mult) 2058 if (verbose || get_mult)
2175 bb_perror_msg("HDIO_GET_MULTCOUNT"); 2059 bb_perror_msg("HDIO_GET_MULTCOUNT");
2176 } 2060 }
2177 else if (verbose | get_mult) 2061 else if (verbose | get_mult)
@@ -2180,9 +2064,8 @@ static void process_dev(char *devname)
2180 on_off(multcount); 2064 on_off(multcount);
2181 } 2065 }
2182 } 2066 }
2183 if ((verbose && !is_scsi_hd && !is_xt_hd) || get_io32bit) 2067 if (verbose || get_io32bit)
2184 { 2068 {
2185 no_scsi_no_xt();
2186 if (!bb_ioctl(fd, HDIO_GET_32BIT, &parm, "HDIO_GET_32BIT")) 2069 if (!bb_ioctl(fd, HDIO_GET_32BIT, &parm, "HDIO_GET_32BIT"))
2187 { 2070 {
2188 printf(" IO_support =%3ld (", parm); 2071 printf(" IO_support =%3ld (", parm);
@@ -2208,17 +2091,15 @@ static void process_dev(char *devname)
2208 } 2091 }
2209 } 2092 }
2210 } 2093 }
2211 if ((verbose && !is_scsi_hd && !is_xt_hd) || get_unmask) 2094 if (verbose || get_unmask)
2212 { 2095 {
2213 no_scsi_no_xt();
2214 bb_ioctl_on_off(fd, HDIO_GET_UNMASKINTR,(unsigned long *)parm, 2096 bb_ioctl_on_off(fd, HDIO_GET_UNMASKINTR,(unsigned long *)parm,
2215 "HDIO_GET_UNMASKINTR"," unmaskirq = %2ld"); 2097 "HDIO_GET_UNMASKINTR"," unmaskirq = %2ld");
2216 } 2098 }
2217 2099
2218 2100
2219#ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA 2101#ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA
2220 if ((verbose && !is_scsi_hd) || get_dma) { 2102 if (verbose || get_dma) {
2221 no_scsi();
2222 if (!bb_ioctl(fd, HDIO_GET_DMA, &parm, "HDIO_GET_DMA")) 2103 if (!bb_ioctl(fd, HDIO_GET_DMA, &parm, "HDIO_GET_DMA"))
2223 { 2104 {
2224 printf(" using_dma = %2ld", parm); 2105 printf(" using_dma = %2ld", parm);
@@ -2231,20 +2112,17 @@ static void process_dev(char *devname)
2231#endif 2112#endif
2232 if (get_dma_q) 2113 if (get_dma_q)
2233 { 2114 {
2234 no_scsi();
2235 bb_ioctl_on_off (fd, HDIO_GET_QDMA,(unsigned long *)parm, 2115 bb_ioctl_on_off (fd, HDIO_GET_QDMA,(unsigned long *)parm,
2236 "HDIO_GET_QDMA"," queue_depth = %2ld"); 2116 "HDIO_GET_QDMA"," queue_depth = %2ld");
2237 } 2117 }
2238 if ((verbose && !is_scsi_hd && !is_xt_hd) || get_keep) 2118 if (verbose || get_keep)
2239 { 2119 {
2240 no_scsi_no_xt();
2241 bb_ioctl_on_off (fd, HDIO_GET_KEEPSETTINGS,(unsigned long *)parm, 2120 bb_ioctl_on_off (fd, HDIO_GET_KEEPSETTINGS,(unsigned long *)parm,
2242 "HDIO_GET_KEEPSETTINGS"," keepsettings = %2ld"); 2121 "HDIO_GET_KEEPSETTINGS"," keepsettings = %2ld");
2243 } 2122 }
2244 2123
2245 if (get_nowerr) 2124 if (get_nowerr)
2246 { 2125 {
2247 no_scsi_no_xt();
2248 bb_ioctl_on_off (fd, HDIO_GET_NOWERR,(unsigned long *)&parm, 2126 bb_ioctl_on_off (fd, HDIO_GET_NOWERR,(unsigned long *)&parm,
2249 " HDIO_GET_NOWERR"," nowerr = %2ld"); 2127 " HDIO_GET_NOWERR"," nowerr = %2ld");
2250 } 2128 }
@@ -2253,7 +2131,7 @@ static void process_dev(char *devname)
2253 bb_ioctl_on_off(fd, BLKROGET,(unsigned long *)parm, 2131 bb_ioctl_on_off(fd, BLKROGET,(unsigned long *)parm,
2254 " BLKROGET"," readonly = %2ld"); 2132 " BLKROGET"," readonly = %2ld");
2255 } 2133 }
2256 if ((verbose && !is_scsi_hd) || get_readahead) 2134 if (verbose || get_readahead)
2257 { 2135 {
2258 bb_ioctl_on_off (fd, BLKRAGET, (unsigned long *) parm, 2136 bb_ioctl_on_off (fd, BLKRAGET, (unsigned long *) parm,
2259 " BLKRAGET"," readahead = %2ld"); 2137 " BLKRAGET"," readahead = %2ld");
@@ -2288,7 +2166,6 @@ static void process_dev(char *devname)
2288#endif 2166#endif
2289 const char *state; 2167 const char *state;
2290 2168
2291 no_scsi();
2292 args[0] = WIN_CHECKPOWERMODE1; 2169 args[0] = WIN_CHECKPOWERMODE1;
2293 if (bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args, WIN_CHECKPOWERMODE2, 0)) 2170 if (bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args, WIN_CHECKPOWERMODE2, 0))
2294 { 2171 {
@@ -2306,7 +2183,6 @@ static void process_dev(char *devname)
2306#ifdef CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET 2183#ifdef CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET
2307 if (perform_reset) 2184 if (perform_reset)
2308 { 2185 {
2309 no_scsi_no_xt();
2310 bb_ioctl(fd, HDIO_DRIVE_RESET, NULL, "HDIO_DRIVE_RESET"); 2186 bb_ioctl(fd, HDIO_DRIVE_RESET, NULL, "HDIO_DRIVE_RESET");
2311 } 2187 }
2312#endif /* CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET */ 2188#endif /* CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET */
@@ -2315,7 +2191,6 @@ static void process_dev(char *devname)
2315 { 2191 {
2316 args[0] = 0; 2192 args[0] = 0;
2317 args[1] = tristate; 2193 args[1] = tristate;
2318 no_scsi_no_xt();
2319 bb_ioctl(fd, HDIO_TRISTATE_HWIF, &args, "HDIO_TRISTATE_HWIF"); 2194 bb_ioctl(fd, HDIO_TRISTATE_HWIF, &args, "HDIO_TRISTATE_HWIF");
2320 } 2195 }
2321#endif /* CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF */ 2196#endif /* CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF */
@@ -2324,8 +2199,6 @@ static void process_dev(char *devname)
2324 { 2199 {
2325 static struct hd_driveid id; 2200 static struct hd_driveid id;
2326 2201
2327 no_scsi_no_xt();
2328
2329 if (!ioctl(fd, HDIO_GET_IDENTITY, &id)) 2202 if (!ioctl(fd, HDIO_GET_IDENTITY, &id))
2330 { 2203 {
2331 if (multcount != -1) 2204 if (multcount != -1)
@@ -2348,8 +2221,6 @@ static void process_dev(char *devname)
2348 unsigned char args1[4+512]; /* = { ... } will eat 0.5k of rodata! */ 2221 unsigned char args1[4+512]; /* = { ... } will eat 0.5k of rodata! */
2349 unsigned i; 2222 unsigned i;
2350 2223
2351 no_scsi_no_xt();
2352
2353 memset(args1, 0, sizeof(args1)); 2224 memset(args1, 0, sizeof(args1));
2354 args1[0] = WIN_IDENTIFY; 2225 args1[0] = WIN_IDENTIFY;
2355 args1[3] = 1; 2226 args1[3] = 1;
@@ -2358,7 +2229,7 @@ static void process_dev(char *devname)
2358 2229
2359 for (i=0; i<(sizeof args1)/2; i+=2) 2230 for (i=0; i<(sizeof args1)/2; i+=2)
2360 __le16_to_cpus((uint16_t *)(&args1[i])); 2231 __le16_to_cpus((uint16_t *)(&args1[i]));
2361 identify((void *)&args1[4], NULL); 2232 identify((void *)&args1[4]);
2362identify_abort: 2233identify_abort:
2363 /* VOID */; 2234 /* VOID */;
2364 } 2235 }
@@ -2366,7 +2237,6 @@ identify_abort:
2366#ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF 2237#ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
2367 if (set_busstate) 2238 if (set_busstate)
2368 { 2239 {
2369 no_scsi();
2370 if (get_busstate) 2240 if (get_busstate)
2371 { 2241 {
2372 printf(" setting bus state to %d", busstate); 2242 printf(" setting bus state to %d", busstate);
@@ -2378,7 +2248,6 @@ identify_abort:
2378#ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF 2248#ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
2379 if (get_busstate) 2249 if (get_busstate)
2380 { 2250 {
2381 no_scsi();
2382 if (!bb_ioctl(fd, HDIO_GET_BUSSTATE, &parm, "HDIO_GET_BUSSTATE")) 2251 if (!bb_ioctl(fd, HDIO_GET_BUSSTATE, &parm, "HDIO_GET_BUSSTATE"))
2383 { 2252 {
2384 printf(" busstate = %2ld", parm); 2253 printf(" busstate = %2ld", parm);
@@ -2453,7 +2322,7 @@ static int identify_from_stdin(void)
2453 b += 5; 2322 b += 5;
2454 count -= 5; 2323 count -= 5;
2455 } 2324 }
2456 identify(sbuf, NULL); 2325 identify(sbuf);
2457 return 0; 2326 return 0;
2458} 2327}
2459#endif 2328#endif