Download Guidelines for integrating device drivers - dit/UPM

Transcript
Reference: VMLAB-UPM-TR1
Date: 15/09/2009
Issue: 1.5
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
-- Enable PCI Interrupts - PCIITE
PCI_Interrupt_Enable := (Reserved => (others => False),
others => True);
-- The AT697 initialization is complete at this point
------------------------------------------------- Scan the PCI bus and find the RASTA board -------------------------------------------------- Scan board slots in bus 0
for Slot in Unit_Type’Range loop
Id
:= Read_Config_Dword (0, Slot, 0, Config_Header_Vendor_ID);
Vendor := To_Vendor_Code (Id and 16#FFFF#);
if Vendor = Gaisler_Vendor_ID then
DeviceID := To_Device_Code (
(Interfaces.Shift_Right (Id, 16)) and 16#FFFF#);
RastaBoard.Vendor_ID := Vendor;
RastaBoard.Device_ID := DeviceID;
Header := Read_Config_Byte (0, Slot, 0,
Config_Header_Header_Format);
if (Header and Multi_Function) = 1 then
-- TODO: add multi function support
null;
else
Num_Functions := 1;
end if;
-- Find data for all functions in the board
for func in 0 .. (Num_Functions - 1) loop
VMlab-UPM-TR1
Id := Read_Config_Dword (0, Slot, func, Config_Header_Vendor_ID);
Vendor := To_Vendor_Code (Id and 16#FFFF#);
if Vendor /= Invalid_Vendor_ID and Id /= 0 then
Aux := Read_Config_Dword (0, Slot, func,
Config_Header_Revision);
Aux := Interfaces.Shift_Right (Aux, 16);
if Device_Class (Aux) /= Class_Bridge_PCI then
RastaBoard.Bus
:= 0;
RastaBoard.Unit
:= Slot;
RastaBoard.Device_Function := func;
-- configure address regions
Last Modified on: September 23, 2009
page 69 of 85