Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
HardenedBSD
HardenedBSD
Commits
1d0e6636
Commit
1d0e6636
authored
Jan 21, 2022
by
HardenedBSD Sync Service
Browse files
Merge remote-tracking branch 'freebsd/stable/12' into hardened/12-stable/master
parents
739b18b1
e265658e
Changes
2
Hide whitespace changes
Inline
Side-by-side
libexec/rc/rc.d/ctld
View file @
1d0e6636
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#
#
# PROVIDE: ctld
# PROVIDE: ctld
# REQUIRE: FILESYSTEMS
# REQUIRE: FILESYSTEMS
NETWORKING
# BEFORE: DAEMON
# BEFORE: DAEMON
# KEYWORD: nojail
# KEYWORD: nojail
...
...
sys/cam/ata/ata_da.c
View file @
1d0e6636
...
@@ -3489,6 +3489,7 @@ adaspindown(uint8_t cmd, int flags)
...
@@ -3489,6 +3489,7 @@ adaspindown(uint8_t cmd, int flags)
struct
ada_softc
*
softc
;
struct
ada_softc
*
softc
;
struct
ccb_ataio
local_ccb
;
struct
ccb_ataio
local_ccb
;
int
error
;
int
error
;
int
mode
;
CAM_PERIPH_FOREACH
(
periph
,
&
adadriver
)
{
CAM_PERIPH_FOREACH
(
periph
,
&
adadriver
)
{
/* If we paniced with lock held - not recurse here. */
/* If we paniced with lock held - not recurse here. */
...
@@ -3504,6 +3505,52 @@ adaspindown(uint8_t cmd, int flags)
...
@@ -3504,6 +3505,52 @@ adaspindown(uint8_t cmd, int flags)
continue
;
continue
;
}
}
/*
* Additionally check if we would spin up the drive instead of
* spinning it down.
*/
if
(
cmd
==
ATA_IDLE_IMMEDIATE
)
{
memset
(
&
local_ccb
,
0
,
sizeof
(
local_ccb
));
xpt_setup_ccb
(
&
local_ccb
.
ccb_h
,
periph
->
path
,
CAM_PRIORITY_NORMAL
);
local_ccb
.
ccb_h
.
ccb_state
=
ADA_CCB_DUMP
;
cam_fill_ataio
(
&
local_ccb
,
0
,
NULL
,
CAM_DIR_NONE
,
0
,
NULL
,
0
,
ada_default_timeout
*
1000
);
ata_28bit_cmd
(
&
local_ccb
,
ATA_CHECK_POWER_MODE
,
0
,
0
,
0
);
local_ccb
.
cmd
.
flags
|=
CAM_ATAIO_NEEDRESULT
;
error
=
cam_periph_runccb
((
union
ccb
*
)
&
local_ccb
,
adaerror
,
/*cam_flags*/
0
,
/*sense_flags*/
SF_NO_RECOVERY
|
SF_NO_RETRY
,
softc
->
disk
->
d_devstat
);
if
(
error
!=
0
)
{
xpt_print
(
periph
->
path
,
"Failed to read current power mode
\n
"
);
}
else
{
mode
=
local_ccb
.
res
.
sector_count
;
#ifdef DIAGNOSTIC
if
(
bootverbose
)
{
xpt_print
(
periph
->
path
,
"disk power mode 0x%02x
\n
"
,
mode
);
}
#endif
switch
(
mode
)
{
case
0x00
:
case
0x01
:
if
(
bootverbose
)
{
xpt_print
(
periph
->
path
,
"already spun down
\n
"
);
}
cam_periph_unlock
(
periph
);
continue
;
default:
break
;
}
}
}
if
(
bootverbose
)
if
(
bootverbose
)
xpt_print
(
periph
->
path
,
"spin-down
\n
"
);
xpt_print
(
periph
->
path
,
"spin-down
\n
"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment