From d552893f7c165244a7d84f39d508b5786d4ddaee Mon Sep 17 00:00:00 2001 From: wawa Date: Sat, 9 Mar 2019 18:28:26 +0000 Subject: [PATCH] add stubs for the ata trim/smart commands. make sysexplorer's ata and ahci modules query the devices supported extended features through the storage module. define an AROS specific filesystem packet that queries the blocks occupied by a file. (NicJA) git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@55807 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- compiler/include/dos/dosextens.h | 147 +++++++++++---------- rom/devs/ata/ata.c | 23 ++-- rom/devs/ata/ata.h | 3 + rom/devs/ata/ata_busclass.c | 2 +- rom/devs/ata/ata_controllerclass.c | 2 +- rom/devs/ata/ata_init.c | 2 +- rom/devs/ata/ata_smart.c | 47 +++++++ rom/devs/ata/ata_trim.c | 40 ++++++ rom/devs/ata/ata_unitclass.c | 2 +- rom/devs/ata/mmakefile.src | 2 + .../tools/SysExplorer/Modules/AHCI/ahci_enum.c | 2 +- .../tools/SysExplorer/Modules/AHCI/ahci_init.c | 2 +- .../SysExplorer/Modules/AHCI/ahcibus_window_cl.c | 2 +- .../SysExplorer/Modules/AHCI/ahciunit_window_cl.c | 21 ++- workbench/tools/SysExplorer/Modules/ATA/ata_enum.c | 2 +- workbench/tools/SysExplorer/Modules/ATA/ata_init.c | 2 +- .../tools/SysExplorer/Modules/ATA/ata_window_cl.c | 2 +- .../SysExplorer/Modules/ATA/atabus_window_cl.c | 2 +- .../SysExplorer/Modules/ATA/ataunit_window_cl.c | 20 ++- .../tools/SysExplorer/Modules/Storage/storage.conf | 1 + .../SysExplorer/Modules/Storage/storage_enum.c | 106 ++++++++++++++- .../SysExplorer/Modules/Storage/storage_init.c | 2 +- .../Modules/Storage/storagebus_window_cl.c | 4 +- .../Modules/Storage/storageunit_window_cl.c | 2 +- workbench/tools/SysExplorer/computer_page_cl.c | 2 +- workbench/tools/SysExplorer/device_page_cl.c | 2 +- workbench/tools/SysExplorer/mmakefile.src | 17 +-- workbench/tools/SysExplorer/sysexp_locale.c | 2 +- workbench/tools/SysExplorer/sysexp_main.c | 2 +- 29 files changed, 343 insertions(+), 122 deletions(-) create mode 100644 rom/devs/ata/ata_smart.c create mode 100644 rom/devs/ata/ata_trim.c diff --git a/compiler/include/dos/dosextens.h b/compiler/include/dos/dosextens.h index 09f0092e13..e7d0a2f6c8 100644 --- a/compiler/include/dos/dosextens.h +++ b/compiler/include/dos/dosextens.h @@ -2,7 +2,7 @@ #define DOS_DOSEXTENS_H /* - Copyright © 1995-2014, The AROS Development Team. All rights reserved. + Copyright © 1995-2019, The AROS Development Team. All rights reserved. $Id$ Desc: LibBase and some important structures @@ -538,76 +538,81 @@ struct DosPacket */ /* dp_Type */ -#define ACTION_NIL 0 -#define ACTION_STARTUP 0 -#define ACTION_GET_BLOCK 2 /* Obsolete */ -#define ACTION_SET_MAP 4 -#define ACTION_DIE 5 -#define ACTION_EVENT 6 -#define ACTION_CURRENT_VOLUME 7 -#define ACTION_LOCATE_OBJECT 8 -#define ACTION_RENAME_DISK 9 -#define ACTION_FREE_LOCK 15 -#define ACTION_DELETE_OBJECT 16 -#define ACTION_RENAME_OBJECT 17 -#define ACTION_MORE_CACHE 18 -#define ACTION_COPY_DIR 19 -#define ACTION_WAIT_CHAR 20 -#define ACTION_SET_PROTECT 21 -#define ACTION_CREATE_DIR 22 -#define ACTION_EXAMINE_OBJECT 23 -#define ACTION_EXAMINE_NEXT 24 -#define ACTION_DISK_INFO 25 -#define ACTION_INFO 26 -#define ACTION_FLUSH 27 -#define ACTION_SET_COMMENT 28 -#define ACTION_PARENT 29 -#define ACTION_TIMER 30 -#define ACTION_INHIBIT 31 -#define ACTION_DISK_TYPE 32 -#define ACTION_DISK_CHANGE 33 -#define ACTION_SET_DATE 34 -#define ACTION_SAME_LOCK 40 - -#define ACTION_WRITE 'W' -#define ACTION_READ 'R' - -#define ACTION_SCREEN_MODE 994 -#define ACTION_CHANGE_SIGNAL 995 -#define ACTION_READ_RETURN 1001 -#define ACTION_WRITE_RETURN 1002 -#define ACTION_FINDUPDATE 1004 -#define ACTION_FINDINPUT 1005 -#define ACTION_FINDOUTPUT 1006 -#define ACTION_END 1007 -#define ACTION_SEEK 1008 -#define ACTION_FORMAT 1020 -#define ACTION_MAKE_LINK 1021 -#define ACTION_SET_FILE_SIZE 1022 -#define ACTION_WRITE_PROTECT 1023 -#define ACTION_READ_LINK 1024 -#define ACTION_FH_FROM_LOCK 1026 -#define ACTION_IS_FILESYSTEM 1027 -#define ACTION_CHANGE_MODE 1028 -#define ACTION_COPY_DIR_FH 1030 -#define ACTION_PARENT_FH 1031 -#define ACTION_EXAMINE_ALL 1033 -#define ACTION_EXAMINE_FH 1034 -#define ACTION_EXAMINE_ALL_END 1035 -#define ACTION_SET_OWNER 1036 - -#define ACTION_LOCK_RECORD 2008 -#define ACTION_FREE_RECORD 2009 - -#define ACTION_ADD_NOTIFY 4097 -#define ACTION_REMOVE_NOTIFY 4098 - -#define ACTION_SERIALIZE_DISK 4200 - -#define ACTION_CHANGE_FILE_POSITION64 8001 -#define ACTION_GET_FILE_POSITION64 8002 -#define ACTION_CHANGE_FILE_SIZE64 8003 -#define ACTION_GET_FILE_SIZE64 8004 +#define ACTION_NIL 0 +#define ACTION_STARTUP 0 +#define ACTION_GET_BLOCK 2 /* Obsolete */ +#define ACTION_SET_MAP 4 +#define ACTION_DIE 5 +#define ACTION_EVENT 6 +#define ACTION_CURRENT_VOLUME 7 +#define ACTION_LOCATE_OBJECT 8 +#define ACTION_RENAME_DISK 9 +#define ACTION_FREE_LOCK 15 +#define ACTION_DELETE_OBJECT 16 +#define ACTION_RENAME_OBJECT 17 +#define ACTION_MORE_CACHE 18 +#define ACTION_COPY_DIR 19 +#define ACTION_WAIT_CHAR 20 +#define ACTION_SET_PROTECT 21 +#define ACTION_CREATE_DIR 22 +#define ACTION_EXAMINE_OBJECT 23 +#define ACTION_EXAMINE_NEXT 24 +#define ACTION_DISK_INFO 25 +#define ACTION_INFO 26 +#define ACTION_FLUSH 27 +#define ACTION_SET_COMMENT 28 +#define ACTION_PARENT 29 +#define ACTION_TIMER 30 +#define ACTION_INHIBIT 31 +#define ACTION_DISK_TYPE 32 +#define ACTION_DISK_CHANGE 33 +#define ACTION_SET_DATE 34 +#define ACTION_SAME_LOCK 40 + +#define ACTION_WRITE 'W' +#define ACTION_READ 'R' + +#define ACTION_SCREEN_MODE 994 +#define ACTION_CHANGE_SIGNAL 995 +#define ACTION_READ_RETURN 1001 +#define ACTION_WRITE_RETURN 1002 +#define ACTION_FINDUPDATE 1004 +#define ACTION_FINDINPUT 1005 +#define ACTION_FINDOUTPUT 1006 +#define ACTION_END 1007 +#define ACTION_SEEK 1008 +#define ACTION_FORMAT 1020 +#define ACTION_MAKE_LINK 1021 +#define ACTION_SET_FILE_SIZE 1022 +#define ACTION_WRITE_PROTECT 1023 +#define ACTION_READ_LINK 1024 +#define ACTION_FH_FROM_LOCK 1026 +#define ACTION_IS_FILESYSTEM 1027 +#define ACTION_CHANGE_MODE 1028 +#define ACTION_COPY_DIR_FH 1030 +#define ACTION_PARENT_FH 1031 +#define ACTION_EXAMINE_ALL 1033 +#define ACTION_EXAMINE_FH 1034 +#define ACTION_EXAMINE_ALL_END 1035 +#define ACTION_SET_OWNER 1036 + +#define ACTION_LOCK_RECORD 2008 +#define ACTION_FREE_RECORD 2009 + +#define ACTION_ADD_NOTIFY 4097 +#define ACTION_REMOVE_NOTIFY 4098 + +#define ACTION_SERIALIZE_DISK 4200 + +/* AROS Extension(s) */ +#define ACTION_GET_FILE_BLOCKS 2019 + +/* AmigaOS 4 (tm) compatable Extension(s) */ +#define ACTION_CHANGE_FILE_POSITION64 8001 +#define ACTION_GET_FILE_POSITION64 8002 +#define ACTION_CHANGE_FILE_SIZE64 8003 +#define ACTION_GET_FILE_SIZE64 8004 + /* Structure for easy handling of DosPackets. DosPackets don't have to be in this structure, but this struture may ease the use of it. */ diff --git a/rom/devs/ata/ata.c b/rom/devs/ata/ata.c index 0143ddafae..2f08f88cc0 100644 --- a/rom/devs/ata/ata.c +++ b/rom/devs/ata/ata.c @@ -1,5 +1,5 @@ /* - Copyright © 2004-2014, The AROS Development Team. All rights reserved + Copyright © 2004-2019, The AROS Development Team. All rights reserved $Id$ Desc: @@ -25,7 +25,6 @@ #include - #include "timer.h" #include "ata.h" #include LC_LIBDEFS_FILE @@ -563,9 +562,7 @@ static void cmd_SMART(struct IORequest *io, LIBBASETYPEPTR LIBBASE) io->io_Error = 0; return; } -#if (0) - ata_SMARTCmd(io); -#endif + ata_SMARTCmd(IOStdReq(io)); } else io->io_Error = IOERR_NOCMD; @@ -591,9 +588,7 @@ static void cmd_TRIM(struct IORequest *io, LIBBASETYPEPTR LIBBASE) io->io_Error = 0; return; } -#if (0) - ata_TRIMCmd(io); -#endif + ata_TRIMCmd(IOStdReq(io)); } else io->io_Error = IOERR_NOCMD; @@ -755,17 +750,19 @@ static void HandleIO(struct IORequest *io, LIBBASETYPEPTR LIBBASE) static const ULONG IMMEDIATE_COMMANDS = 0x803ff1e3; // 10000000001111111111000111100011 /* See whether the command can be done quick */ -static BOOL isSlow(ULONG comm) +static BOOL isSlow(struct IORequest *io) { BOOL slow = TRUE; /* Assume always slow command */ /* For commands with numbers <= 31 check the mask */ - if (comm <= 31) + if (io->io_Command <= 31) { - if (IMMEDIATE_COMMANDS & (1 << comm)) + if (IMMEDIATE_COMMANDS & (1 << io->io_Command)) slow = FALSE; } - else if (comm == NSCMD_TD_SEEK64 || comm == NSCMD_DEVICEQUERY) slow = FALSE; + else if ((io->io_Command >= HD_SMARTCMD && io->io_Command <= HD_TRIMCMD) && + (IOStdReq(io)->io_Reserved1 == ATAFEATURE_TEST_AVAIL)) slow = FALSE; + else if (io->io_Command == NSCMD_TD_SEEK64 || io->io_Command == NSCMD_DEVICEQUERY) slow = FALSE; return slow; } @@ -794,7 +791,7 @@ AROS_LH1(void, BeginIO, If the command is not-immediate, or presence of disc is still unknown, let the bus task do the job. */ - if (isSlow(io->io_Command)) + if (isSlow(io)) { unit->au_Unit.unit_flags |= UNITF_ACTIVE | UNITF_INTASK; io->io_Flags &= ~IOF_QUICK; diff --git a/rom/devs/ata/ata.h b/rom/devs/ata/ata.h index 16abc6616b..9aed77f050 100644 --- a/rom/devs/ata/ata.h +++ b/rom/devs/ata/ata.h @@ -396,6 +396,9 @@ void DaemonCode(struct ataBase *LIBBASE); BYTE SCSIEmu(struct ata_Unit*, struct SCSICmd*); +void ata_SMARTCmd(struct IOStdReq *io); +void ata_TRIMCmd(struct IOStdReq *io); + #define ATAPI_SS_EJECT 0x02 #define ATAPI_SS_LOAD 0x03 diff --git a/rom/devs/ata/ata_busclass.c b/rom/devs/ata/ata_busclass.c index 3257d3799d..dcbe2450f8 100644 --- a/rom/devs/ata/ata_busclass.c +++ b/rom/devs/ata/ata_busclass.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2018, The AROS Development Team. All rights reserved. + Copyright © 1995-2019, The AROS Development Team. All rights reserved. $Id$ */ diff --git a/rom/devs/ata/ata_controllerclass.c b/rom/devs/ata/ata_controllerclass.c index 983875a222..65ec6a44a4 100644 --- a/rom/devs/ata/ata_controllerclass.c +++ b/rom/devs/ata/ata_controllerclass.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018, The AROS Development Team. All rights reserved. + Copyright (C) 2013-2019, The AROS Development Team. All rights reserved. $Id$ */ diff --git a/rom/devs/ata/ata_init.c b/rom/devs/ata/ata_init.c index 33d21a1c2b..97551e7416 100644 --- a/rom/devs/ata/ata_init.c +++ b/rom/devs/ata/ata_init.c @@ -1,5 +1,5 @@ /* - Copyright © 2004-2018, The AROS Development Team. All rights reserved + Copyright © 2004-2019, The AROS Development Team. All rights reserved $Id$ Desc: diff --git a/rom/devs/ata/ata_smart.c b/rom/devs/ata/ata_smart.c new file mode 100644 index 0000000000..b5ec75046e --- /dev/null +++ b/rom/devs/ata/ata_smart.c @@ -0,0 +1,47 @@ +/* + Copyright © 2019, The AROS Development Team. All rights reserved. + $Id$ +*/ + +#include + +#include + +/* We want all other bases obtained from our base */ +#define __NOLIBBASE__ + +#include +#include +#include + +#include + +#include "ata.h" + +/* perform the S.M.A.R.T operation specified in io_Reserved1 */ +void ata_SMARTCmd(struct IOStdReq *io) +{ +#if (0) + ata_CommandBlock acb = + { + ATA_SMART, + IOStdReq(io)->io_Reserved1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + CM_NoData, + CT_NoBlock + }; +#endif + D(bug("[ATA%02ld] %s()\n", ((struct ata_Unit*)io->io_Unit)->au_UnitNum, __func__)); +#if (0) + if (IOStdReq(io)->io_Reserved1 == SMARTC_READ_VALUES || IOStdReq(io)->io_Reserved1 == SMARTC_READ_THRESHOLDS) { + acb.buffer = IOStdReq(io)->io_Data; + acb.length = IOStdReq(io)->io_Length; + } +#endif +} diff --git a/rom/devs/ata/ata_trim.c b/rom/devs/ata/ata_trim.c new file mode 100644 index 0000000000..2826b1cdbf --- /dev/null +++ b/rom/devs/ata/ata_trim.c @@ -0,0 +1,40 @@ +/* + Copyright © 2019, The AROS Development Team. All rights reserved. + $Id$ +*/ + +#include + +#include + +/* We want all other bases obtained from our base */ +#define __NOLIBBASE__ + +#include +#include +#include + +#include + +#include "ata.h" + +void ata_TRIMCmd(struct IOStdReq *io) +{ +#if (0) + ata_CommandBlock acb = + { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + }; +#endif + D(bug("[ATA%02ld] %s()\n", ((struct ata_Unit*)io->io_Unit)->au_UnitNum, __func__)); +} diff --git a/rom/devs/ata/ata_unitclass.c b/rom/devs/ata/ata_unitclass.c index df4e80eefd..8a42ea4306 100644 --- a/rom/devs/ata/ata_unitclass.c +++ b/rom/devs/ata/ata_unitclass.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2013, The AROS Development Team. All rights reserved. + Copyright © 1995-2019, The AROS Development Team. All rights reserved. $Id$ */ diff --git a/rom/devs/ata/mmakefile.src b/rom/devs/ata/mmakefile.src index 624eb7850e..71713b534c 100644 --- a/rom/devs/ata/mmakefile.src +++ b/rom/devs/ata/mmakefile.src @@ -20,6 +20,8 @@ ATA_DEVICEFILES := \ ata_init \ lowlevel \ ata \ + ata_trim \ + ata_smart \ timer \ waitnano \ waitto \ diff --git a/workbench/tools/SysExplorer/Modules/AHCI/ahci_enum.c b/workbench/tools/SysExplorer/Modules/AHCI/ahci_enum.c index 4db365e8a4..856b6a4540 100644 --- a/workbench/tools/SysExplorer/Modules/AHCI/ahci_enum.c +++ b/workbench/tools/SysExplorer/Modules/AHCI/ahci_enum.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2015-2018, The AROS Development Team. + Copyright (C) 2018-2019, The AROS Development Team. $Id$ */ diff --git a/workbench/tools/SysExplorer/Modules/AHCI/ahci_init.c b/workbench/tools/SysExplorer/Modules/AHCI/ahci_init.c index 9b76a3f9cd..50f0e7d1ed 100644 --- a/workbench/tools/SysExplorer/Modules/AHCI/ahci_init.c +++ b/workbench/tools/SysExplorer/Modules/AHCI/ahci_init.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2018, The AROS Development Team. + Copyright (C) 2018-2019, The AROS Development Team. $Id$ */ diff --git a/workbench/tools/SysExplorer/Modules/AHCI/ahcibus_window_cl.c b/workbench/tools/SysExplorer/Modules/AHCI/ahcibus_window_cl.c index 19256a3c60..fa1d64fe34 100644 --- a/workbench/tools/SysExplorer/Modules/AHCI/ahcibus_window_cl.c +++ b/workbench/tools/SysExplorer/Modules/AHCI/ahcibus_window_cl.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2018, The AROS Development Team. + Copyright (C) 2018-2019, The AROS Development Team. $Id$ */ diff --git a/workbench/tools/SysExplorer/Modules/AHCI/ahciunit_window_cl.c b/workbench/tools/SysExplorer/Modules/AHCI/ahciunit_window_cl.c index c965458ec2..046aecdb71 100644 --- a/workbench/tools/SysExplorer/Modules/AHCI/ahciunit_window_cl.c +++ b/workbench/tools/SysExplorer/Modules/AHCI/ahciunit_window_cl.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2018, The AROS Development Team. + Copyright (C) 2018-2019, The AROS Development Team. $Id$ */ @@ -8,6 +8,7 @@ #define MUIMASTER_YES_INLINE_STDARG #include +#include #include #include @@ -35,6 +36,7 @@ #include extern OOP_AttrBase HiddAHCIUnitAB; +extern OOP_AttrBase HiddStorageUnitAB; /*** Instance Data **********************************************************/ struct AHCIUnitWindow_DATA @@ -77,6 +79,7 @@ static void DecodeBits(char *str, ULONG flags, const char *const *names) static Object *AHCIUnitWindow__OM_NEW(Class *cl, Object *self, struct opSet *msg) { + Object *window, *ahcigroup; OOP_Object *dev = (OOP_Object *)GetTagData(MUIA_PropertyWin_Object, 0, msg->ops_AttrList); char feature_str[256]; IPTR val; @@ -88,10 +91,10 @@ static Object *AHCIUnitWindow__OM_NEW(Class *cl, Object *self, struct opSet *msg OOP_GetAttr(dev, aHidd_AHCIUnit_Features, &val); DecodeBits(feature_str, val, featNames); - return (Object *) DoSuperNewTags + window = (Object *) DoSuperNewTags ( cl, self, NULL, - Child, (IPTR)(ColGroup(2), + Child, (IPTR)(ahcigroup = (ColGroup(2), MUIA_Group_SameSize, TRUE, MUIA_FrameTitle, (IPTR)"AHCI", GroupFrame, @@ -107,10 +110,18 @@ static Object *AHCIUnitWindow__OM_NEW(Class *cl, Object *self, struct opSet *msg MUIA_Floattext_Text, (IPTR)feature_str, End), End), - End), + End)), TAG_MORE, (IPTR) msg->ops_AttrList, TAG_DONE - );; + ); + if (window) + { + IPTR unitdev; + OOP_GetAttr(dev, aHidd_StorageUnit_Device, &unitdev); + OOP_GetAttr(dev, aHidd_StorageUnit_Number, &val); + QueryATAStorageFeatures(ahcigroup, (char *)unitdev, val); + } + return window; } /*** Setup ******************************************************************/ diff --git a/workbench/tools/SysExplorer/Modules/ATA/ata_enum.c b/workbench/tools/SysExplorer/Modules/ATA/ata_enum.c index 69b794f78a..66c95a04a4 100644 --- a/workbench/tools/SysExplorer/Modules/ATA/ata_enum.c +++ b/workbench/tools/SysExplorer/Modules/ATA/ata_enum.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2015-2018, The AROS Development Team. + Copyright (C) 2015-2019, The AROS Development Team. $Id$ */ diff --git a/workbench/tools/SysExplorer/Modules/ATA/ata_init.c b/workbench/tools/SysExplorer/Modules/ATA/ata_init.c index 94ce37e493..9d0d2a32a0 100644 --- a/workbench/tools/SysExplorer/Modules/ATA/ata_init.c +++ b/workbench/tools/SysExplorer/Modules/ATA/ata_init.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2018, The AROS Development Team. + Copyright (C) 2018-2019, The AROS Development Team. $Id$ */ diff --git a/workbench/tools/SysExplorer/Modules/ATA/ata_window_cl.c b/workbench/tools/SysExplorer/Modules/ATA/ata_window_cl.c index eba78793d9..7e441135fa 100644 --- a/workbench/tools/SysExplorer/Modules/ATA/ata_window_cl.c +++ b/workbench/tools/SysExplorer/Modules/ATA/ata_window_cl.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2016, The AROS Development Team. + Copyright (C) 2013-2019, The AROS Development Team. $Id$ */ diff --git a/workbench/tools/SysExplorer/Modules/ATA/atabus_window_cl.c b/workbench/tools/SysExplorer/Modules/ATA/atabus_window_cl.c index c95661fa90..6d27291280 100644 --- a/workbench/tools/SysExplorer/Modules/ATA/atabus_window_cl.c +++ b/workbench/tools/SysExplorer/Modules/ATA/atabus_window_cl.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018, The AROS Development Team. + Copyright (C) 2013-2019, The AROS Development Team. $Id: ata_window_cl.c 51417 2016-01-25 18:10:16Z NicJA $ */ diff --git a/workbench/tools/SysExplorer/Modules/ATA/ataunit_window_cl.c b/workbench/tools/SysExplorer/Modules/ATA/ataunit_window_cl.c index 0fa6d5bf6b..fe4cdbd621 100644 --- a/workbench/tools/SysExplorer/Modules/ATA/ataunit_window_cl.c +++ b/workbench/tools/SysExplorer/Modules/ATA/ataunit_window_cl.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018, The AROS Development Team. + Copyright (C) 2013-2019, The AROS Development Team. $Id$ */ @@ -8,6 +8,7 @@ #define MUIMASTER_YES_INLINE_STDARG #include +#include #include #include @@ -35,6 +36,7 @@ #include extern OOP_AttrBase HiddATAUnitAB; +extern OOP_AttrBase HiddStorageUnitAB; struct MUI_CustomClass * ATAUnitWindow_CLASS; @@ -83,6 +85,7 @@ static void DecodeBits(char *str, ULONG flags, const char *const *names) static Object *ATAUnitWindow__OM_NEW(Class *cl, Object *self, struct opSet *msg) { + Object *window, *atagroup; OOP_Object *dev = (OOP_Object *)GetTagData(MUIA_PropertyWin_Object, 0, msg->ops_AttrList); char xfermodes_str[256]; char usemodes_str[256]; @@ -101,11 +104,10 @@ static Object *ATAUnitWindow__OM_NEW(Class *cl, Object *self, struct opSet *msg) OOP_GetAttr(dev, aHidd_ATAUnit_MultiSector, &val); snprintf(multisector_str, sizeof(multisector_str), "%ld", val); - - return (Object *) DoSuperNewTags + window = (Object *) DoSuperNewTags ( cl, self, NULL, - Child, (IPTR)(ColGroup(2), + Child, (IPTR)(atagroup = (ColGroup(2), MUIA_Group_SameSize, TRUE, MUIA_FrameTitle, (IPTR)"IDE/ATA", GroupFrame, @@ -139,10 +141,18 @@ static Object *ATAUnitWindow__OM_NEW(Class *cl, Object *self, struct opSet *msg) MUIA_CycleChain, 1, MUIA_Text_Contents, (IPTR)multisector_str, End), - End), + End)), TAG_MORE, (IPTR) msg->ops_AttrList, TAG_DONE ); + if (window) + { + IPTR unitdev; + OOP_GetAttr(dev, aHidd_StorageUnit_Device, &unitdev); + OOP_GetAttr(dev, aHidd_StorageUnit_Number, &val); + QueryATAStorageFeatures(atagroup, (char *)unitdev, val); + } + return window; } /*** Setup ******************************************************************/ diff --git a/workbench/tools/SysExplorer/Modules/Storage/storage.conf b/workbench/tools/SysExplorer/Modules/Storage/storage.conf index c901da0e41..10dc1e6fc3 100644 --- a/workbench/tools/SysExplorer/Modules/Storage/storage.conf +++ b/workbench/tools/SysExplorer/Modules/Storage/storage.conf @@ -17,4 +17,5 @@ BOOL RegisterStorageControllerHandler(CONST_STRPTR classid, BYTE pri, struct MUI BOOL RegisterStorageBusHandler(CONST_STRPTR classid, BYTE pri, struct MUI_CustomClass *customwinclass, CLASS_ENUMFUNC enumfunc, CLASS_VALIDFUNC validfunc) (A0, D0, A1, A2, A3) .skip 3 BOOL EnumBusUnits(OOP_Object *obj, struct MUI_NListtree_TreeNode *parent, APTR hookFunc, APTR hookData) (A0, A1, A2, A3) +void QueryATAStorageFeatures(Object *obj, char *devName, int devUnit) (A0, A1, D0) ##end functionlist diff --git a/workbench/tools/SysExplorer/Modules/Storage/storage_enum.c b/workbench/tools/SysExplorer/Modules/Storage/storage_enum.c index 507ff48f59..8f76e9f266 100644 --- a/workbench/tools/SysExplorer/Modules/Storage/storage_enum.c +++ b/workbench/tools/SysExplorer/Modules/Storage/storage_enum.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2015-2018, The AROS Development Team. + Copyright (C) 2015-2019, The AROS Development Team. $Id$ */ @@ -22,6 +22,9 @@ #include #include +#include +#include + #include "locale.h" #include "enums.h" @@ -213,6 +216,107 @@ AROS_LH4(void, EnumBusUnits, AROS_LIBFUNC_EXIT } +/* + Query a units device to see if it supports ATA device features, and if they are enebaled + for the unit. + Add objects to the passed in colgroup(2) if supported features are found. +*/ +AROS_LH3(void, QueryATAStorageFeatures, + AROS_LHA(Object *, obj, A0), + AROS_LHA(char *, devName, A1), + AROS_LHA(int, devUnit, D0), + struct SysexpStorageBase *, StorageBase, 16, Storage) +{ + AROS_LIBFUNC_INIT + + struct IOStdReq *io; + struct MsgPort * ioReplyPort; + struct NSDeviceQueryResult nsdqr; + LONG error; + + ioReplyPort = CreateMsgPort(); + if (!ioReplyPort) + return; + + io = CreateIORequest(ioReplyPort, sizeof(struct IOStdReq)); + if (!io) + { + DeleteMsgPort(ioReplyPort); + return; + } + + if (!OpenDevice(devName, devUnit,(struct IORequest *)io,0)) + { + io->io_Command = NSCMD_DEVICEQUERY; + io->io_Length = sizeof(nsdqr); + io->io_Data = (APTR)&nsdqr; + + error = DoIO((struct IORequest *)io); + + if((!error) && + (io->io_Actual >= 16) && + (io->io_Actual <= sizeof(nsdqr)) && + (nsdqr.SizeAvailable == io->io_Actual)) + { + UWORD *cmdcheck; + for(cmdcheck = nsdqr.SupportedCommands; + *cmdcheck; + cmdcheck++) + { + ULONG queryres = 0; + + // Does the device understand the SMART Cmd? + if(*cmdcheck == HD_SMARTCMD) + { + // Check if the unit Supports SMART + io->io_Command = HD_SMARTCMD; + io->io_Reserved1 = io->io_Reserved2 = ATAFEATURE_TEST_AVAIL; + io->io_Length = sizeof(queryres); + io->io_Data = (APTR)&queryres; + error = DoIO((struct IORequest *)io); + if ((!error) && (io->io_Actual >= 4) && (queryres == SMART_MAGIC_ID)) + { + IPTR smartSpacer = (IPTR)HVSpace; + IPTR smartLabel = (IPTR)Label("SMART Supported"); + if (DoMethod(obj, MUIM_Group_InitChange)) + { + DoMethod(obj, OM_ADDMEMBER, smartSpacer); + DoMethod(obj, OM_ADDMEMBER, smartLabel); + DoMethod(obj, MUIM_Group_ExitChange); + } + } + } + + // Does the device understand the TRIM Cmd? + if(*cmdcheck == HD_TRIMCMD) + { + // Check if the unit Supports TRIM + io->io_Command = HD_TRIMCMD; + io->io_Reserved1 = io->io_Reserved2 = ATAFEATURE_TEST_AVAIL; + io->io_Length = sizeof(queryres); + io->io_Data = (APTR)&queryres; + error = DoIO((struct IORequest *)io); + if ((!error) && (io->io_Actual >= 4) && (queryres == TRIM_MAGIC_ID)) + { + IPTR trimSpacer = (IPTR)HVSpace; + IPTR trimLabel = (IPTR)Label("TRIM Supported"); + if (DoMethod(obj, MUIM_Group_InitChange)) + { + DoMethod(obj, OM_ADDMEMBER, trimSpacer); + DoMethod(obj, OM_ADDMEMBER, trimLabel); + DoMethod(obj, MUIM_Group_ExitChange); + } + } + } + } + } + CloseDevice(io); + } + DeleteIORequest(io); + DeleteMsgPort(ioReplyPort); + + AROS_LIBFUNC_EXIT +} AROS_LH5(BOOL, RegisterStorageClassHandler, AROS_LHA(CONST_STRPTR, classid, A0), diff --git a/workbench/tools/SysExplorer/Modules/Storage/storage_init.c b/workbench/tools/SysExplorer/Modules/Storage/storage_init.c index 369e548246..8a5cc6b309 100644 --- a/workbench/tools/SysExplorer/Modules/Storage/storage_init.c +++ b/workbench/tools/SysExplorer/Modules/Storage/storage_init.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2018, The AROS Development Team. + Copyright (C) 2018-2019, The AROS Development Team. $Id$ */ diff --git a/workbench/tools/SysExplorer/Modules/Storage/storagebus_window_cl.c b/workbench/tools/SysExplorer/Modules/Storage/storagebus_window_cl.c index 1b02724679..9b593326b6 100644 --- a/workbench/tools/SysExplorer/Modules/Storage/storagebus_window_cl.c +++ b/workbench/tools/SysExplorer/Modules/Storage/storagebus_window_cl.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018, The AROS Development Team. + Copyright (C) 2013-2019, The AROS Development Team. $Id: ata_window_cl.c 51417 2016-01-25 18:10:16Z NicJA $ */ @@ -48,7 +48,7 @@ static Object *StorageBusWindow__OM_NEW(Class *cl, Object *self, struct opSet *m char maxbusunits_str[4]; IPTR val; - D(bug("[ata.sysexp] %s: cl @ %p\n", __func__, cl)); + D(bug("[storage.sysexp] %s: cl @ %p\n", __func__, cl)); if ((!dev)) return NULL; diff --git a/workbench/tools/SysExplorer/Modules/Storage/storageunit_window_cl.c b/workbench/tools/SysExplorer/Modules/Storage/storageunit_window_cl.c index bf3f6db5c7..d8a3f0467e 100644 --- a/workbench/tools/SysExplorer/Modules/Storage/storageunit_window_cl.c +++ b/workbench/tools/SysExplorer/Modules/Storage/storageunit_window_cl.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2018, The AROS Development Team. + Copyright (C) 2018-2019, The AROS Development Team. $Id$ */ diff --git a/workbench/tools/SysExplorer/computer_page_cl.c b/workbench/tools/SysExplorer/computer_page_cl.c index 241115ccbd..1c7348f80f 100644 --- a/workbench/tools/SysExplorer/computer_page_cl.c +++ b/workbench/tools/SysExplorer/computer_page_cl.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018, The AROS Development Team. + Copyright (C) 2013-2019, The AROS Development Team. $Id$ */ diff --git a/workbench/tools/SysExplorer/device_page_cl.c b/workbench/tools/SysExplorer/device_page_cl.c index 9dce0d8fc5..7cc88e5da8 100644 --- a/workbench/tools/SysExplorer/device_page_cl.c +++ b/workbench/tools/SysExplorer/device_page_cl.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018, The AROS Development Team. + Copyright (C) 2013-2019, The AROS Development Team. $Id$ */ diff --git a/workbench/tools/SysExplorer/mmakefile.src b/workbench/tools/SysExplorer/mmakefile.src index ef17bfdfa5..49c4dc9424 100644 --- a/workbench/tools/SysExplorer/mmakefile.src +++ b/workbench/tools/SysExplorer/mmakefile.src @@ -52,11 +52,12 @@ USER_CPPFLAGS += -DADATE="\"$(shell date '+%d.%m.%Y')\"" USER_CPPFLAGS += -DDEBUG EXEDIR := $(AROSDIR)/Tools +SYSEXP_GENINCDIR := $(GENDIR)/$(CURDIR)/include #MM- workbench-tools-sysexplorer : workbench-tools-sysexplorer-catalogs workbench-tools-sysexplorer-includes workbench-tools-sysexplorer-app workbench-tools-sysexplorer-modules #MM- workbench-tools-sysexplorer-quick : workbench-tools-sysexplorer-catalogs workbench-tools-sysexplorer-app-quick workbench-tools-sysexplorer-modules-quick -SYSEXPCOMMON_INCLUDES := -I$(GENDIR)/$(CURDIR)/include +SYSEXPCOMMON_INCLUDES := -I$(SYSEXP_GENINCDIR) ##MM workbench-tools-sysexplorer-module-gfx : workbench-tools-sysexplorer-includes ##MM- workbench-tools-sysexplorer-modules : workbench-tools-sysexplorer-module-gfx @@ -71,13 +72,13 @@ SYSEXPCOMMON_INCLUDES := -I$(GENDIR)/$(CURDIR)/include #MM- workbench-tools-sysexplorer-modules : workbench-tools-sysexplorer-module-storage #MM- workbench-tools-sysexplorer-modules-quick : workbench-tools-sysexplorer-module-storage-quick -SYSEXPSTORAGE_INCLUDES := -I$(SRCDIR)/$(CURDIR)/$(STORAGEMODDIR) +SYSEXPSTORAGE_INCLUDES := -I$(SRCDIR)/$(CURDIR)/$(STORAGEMODDIR) -I$(SYSEXP_GENINCDIR) USER_INCLUDES := $(SYSEXPCOMMON_INCLUDES) $(SYSEXPSTORAGE_INCLUDES) USER_LDFLAGS := -static %build_module mmake=workbench-tools-sysexplorer-module-storage \ modname=storage modtype=library modsuffix=sysexp \ files="$(STORAGEFILES)" moduledir=$(AROS_DIR_TOOLS)/SysExpModules \ - uselibs="amiga" conffile=$(SRCDIR)/$(CURDIR)/$(STORAGEMODDIR)/storage.conf + uselibs="amiga" includedir=$(SYSEXP_GENINCDIR) conffile=$(SRCDIR)/$(CURDIR)/$(STORAGEMODDIR)/storage.conf #MM workbench-tools-sysexplorer-module-ata : workbench-tools-sysexplorer-includes workbench-tools-sysexplorer-module-storage-includes kernel-ata-includes #MM- workbench-tools-sysexplorer-modules : workbench-tools-sysexplorer-module-ata @@ -88,7 +89,7 @@ USER_LDFLAGS := -static %build_module mmake=workbench-tools-sysexplorer-module-ata \ modname=ata modtype=library modsuffix=sysexp \ files="$(ATAFILES)" moduledir=$(AROS_DIR_TOOLS)/SysExpModules \ - uselibs="amiga" conffile=$(SRCDIR)/$(CURDIR)/$(ATAMODDIR)/ata.conf + uselibs="amiga" includedir=$(SYSEXP_GENINCDIR) conffile=$(SRCDIR)/$(CURDIR)/$(ATAMODDIR)/ata.conf #MM workbench-tools-sysexplorer-module-ahci : workbench-tools-sysexplorer-includes workbench-tools-sysexplorer-module-storage-includes kernel-ahci-includes #MM- workbench-tools-sysexplorer-modules : workbench-tools-sysexplorer-module-ahci @@ -99,7 +100,7 @@ USER_LDFLAGS := -static %build_module mmake=workbench-tools-sysexplorer-module-ahci \ modname=ahci modtype=library modsuffix=sysexp \ files="$(AHCIFILES)" moduledir=$(AROS_DIR_TOOLS)/SysExpModules \ - uselibs="amiga" conffile=$(SRCDIR)/$(CURDIR)/$(AHCIMODDIR)/ahci.conf + uselibs="amiga" includedir=$(SYSEXP_GENINCDIR) conffile=$(SRCDIR)/$(CURDIR)/$(AHCIMODDIR)/ahci.conf #MM workbench-tools-sysexplorer-gen-includes : workbench-tools-sysexplorer-gen-setup #MM- workbench-tools-sysexplorer-includes : workbench-tools-sysexplorer-gen-includes @@ -116,13 +117,13 @@ workbench-tools-sysexplorer-gen-includes: $(GENDIR)/$(CURDIR)/.includes-generate $(GENDIR)/$(CURDIR)/.includes-generated : $(GENMODULE) $(SRCDIR)/$(CURDIR)/sysexp.conf @$(ECHO) "Generating SysExp.library Private API headers..." - @$(GENMODULE) -c $(SRCDIR)/$(CURDIR)/sysexp.conf -d $(GENDIR)/$(CURDIR)/include writeincludes sysexp library - @$(GENMODULE) -c $(SRCDIR)/$(CURDIR)/sysexp.conf -d $(GENDIR)/$(CURDIR)/include writelibdefs sysexp library + @$(GENMODULE) -c $(SRCDIR)/$(CURDIR)/sysexp.conf -d $(SYSEXP_GENINCDIR) writeincludes sysexp library + @$(GENMODULE) -c $(SRCDIR)/$(CURDIR)/sysexp.conf -d $(SYSEXP_GENINCDIR) writelibdefs sysexp library @$(TOUCH) $@ #MM workbench-tools-sysexplorer-gen-setup: - %mkdirs_q $(GENDIR)/$(CURDIR)/include/clib $(GENDIR)/$(CURDIR)/include/defines $(GENDIR)/$(CURDIR)/include/inline $(GENDIR)/$(CURDIR)/include/proto + %mkdirs_q $(SYSEXP_GENINCDIR)/clib $(SYSEXP_GENINCDIR)/defines $(SYSEXP_GENINCDIR)/inline $(SYSEXP_GENINCDIR)/proto #MM workbench-tools-sysexplorer-app : iconset-$(AROS_TARGET_ICONSET)-additional-icons-aros-tools-SysExplorer kernel-hidd-storage-includes diff --git a/workbench/tools/SysExplorer/sysexp_locale.c b/workbench/tools/SysExplorer/sysexp_locale.c index d24dc11cf7..b86094ae69 100644 --- a/workbench/tools/SysExplorer/sysexp_locale.c +++ b/workbench/tools/SysExplorer/sysexp_locale.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2018, The AROS Development Team. All rights reserved. + Copyright © 1995-2019, The AROS Development Team. All rights reserved. $Id$ */ diff --git a/workbench/tools/SysExplorer/sysexp_main.c b/workbench/tools/SysExplorer/sysexp_main.c index 694eb0a2d5..73f0bb95ce 100644 --- a/workbench/tools/SysExplorer/sysexp_main.c +++ b/workbench/tools/SysExplorer/sysexp_main.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018, The AROS Development Team. + Copyright (C) 2013-2019, The AROS Development Team. $Id$ */ -- 2.11.4.GIT