Commit d5fbcac6 authored by chrfranke's avatar chrfranke
Browse files

Drop legacy ATA support for Solaris SPARC.

configure.ac: Fail if '--with-solaris-sparc-ata' is specified.
Makefile.am: Remove os_solaris_ata.s and os_solaris.h.
os_solaris.cpp: Remove WITH_SOLARIS_SPARC_ATA sections.
os_solaris_ata.s, os_solaris.h: Remove files.
INSTALL: Update documentation.

git-svn-id: https://svn.code.sf.net/p/smartmontools/code/trunk@5389 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 5b2ce6fd
$Id$
2022-05-26 Christian Franke <franke@computer.org>
Drop legacy ATA support for Solaris SPARC.
configure.ac: Fail if '--with-solaris-sparc-ata' is specified.
Makefile.am: Remove os_solaris_ata.s and os_solaris.h.
os_solaris.cpp: Remove WITH_SOLARIS_SPARC_ATA sections.
os_solaris_ata.s, os_solaris.h: Remove files.
INSTALL: Update documentation.
2022-05-22 Christian Franke <franke@computer.org>
drivedb.h:
......
......@@ -46,8 +46,7 @@ Table of contents:
C) Solaris
The SCSI code has been tested on a variety of Solaris 8 or later
systems. ATA/IDE code only works on SPARC platform. All tested
kernels worked correctly.
systems. All tested kernels worked correctly.
D) NetBSD/OpenBSD
......@@ -174,7 +173,6 @@ Table of contents:
--with-systemdsystemunitdir=auto
--with-systemdenvfile=auto
--with-nvme-devicescan (Linux, Windows: yes; Others: no)
--without-solaris-sparc-ata (Solaris SPARC only)
--with-signal-func=sigaction
--with-working-snprintf
--with-mingw-aslr=auto (Windows only)
......
......@@ -7,9 +7,6 @@
ACLOCAL_AMFLAGS = -I m4
# Make sure .cpp takes precedence to avoid compiling old .c file
SUFFIXES = .cpp .c .s .o
# BUILD_INFO can be provided by package maintainers (see INSTALL file)
BUILD_INFO= "(local build)"
......@@ -107,7 +104,6 @@ EXTRA_smartctl_SOURCES = \
os_qnxnto.cpp \
os_qnxnto.h \
os_solaris.cpp \
os_solaris.h \
os_win32.cpp \
os_generic.cpp \
os_generic.h \
......@@ -179,7 +175,6 @@ EXTRA_smartd_SOURCES = \
os_qnxnto.cpp \
os_qnxnto.h \
os_solaris.cpp \
os_solaris.h \
os_win32.cpp \
os_generic.cpp \
os_generic.h \
......@@ -218,10 +213,6 @@ smartd_DEPENDENCIES += smartd_res.o
endif
# Exclude from source tarball
nodist_EXTRA_smartctl_SOURCES = os_solaris_ata.s
nodist_EXTRA_smartd_SOURCES = os_solaris_ata.s
if NEED_GETOPT_LONG
smartctl_SOURCES += \
......
......@@ -412,22 +412,6 @@ AC_ARG_WITH(nvme-devicescan,
[AS_HELP_STRING([--with-nvme-devicescan@<:@=yes|no@:>@],
[Include NVMe devices in smartd DEVICESCAN [Linux,Windows:yes;Others:no]])])
# TODO: Remove after smartmontools 7.3
AC_ARG_WITH(solaris-sparc-ata,
[AS_HELP_STRING([--with-solaris-sparc-ata@<:@=yes|no@:>@],
[Enable legacy ATA support on Solaris SPARC (requires os_solaris_ata.s from SVN repository) [no]])])
case "$host:$with_solaris_sparc_ata" in
sparc-*-solaris*:yes)
if test ! -f "$srcdir/os_solaris_ata.s"; then
AC_MSG_ERROR([Missing source file: $srcdir/os_solaris_ata.s
This file is no longer included in the source tarball but still
available in the SVN repository.])
fi
AC_DEFINE(WITH_SOLARIS_SPARC_ATA, 1, [Define to 1 to enable legacy ATA support on Solaris SPARC.])
;;
esac
# TODO: Remove after smartmontools 7.4
AC_ARG_WITH(signal-func,
[AS_HELP_STRING([--with-signal-func=@<:@sigaction|sigset|signal@:>@],
......@@ -616,6 +600,14 @@ else
fi
AM_CONDITIONAL(NEED_REGEX, [test "$need_regex" = "yes"])
# TODO: Remove after smartmontools 7.4
AC_ARG_WITH(solaris-sparc-ata,
[AS_HELP_STRING([--with-solaris-sparc-ata], [(removed)])],
[AC_MSG_ERROR([
The option '--with@<:@out@:>@-solaris-sparc-ata' is no longer supported.
If you still need legacy ATA support on Solaris SPARC, please inform
$PACKAGE_BUGREPORT.])])
# Set platform-specific modules and symbols
os_libs=
os_dltools='curl wget lynx svn'
......@@ -647,15 +639,7 @@ case "${host}" in
os_man_filter=FreeBSD
os_nvme_devicescan=no
;;
sparc-*-solaris*)
os_deps='os_solaris.o'
test "$with_solaris_sparc_ata" = "yes" \
&& os_deps="$os_deps os_solaris_ata.o"
os_mailer='mailx'
os_solaris=yes
os_man_filter=Solaris
;;
*-pc-solaris*)
*-*-solaris*)
os_deps='os_solaris.o'
os_mailer='mailx'
os_solaris=yes
......@@ -1004,15 +988,6 @@ Use option '--without-nvme-devicescan' to suppress this warning.
]) ;;
esac
# TODO: Remove after smartmontools 7.3
if test -n "$with_solaris_sparc_ata"; then
AC_MSG_WARN([
The option '--with-solaris-sparc-ata' is deprecated and will be
removed in a future version of smartmontools. If this option is
still needed, please inform $PACKAGE_BUGREPORT.
])
fi
# TODO: Remove after smartmontools 7.4
case "$host:$with_signal_func" in
*-*-mingw*:*|*:sigaction) ;;
......
......@@ -15,7 +15,10 @@
#include <dirent.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
// These are needed to define prototypes for the functions defined below
#include "config.h"
......@@ -24,13 +27,7 @@
#include "scsicmds.h"
#include "utility.h"
// This is to include whatever prototypes you define in os_solaris.h
#include "os_solaris.h"
#define ARGUSED(x) ((void)(x))
const char *os_XXXX_cpp_cvsid = "$Id$"
OS_SOLARIS_H_CVSID;
const char * os_solaris_cpp_cvsid = "$Id$";
// print examples for smartctl
void print_smartctl_examples(){
......@@ -219,73 +216,11 @@ int deviceclose(int fd){
return close(fd);
}
#if defined(WITH_SOLARIS_SPARC_ATA)
// swap each 2-byte pairs in a sector
static void swap_sector(void *p)
// Interface to ATA devices.
int ata_command_interface(int, smart_command_set, int, char *)
{
int i;
char t, *cp = static_cast<char*>(p);
for(i = 0; i < 256; i++) {
t = cp[0]; cp[0] = cp[1]; cp[1] = t;
cp += 2;
}
}
#endif
// Interface to ATA devices. See os_linux.c
int ata_command_interface(int fd, smart_command_set command, int select, char *data){
#if defined(WITH_SOLARIS_SPARC_ATA)
int err;
switch (command){
case CHECK_POWER_MODE:
/* currently not recognized */
return -1;
case READ_VALUES:
return smart_read_data(fd, data);
case READ_THRESHOLDS:
return smart_read_thresholds(fd, data);
case READ_LOG:
return smart_read_log(fd, select, 1, data);
case IDENTIFY:
err = ata_identify(fd, data);
if(err) return err;
swap_sector(static_cast<void*>(data));
return 0;
case PIDENTIFY:
err = ata_pidentify(fd, data);
if(err) return err;
swap_sector(static_cast<void*>(data));
return 0;
case ENABLE:
return smart_enable(fd);
case DISABLE:
return smart_disable(fd);
case STATUS:
return smart_status(fd);
case AUTO_OFFLINE:
return smart_auto_offline(fd, select);
case AUTOSAVE:
return smart_auto_save(fd, select);
case IMMEDIATE_OFFLINE:
return smart_immediate_offline(fd, select);
case STATUS_CHECK:
return smart_status_check(fd);
default:
pout("Unrecognized command %d in ata_command_interface() of os_solaris.cpp\n", command);
errno = EINVAL;
return -1;
}
#else /* WITH_SOLARIS_SPARC_ATA */
ARGUSED(fd); ARGUSED(command); ARGUSED(select); ARGUSED(data);
/* Above smart_* routines uses undocumented ioctls of "dada"
* driver, which is specific to SPARC Solaris. See
* os_solaris_ata.s for further details. */
pout("Device type 'ata' not implemented, try '-d sat' or '-d sat,12' instead.\n");
errno = ENOSYS;
#endif
return -1;
}
......@@ -295,7 +230,7 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *d
#include <sys/scsi/impl/types.h>
#include <sys/scsi/impl/uscsi.h>
// Interface to SCSI devices. See os_linux.c
// Interface to SCSI devices.
int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
{
struct uscsi_cmd uscsi;
......
/*
* os_solaris.h
*
* Home page of code is: http://www.smartmontools.org
*
* Copyright (C) 2003-8 SAWADA Keiji
* Copyright (C) 2003-8 Casper Dik
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef OS_SOLARIS_H_
#define OS_SOLARIS_H_
#define OS_SOLARIS_H_CVSID "$Id$\n"
// Additional material should start here. Note: to keep the '-V' CVS
// reporting option working as intended, you should only #include
// system include files <something.h>. Local #include files
// <"something.h"> should be #included in os_solaris.c
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
// function prototypes for functions defined in os_solaris_ata.s
extern "C" {
int smart_read_data(int fd, void *data);
int smart_read_thresholds(int fd, void *data);
int smart_read_log(int fd, int s, int count, void *data);
int ata_identify(int fd, void *data);
int ata_pidentify(int fd, void *data);
int smart_enable(int fd);
int smart_disable(int fd);
int smart_status(int fd);
int smart_auto_offline(int fd, int s);
int smart_auto_save(int fd, int s);
int smart_immediate_offline(int fd, int s);
int smart_status_check(int fd);
}
// wrapper macros
#define smart_enable_auto_save(fd) smart_auto_save(fd, 0xf1)
#define smart_disable_auto_save(fd) smart_auto_save(fd, 0x00)
#endif /* OS_SOLARIS_H_ */
!
! os_solaris_ata.s
!
! Home page of code is: http://www.smartmontools.org
!
! Copyright (C) 2003-8 SAWADA Keiji
!
! SPDX-License-Identifier: GPL-2.0-or-later
!
!
! --------------------------------------------------------
! direct access routines to ATA device under Solaris/SPARC
! --------------------------------------------------------
!
! Information
! -----------
!
! In Solaris, programmer can pass SCSI command to target device directly
! by using USCSI ioctl or using "scg" generic SCSI driver. But, such
! method does not exist for ATA devices.
!
! However, I can access Solaris kernel source because I am subscriber of
! Source Foundation Program of Solaris. So, I can find method of
! accessing ATA device directly. The method is to pack command in
! undocumented structure and issue ioctl that appears only in kernel
! source. Yes, that is the same way in using USCSI interface.
!
! But, I met difficulty in disclosing this technique. I have signed NDA
! with Sun that inhibits me not to violate their intellectual property.
!
! Fortunately, Sun allows licensees to publish "Interfaces" if:
!
! (1) he/she treats Solaris code as confidential
!
! (2) and he/she doesn't incorporate Sun's code into his/her code
!
! (3) and disclose enough information to use "Interface" to everyone.
!
! So, I publish that technique in assembly code or object code because:
!
! (1) I believe Sun's intellectural property is not invaded because I
! didn't reveal any struct member and ioctl to non-licensee.
!
! (2) no piece of kernel source is included in this code.
!
! (3) And finally, I publish enough information below in order to use
! this code.
!
! For last reason, please don't remove "Calling Interface" section from
! distribution.
!
!
! Calling Interface
! -----------------
!
! Name of function/macro presents corresponding S.M.A.R.T. command.
!
! Parameters are described below.
!
! int fd
!
! File descriptor of ATA device. Device would be
! /dev/rdsk/cXtXdXsX.
!
! Device should be raw device serviced by "dada" driver. ATAPI
! CD-ROM/R/RW, DVD-ROM, and so on are not allowed because they are
! serviced by "sd" driver. On x86 Solaris, "cmdk" driver services
! them, this routines doesn't work.
!
! int s
! Select sector for service. For example, this indicates log sector
! number for smart_read_log() function. Probably you need to read
! ATA specification for this parameter.
!
! void *data
! Data going to be read/written. It don't have to be word aligned,
! But data shall points valid user memory space.
!
! This is very tiny routines, but if you feel this insufficient, please
! let me know.
!
! ksw / SAWADA Keiji
! <card_captor@users.sourceforge.net>
.file "solaris-ata-in.c"
.section ".rodata"
.align 8
.LLC0:
.asciz "$Id$"
.global os_solaris_ata_s_cvsid
.section ".data"
.align 4
.type os_solaris_ata_s_cvsid, #object
.size os_solaris_ata_s_cvsid, 4
os_solaris_ata_s_cvsid:
.long .LLC0
.section ".text"
.align 4
.type ata_cmd, #function
.proc 04
ata_cmd:
!#PROLOGUE# 0
save %sp, -184, %sp
!#PROLOGUE# 1
st %i0, [%fp+68]
st %i1, [%fp+72]
st %i2, [%fp+76]
st %i3, [%fp+80]
st %i4, [%fp+84]
st %i5, [%fp+88]
ld [%fp+92], %g1
st %g1, [%fp-76]
ld [%fp-76], %g1
and %g1, 3, %g1
cmp %g1, 0
be .LL2
nop
mov -2, %g1
st %g1, [%fp-80]
b .LL1
nop
.LL2:
add %fp, -56, %g1
mov %g1, %o0
mov 0, %o1
mov 36, %o2
call memset, 0
nop
add %fp, -72, %g1
mov %g1, %o0
mov 0, %o1
mov 16, %o2
call memset, 0
nop
ld [%fp+72], %g1
stb %g1, [%fp-72]
mov 1, %g1
stb %g1, [%fp-71]
mov 1, %g1
stb %g1, [%fp-70]
ld [%fp+76], %g1
stb %g1, [%fp-69]
ld [%fp+84], %g1
sll %g1, 9, %g1
st %g1, [%fp-68]
ld [%fp+80], %g1
st %g1, [%fp-60]
mov 10, %g1
sth %g1, [%fp-52]
ld [%fp+88], %g1
cmp %g1, 0
be .LL3
nop
mov 14, %g1
st %g1, [%fp-84]
b .LL4
nop
.LL3:
mov 6, %g1
st %g1, [%fp-84]
.LL4:
ld [%fp-84], %g1
st %g1, [%fp-48]
ld [%fp+88], %g1
sll %g1, 9, %g1
st %g1, [%fp-44]
ld [%fp+88], %g1
sll %g1, 9, %g1
st %g1, [%fp-40]
ld [%fp+88], %g1
cmp %g1, 0
be .LL5
nop
ld [%fp+92], %g1
st %g1, [%fp-88]
b .LL6
nop
.LL5:
st %g0, [%fp-88]
.LL6:
ld [%fp-88], %g1
st %g1, [%fp-36]
add %fp, -72, %g1
st %g1, [%fp-32]
add %fp, -56, %g1
ld [%fp+68], %o0
mov 1481, %o1
mov %g1, %o2
call ioctl, 0
nop
mov %o0, %g1
st %g1, [%fp-80]
.LL1:
ld [%fp-80], %i0
ret
restore
.size ata_cmd, .-ata_cmd
.align 4
.global ata_identify
.type ata_identify, #function
.proc 04
ata_identify:
!#PROLOGUE# 0
save %sp, -648, %sp
!#PROLOGUE# 1
st %i0, [%fp+68]
st %i1, [%fp+72]
add %fp, -536, %g1
st %g1, [%sp+92]
ld [%fp+68], %o0
mov 236, %o1
mov 0, %o2
mov 0, %o3
mov 1, %o4
mov 1, %o5
call ata_cmd, 0
nop
mov %o0, %g1
st %g1, [%fp-20]
add %fp, -536, %g1
ld [%fp+72], %o0
mov %g1, %o1
mov 512, %o2
call memcpy, 0
nop
ld [%fp-20], %g1
cmp %g1, 0
be .LL8
nop
mov -1, %g1
st %g1, [%fp-540]
b .LL9
nop
.LL8:
st %g0, [%fp-540]
.LL9:
ld [%fp-540], %g1
mov %g1, %i0
ret
restore
.size ata_identify, .-ata_identify
.align 4
.global ata_pidentify
.type ata_pidentify, #function
.proc 04
ata_pidentify:
!#PROLOGUE# 0
save %sp, -648, %sp
!#PROLOGUE# 1
st %i0, [%fp+68]
st %i1, [%fp+72]
add %fp, -536, %g1
st %g1, [%sp+92]
ld [%fp+68], %o0
mov 161, %o1
mov 0, %o2
mov 0, %o3
mov 1, %o4
mov 1, %o5
call ata_cmd, 0
nop
mov %o0, %g1
st %g1, [%fp-20]
add %fp, -536, %g1
ld [%fp+72], %o0
mov %g1, %o1
mov 512, %o2
call memcpy, 0
nop
ld [%fp-20], %g1
cmp %g1, 0
be .LL11
nop
mov -1, %g1
st %g1, [%fp-540]
b .LL12
nop
.LL11:
st %g0, [%fp-540]
.LL12:
ld [%fp-540], %g1
mov %g1, %i0
ret
restore
.size ata_pidentify, .-ata_pidentify
.align 4
.global smart_read_data
.type smart_read_data, #function
.proc 04
smart_read_data:
!#PROLOGUE# 0
save %sp, -648, %sp
!#PROLOGUE# 1
st %i0, [%fp+68]
st %i1, [%fp+72]
add %fp, -536, %g1
st %g1, [%sp+92]
ld [%fp+68], %o0
mov 176, %o1
mov 208, %o2
sethi %hi(12733440), %g1
or %g1, 768, %o3
mov 0, %o4
mov 1, %o5
call ata_cmd, 0
nop
mov %o0, %g1
st %g1, [%fp-20]
add %fp, -536, %g1
ld [%fp+72], %o0
mov %g1, %o1
mov 512, %o2
call memcpy, 0
nop
ld [%fp-20], %g1
cmp %g1, 0
be .LL14
nop
mov -1, %g1
st %g1, [%fp-540]