Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
Bare Metal Firmware
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kestrel Collaboration
Kestrel Firmware
Bare Metal Firmware
Commits
b919089f
Commit
b919089f
authored
Mar 11, 2021
by
Evan Lojewski
Committed by
Raptor Engineering Development Team
Mar 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firmware: Enable clang-tidy and enforce braces around statements.
parent
d73eae87
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
141 additions
and
3 deletions
+141
-3
.clang-tidy
.clang-tidy
+108
-0
CMakeLists.txt
CMakeLists.txt
+2
-0
fsi.c
fsi.c
+7
-2
isr.c
isr.c
+2
-1
main.c
main.c
+22
-0
No files found.
.clang-tidy
0 → 100644
View file @
b919089f
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,readability-*'
WarningsAsErrors: 'clang-diagnostic-*,clang-analyzer-*,-*,readability-braces-around-statements'
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
CheckOptions:
- key: cert-dcl16-c.NewSuffixes
value: 'L;LL;LU;LLU'
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
value: '0'
- key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons
value: '0'
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
value: '1'
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: llvm-else-after-return.WarnOnConditionVariables
value: '0'
- key: llvm-else-after-return.WarnOnUnfixable
value: '0'
- key: llvm-qualified-auto.AddConstToQualified
value: '0'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
- key: readability-braces-around-statements.ShortStatementLines
value: '0'
- key: readability-else-after-return.WarnOnConditionVariables
value: 'true'
- key: readability-else-after-return.WarnOnUnfixable
value: 'true'
- key: readability-function-size.BranchThreshold
value: '4294967295'
- key: readability-function-size.LineThreshold
value: '4294967295'
- key: readability-function-size.NestingThreshold
value: '4294967295'
- key: readability-function-size.ParameterThreshold
value: '4294967295'
- key: readability-function-size.StatementThreshold
value: '800'
- key: readability-function-size.VariableThreshold
value: '4294967295'
- key: readability-identifier-naming.AggressiveDependentMemberLookup
value: 'false'
- key: readability-identifier-naming.IgnoreFailedSplit
value: 'false'
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: 'false'
- key: readability-implicit-bool-conversion.AllowIntegerConditions
value: 'false'
- key: readability-implicit-bool-conversion.AllowPointerConditions
value: 'false'
- key: readability-inconsistent-declaration-parameter-name.IgnoreMacros
value: 'true'
- key: readability-inconsistent-declaration-parameter-name.Strict
value: 'false'
- key: readability-magic-numbers.IgnoreAllFloatingPointValues
value: 'false'
- key: readability-magic-numbers.IgnoreBitFieldsWidths
value: 'true'
- key: readability-magic-numbers.IgnorePowersOf2IntegerValues
value: 'false'
- key: readability-magic-numbers.IgnoredFloatingPointValues
value: '1.0;100.0;'
- key: readability-magic-numbers.IgnoredIntegerValues
value: '1;2;3;4;'
- key: readability-qualified-auto.AddConstToQualified
value: 'true'
- key: readability-redundant-declaration.IgnoreMacros
value: 'true'
- key: readability-redundant-member-init.IgnoreBaseInCopyConstructors
value: 'false'
- key: readability-redundant-smartptr-get.IgnoreMacros
value: 'true'
- key: readability-redundant-string-init.StringNames
value: '::std::basic_string'
- key: readability-simplify-boolean-expr.ChainedConditionalAssignment
value: 'false'
- key: readability-simplify-boolean-expr.ChainedConditionalReturn
value: 'false'
- key: readability-simplify-subscript-expr.Types
value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array'
- key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold
value: '3'
- key: readability-uppercase-literal-suffix.IgnoreMacros
value: 'true'
- key: readability-uppercase-literal-suffix.NewSuffixes
value: ''
...
CMakeLists.txt
View file @
b919089f
...
...
@@ -70,6 +70,7 @@ project(firmware VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
include
(
bootrom/cmake/clang-format.cmake
)
include
(
bootrom/cmake/clang-analyzer.cmake
)
include
(
bootrom/cmake/clang-tidy.cmake
)
include
(
bootrom/cmake/config.cmake
)
add_subdirectory
(
bootrom/utils
)
...
...
@@ -100,3 +101,4 @@ target_link_libraries(${PROJECT_NAME} PRIVATE libbase-nofloat)
target_compile_definitions
(
${
PROJECT_NAME
}
PRIVATE
"-DNO_FLINT"
)
# Disable linting
format_target_sources
(
${
PROJECT_NAME
}
)
enable_clang_tidy
(
${
PROJECT_NAME
}
)
fsi.c
View file @
b919089f
...
...
@@ -85,7 +85,8 @@ static int access_fsi_mem(uint8_t slave_id, uint32_t address, fsi_data_length_t
// Wait for operation to complete
while
(
!
(
read_openfsi_register
(
OPENFSIMASTER_BASE
,
FSI_MASTER_REG_STATUS
)
&
(
FSI_MASTER_CTL_CYCLE_START_MASK
<<
FSI_MASTER_CTL_CYCLE_START_SHIFT
)))
;
{
}
// Read status register
word
=
read_openfsi_register
(
OPENFSIMASTER_BASE
,
FSI_MASTER_REG_STATUS
);
...
...
@@ -148,7 +149,8 @@ static int initialize_fsi_master(void)
// Wait for any running operation(s) to complete
while
(
read_openfsi_register
(
OPENFSIMASTER_BASE
,
FSI_MASTER_REG_STATUS
)
&
(
FSI_MASTER_CTL_CYCLE_START_MASK
<<
FSI_MASTER_CTL_CYCLE_START_SHIFT
))
;
{
}
// Set up ACK to CMD turnaround delay and enable CRC protection / enhanced
// error recovery
...
...
@@ -194,7 +196,10 @@ int run_pre_ipl_fixups(void)
// Configure SBE to pre-IPL state
if
(
access_cfam
(
IBM_POWER9_SLAVE_ID
,
IBM_POWER9_LL_MODE_REG
,
FSI_DATA_LENGTH_WORD
,
FSI_DIRECTION_READ
,
&
word
))
{
goto
fail
;
}
word
&=
~
(
0x1
<<
31
);
// Clear SBE IPL start flag
word
&=
~
(
0x1
<<
29
);
// Run SCAN0 and CLOCKSTART during IPL
word
&=
~
(
0x1
<<
28
);
// Clear SBE start prevention flag
...
...
isr.c
View file @
b919089f
...
...
@@ -77,7 +77,8 @@ void isr(uint64_t vec)
irq_unhandled_vector
=
vec
;
irq_unhandled_vector_valid
=
1
;
while
(
1
)
;
{
}
}
void
isr_dec
(
void
)
...
...
main.c
View file @
b919089f
...
...
@@ -131,7 +131,9 @@ static char *readstr(void)
return
s
;
default:
if
(
ptr
>=
(
sizeof
(
s
)
-
1
))
{
break
;
}
putsnonl
(
c
);
s
[
ptr
]
=
c
[
0
];
ptr
++
;
...
...
@@ -863,11 +865,17 @@ static void process_host_to_bmc_ipmi_bt_transactions(void)
((
1
<<
LPC_ADDRESS_BITS
)
-
1
);
hiomap_config
.
active_device_id
=
ipmi_bt_current_request
.
data
[
6
];
if
(
ipmi_bt_current_request
.
data
[
0
]
==
HIOMAP_CMD_CREATE_RD_WIN
)
{
hiomap_config
.
window_type
=
HIOMAP_WINDOW_TYPE_READ
;
}
else
if
(
ipmi_bt_current_request
.
data
[
0
]
==
HIOMAP_CMD_CREATE_WR_WIN
)
{
hiomap_config
.
window_type
=
HIOMAP_WINDOW_TYPE_WRITE
;
}
else
{
hiomap_config
.
window_type
=
HIOMAP_WINDOW_INACTIVE
;
}
// Sanitize input
switch
(
hiomap_config
.
protocol_version
)
...
...
@@ -2062,16 +2070,26 @@ static void console_service(void)
str
=
readstr
();
if
(
str
==
NULL
)
{
return
;
}
token
=
get_token
(
&
str
);
if
(
strcmp
(
token
,
"help"
)
==
0
)
{
help
();
}
else
if
(
strcmp
(
token
,
"reboot"
)
==
0
)
{
reboot
();
}
else
if
(
strcmp
(
token
,
"ipl"
)
==
0
)
{
start_ipl
(
0
);
}
else
if
(
strcmp
(
token
,
"sbe_status"
)
==
0
)
{
get_sbe_status
();
}
else
if
(
strcmp
(
token
,
"mr"
)
==
0
)
{
if
(
*
str
)
...
...
@@ -2209,9 +2227,13 @@ static void console_service(void)
}
}
else
if
(
strcmp
(
token
,
"console"
)
==
0
)
{
attach_to_host_console
();
}
else
if
(
strcmp
(
token
,
""
)
!=
0
)
{
printf
(
"%s: command not found
\n
"
,
token
);
}
prompt
();
}
...
...
Write
Preview
Markdown
is supported
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