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
82512f3e
authored
Nov 09, 2015
by
triazo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix type bugs
parent
3e5af113
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
12 deletions
src/pci.c
src/pci.h
src/serial.h
src/pci.c
View file @
82512f3e
...
...
@@ -6,12 +6,12 @@
#include "pci.h"
#include "serial.h"
void
pciSerialInfo
(
bus
,
device
,
function
,
offset
)
void
pciSerialInfo
(
uint8_t
bus
,
uint8_t
device
,
uint8_t
function
,
uint8_t
offset
)
{
uint32_t
address
;
uint32_t
lbus
=
(
uint32_t
)
bus
;
uint32_t
lslot
=
(
uint32_t
)
slot
;
uint32_t
lfunc
=
(
uint32_t
)
func
;
uint32_t
lslot
=
(
uint32_t
)
device
;
uint32_t
lfunc
=
(
uint32_t
)
func
tion
;
address
=
(
uint32_t
)((
lbus
<<
16
)
|
(
lslot
<<
11
)
|
(
lfunc
<<
8
)
|
...
...
@@ -28,24 +28,24 @@ void pciSerialInfo(bus, device, function, offset)
serial_writestring
(
" on bus "
);
serial_hexbyte
(
bus
);
serial_writestring
(
" device "
);
serial_hexbyte
(
slot
);
serial_hexbyte
(
device
);
serial_writestring
(
" function "
);
serial_hexbyte
(
func
);
serial_hexbyte
(
func
tion
);
serial_writestring
(
" with offset "
);
serial_hexbyte
(
offset
);
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
pciConfigReadWord
(
uint8_t
bus
,
uint8_t
device
,
uint8_t
func
,
uint8_t
offset
)
{
uint32_t
address
;
uint32_t
lbus
=
(
uint32_t
)
bus
;
uint32_t
l
slot
=
(
uint32_t
)
slot
;
uint32_t
l
dev
=
(
uint32_t
)
device
;
uint32_t
lfunc
=
(
uint32_t
)
func
;
address
=
(
uint32_t
)((
lbus
<<
16
)
|
(
l
slot
<<
11
)
|
(
l
dev
<<
11
)
|
(
lfunc
<<
8
)
|
(
offset
&
0xfc
)
|
((
uint32_t
)
0x80000000
));
...
...
@@ -63,16 +63,17 @@ void checkAllBuses(void)
uint8_t
device
;
uint8_t
function
;
for
(
bus
=
0
;
bus
<
255
;
bus
++
)
for
(
bus
=
0
;
bus
<
255
;
bus
++
)
{
for
(
device
=
0
;
device
<
32
;
device
++
)
for
(
device
=
0
;
device
<
32
;
device
++
)
{
for
(
function
=
0
;
function
<
8
;
function
++
)
{
if
(
pciConfigReadWord
(
bus
,
device
,
function
,
0
)
!=
0xffffffff
)
{
pciSerialInfo
(
bus
,
device
,
function
,
0
);
serial_writestring
(
"- - - - - - - - - - - - - - - - - - - -
\n
"
);
pci
ConfigReadWord
(
bus
,
device
,
function
,
8
);
pci
SerialInfo
(
bus
,
device
,
function
,
8
);
serial_writestring
(
"=======================================
\n
"
);
}
}
...
...
src/pci.h
View file @
82512f3e
...
...
@@ -14,7 +14,7 @@
uint32_t
pciConfigReadWord
(
uint8_t
bus
,
uint8_t
slot
,
uint8_t
func
,
uint8_t
offset
);
void
checkAllBuses
();
void
checkAllBuses
(
void
);
#endif
src/serial.h
View file @
82512f3e
...
...
@@ -25,6 +25,8 @@ void serial_hexbyte(uint8_t x);
void
serial_hexhword
(
uint16_t
x
);
void
serial_hexword
(
uint32_t
x
);
void
serial_hexqword
(
uint64_t
x
);
// Writes an arbitrary amount memory to serial
void
serial_hexstring
(
void
*
s
,
uint32_t
n
);
#endif
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