Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Verlässliche Systemsoftware
projects
osv
Commits
1ccc92c1
Commit
1ccc92c1
authored
12 years ago
by
Guy Zana
Browse files
Options
Downloads
Patches
Plain Diff
Disabling device intx assertions in order to enable MSI-x
parent
4c20393f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
drivers/driver.cc
+39
-2
39 additions, 2 deletions
drivers/driver.cc
drivers/driver.hh
+9
-0
9 additions, 0 deletions
drivers/driver.hh
drivers/pci.hh
+4
-0
4 additions, 0 deletions
drivers/pci.hh
with
52 additions
and
2 deletions
drivers/driver.cc
+
39
−
2
View file @
1ccc92c1
...
...
@@ -54,6 +54,17 @@ void Driver::setStatus(u16 s) {
write_pci_config_word
(
_bus
,
_slot
,
_func
,
PCI_STATUS_OFFSET
,
s
);
}
u16
Driver
::
get_command
(
void
)
{
return
(
pci_readw
(
PCI_COMMAND_OFFSET
));
}
void
Driver
::
set_command
(
u16
c
)
{
pci_writew
(
PCI_COMMAND_OFFSET
,
c
);
}
u8
Driver
::
getRevision
()
{
if
(
!
_present
)
throw
new
InitException
();
...
...
@@ -117,10 +128,16 @@ Driver::Init(Device* dev) {
parse_pci_config
();
debug
(
fmt
(
"Driver:Init %x:%x"
)
%
_vid
%
_id
);
setBusMaster
(
true
);
// Enable MSI-x
if
(
_have_msix
)
{
if
(
is_intx_enabled
())
{
disable_intx
();
}
}
debug
(
fmt
(
"Driver initialized %x:%x"
)
%
_vid
%
_id
);
return
true
;
}
...
...
@@ -210,6 +227,26 @@ bool Driver::parse_pci_msix(u8 off)
return
true
;
}
bool
Driver
::
is_intx_enabled
(
void
)
{
u16
command
=
get_command
();
return
(
(
command
&
PCI_COMMAND_INTX_DISABLE
)
==
0
);
}
void
Driver
::
enable_intx
(
void
)
{
u16
command
=
get_command
();
command
&=
~
PCI_COMMAND_INTX_DISABLE
;
set_command
(
command
);
}
void
Driver
::
disable_intx
(
void
)
{
u16
command
=
get_command
();
command
|=
PCI_COMMAND_INTX_DISABLE
;
set_command
(
command
);
}
u8
Driver
::
pci_readb
(
u8
offset
)
{
return
read_pci_config_byte
(
_bus
,
_slot
,
_func
,
offset
);
...
...
This diff is collapsed.
Click to expand it.
drivers/driver.hh
+
9
−
0
View file @
1ccc92c1
...
...
@@ -50,6 +50,8 @@ public:
u16
getStatus
();
void
setStatus
(
u16
s
);
u16
get_command
(
void
);
void
set_command
(
u16
c
);
bool
getBusMaster
();
void
setBusMaster
(
bool
m
);
virtual
void
dumpConfig
()
const
;
...
...
@@ -88,6 +90,13 @@ protected:
bool
allocateBARs
();
virtual
bool
earlyInitChecks
();
// Enable/Disable intx assertions
bool
is_intx_enabled
(
void
);
// Enable intx assertion
// intx assertions should be disabled in order to use MSI-x
void
enable_intx
(
void
);
void
disable_intx
(
void
);
// Parsing of extra capabilities
virtual
bool
parse_pci_capabilities
(
void
);
virtual
bool
parse_pci_msix
(
u8
off
);
...
...
This diff is collapsed.
Click to expand it.
drivers/pci.hh
+
4
−
0
View file @
1ccc92c1
...
...
@@ -63,6 +63,10 @@ using processor::outl;
PCI_CAPABILITIES_PTR
=
0x34
,
};
enum
pci_command_bits
{
PCI_COMMAND_INTX_DISABLE
=
(
1
<<
10
),
};
// Capability Register Offsets
enum
pci_capabilities_offsets
{
PCI_CAP_OFF_ID
=
0x0
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment