duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit ceb0118d76285bbeb873d25871ca641cfa8d4803
parent 69724f7f5bbd9534829354cfd00fd0084aeff0b4
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sat,  6 Aug 2022 14:32:15 -0400

drv/pc/pci: add ability to print full headers for type 1 devices

Diffstat:
Mfs/drv/pc/pci.fs | 19+++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/fs/drv/pc/pci.fs b/fs/drv/pc/pci.fs @@ -95,10 +95,11 @@ $3f pcifieldc pci0.maxlatency "Max latency" : _getdesc ( 'field -- str ) emeta META_FIELDDESC swap findemeta ?dup if 'emetadata else S" ???" then ; +: .pciaddr pcibus .x1 ':' emit pcislot .x1 '.' emit pcifunc . spc> ; + \\ Print current PCI device in a one line summary : .pciln ( -- ) - pcibus .x1 ':' emit pcislot .x1 '.' emit pcifunc . spc> - 5 dup _ensureread >r summaryfields begin ( a ) + .pciaddr 5 dup _ensureread >r summaryfields begin ( a ) @+ dup _getdesc stype spc> execute .x? spc> next drop nl> ; : .pcislot ( bus slot -- ) @@ -109,3 +110,17 @@ $3f pcifieldc pci0.maxlatency "Max latency" : .pcibus ( bus -- ) 0 0 pci@ if pcibus pcislot .pcislot then begin _nextslot while pcibus pcislot .pcislot repeat ; + +: nspcs ( n -- ) ?dup if >r begin spc> next then ; + +: .pcifield ( 'field -- ) + dup _getdesc dup stype c@ ( 'field len ) 17 -^ nspcs execute .x? nl> ; + +: _ ( fieldlist cnt -- ) + nl> $10 _ensureread >r begin @+ .pcifield next drop ; + +: .pci ( bus slot func -- ) + pci@ .pciaddr not if ." No device" nl> exit then + commonfieldlist COMMONFIELDCNT _ ; + +: .pci0 ( bus slot func -- ) type0fieldlist TYPE0FIELDCNT _ ;