Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
triazo
/
kernel
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
3
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
990cdff2
authored
Nov 08, 2015
by
triazo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Move print stuff into seperate function
parent
9fc85493
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
src/pci.c
src/pci.c
View file @
990cdff2
...
@@ -6,14 +6,12 @@
...
@@ -6,14 +6,12 @@
#include "pci.h"
#include "pci.h"
#include "serial.h"
#include "serial.h"
// reads a word from the io port using the pci addressing scheme
void
pciSerialInfo
(
bus
,
device
,
function
,
offset
)
uint32_t
pciConfigReadWord
(
uint8_t
bus
,
uint8_t
slot
,
uint8_t
func
,
uint8_t
offset
)
{
{
uint32_t
address
;
uint32_t
address
;
uint32_t
lbus
=
(
uint32_t
)
bus
;
uint32_t
lbus
=
(
uint32_t
)
bus
;
uint32_t
lslot
=
(
uint32_t
)
slot
;
uint32_t
lslot
=
(
uint32_t
)
slot
;
uint32_t
lfunc
=
(
uint32_t
)
func
;
uint32_t
lfunc
=
(
uint32_t
)
func
;
address
=
(
uint32_t
)((
lbus
<<
16
)
|
address
=
(
uint32_t
)((
lbus
<<
16
)
|
(
lslot
<<
11
)
|
(
lslot
<<
11
)
|
(
lfunc
<<
8
)
|
(
lfunc
<<
8
)
|
...
@@ -21,10 +19,8 @@ uint32_t pciConfigReadWord(uint8_t bus, uint8_t slot, uint8_t func, uint8_t offs
...
@@ -21,10 +19,8 @@ uint32_t pciConfigReadWord(uint8_t bus, uint8_t slot, uint8_t func, uint8_t offs
((
uint32_t
)
0x80000000
));
((
uint32_t
)
0x80000000
));
outl
(
PCI_CONFIG_ACCESS
,
address
);
outl
(
PCI_CONFIG_ACCESS
,
address
);
// return the contents of the address clipped
uint32_t
data
=
inl
(
PCI_CONFIG_DATA
);
uint32_t
data
=
inl
(
PCI_CONFIG_DATA
);
if
(
data
!=
-
1
)
{
serial_writestring
(
"address 0x"
);
serial_writestring
(
"address 0x"
);
serial_hexword
(
address
);
serial_hexword
(
address
);
serial_writestring
(
" returned 0x"
);
serial_writestring
(
" returned 0x"
);
...
@@ -38,7 +34,25 @@ uint32_t pciConfigReadWord(uint8_t bus, uint8_t slot, uint8_t func, uint8_t offs
...
@@ -38,7 +34,25 @@ uint32_t pciConfigReadWord(uint8_t bus, uint8_t slot, uint8_t func, uint8_t offs
serial_writestring
(
" with offset "
);
serial_writestring
(
" with offset "
);
serial_hexbyte
(
offset
);
serial_hexbyte
(
offset
);
serial_writechar
(
'\n'
);
serial_writechar
(
'\n'
);
}
}
// reads a word from the io port using the pci addressing scheme
uint32_t
pciConfigReadWord
(
uint8_t
bus
,
uint8_t
slot
,
uint8_t
func
,
uint8_t
offset
)
{
uint32_t
address
;
uint32_t
lbus
=
(
uint32_t
)
bus
;
uint32_t
lslot
=
(
uint32_t
)
slot
;
uint32_t
lfunc
=
(
uint32_t
)
func
;
address
=
(
uint32_t
)((
lbus
<<
16
)
|
(
lslot
<<
11
)
|
(
lfunc
<<
8
)
|
(
offset
&
0xfc
)
|
((
uint32_t
)
0x80000000
));
outl
(
PCI_CONFIG_ACCESS
,
address
);
// return the contents of the address clipped
uint32_t
data
=
inl
(
PCI_CONFIG_DATA
);
return
data
;
return
data
;
}
}
...
...
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