1 ;****************************************************************************
3 ;* SciTech OS Portability Manager Library
5 ;* ========================================================================
7 ;* The contents of this file are subject to the SciTech MGL Public
8 ;* License Version 1.0 (the "License"); you may not use this file
9 ;* except in compliance with the License. You may obtain a copy of
10 ;* the License at http://www.scitechsoft.com/mgl-license.txt
12 ;* Software distributed under the License is distributed on an
13 ;* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14 ;* implied. See the License for the specific language governing
15 ;* rights and limitations under the License.
17 ;* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
19 ;* The Initial Developer of the Original Code is SciTech Software, Inc.
20 ;* All Rights Reserved.
22 ;* ========================================================================
24 ;* Language: 80386 Assembler, TASM 4.0 or NASM
27 ;* Description: Helper assembler functions for PCI access module.
29 ;****************************************************************************
33 include "scitech.mac" ; Memory model macros
41 ;----------------------------------------------------------------------------
42 ; uchar _ASMAPI _BIOS32_service(
47 ; ulong *serviceOffset,
48 ; PCIBIOS_entry entry);
49 ;----------------------------------------------------------------------------
50 ; Call the BIOS32 services directory
51 ;----------------------------------------------------------------------------
52 cprocstart _BIOS32_service
54 ARG service:ULONG, func:ULONG, physBase:DPTR, len:DPTR, off:DPTR, entry:QWORD
60 call far dword [entry]
77 ;----------------------------------------------------------------------------
78 ; ushort _ASMAPI _PCIBIOS_isPresent(ulong i_eax,ulong *o_edx,ushort *oeax,
79 ; uchar *o_cl,PCIBIOS_entry entry)
80 ;----------------------------------------------------------------------------
81 ; Call the PCI BIOS to determine if it is present.
82 ;----------------------------------------------------------------------------
83 cprocstart _PCIBIOS_isPresent
85 ARG i_eax:ULONG, o_edx:DPTR, oeax:DPTR, o_cl:DPTR, entry:QWORD
91 call far dword [entry]
110 ;----------------------------------------------------------------------------
111 ; ulong _PCIBIOS_service(ulong r_eax,ulong r_ebx,ulong r_edi,ulong r_ecx,
112 ; PCIBIOS_entry entry)
113 ;----------------------------------------------------------------------------
114 ; Call the PCI BIOS services, either via the 32-bit protected mode entry
115 ; point or via the Int 1Ah 16-bit interrupt.
116 ;----------------------------------------------------------------------------
117 cprocstart _PCIBIOS_service
119 ARG r_eax:ULONG, r_ebx:ULONG, r_edi:ULONG, r_ecx:ULONG, entry:QWORD
128 call far dword [entry]
137 shld edx,eax,16 ; Return result in DX:AX
144 ;----------------------------------------------------------------------------
145 ; int _PCIBIOS_getRouting(PCIRoutingOptionsBuffer *buf,PCIBIOS_entry entry);
146 ;----------------------------------------------------------------------------
147 ; Get the routing options for PCI devices
148 ;----------------------------------------------------------------------------
149 cprocstart _PCIBIOS_getRouting
151 ARG buf:DPTR, entry:QWORD
159 call far dword [entry]
172 ;----------------------------------------------------------------------------
173 ; ibool _PCIBIOS_setIRQ(int busDev,int intPin,int IRQ,PCIBIOS_entry entry);
174 ;----------------------------------------------------------------------------
175 ; Change the IRQ routing for the PCI device
176 ;----------------------------------------------------------------------------
177 cprocstart _PCIBIOS_setIRQ
179 ARG busDev:UINT, intPin:UINT, IRQ:UINT, entry:QWORD
183 mov bx,[USHORT busDev]
188 call far dword [entry]
197 xor eax,eax ; Function failed!
203 ;----------------------------------------------------------------------------
204 ; ulong _PCIBIOS_specialCycle(int bus,ulong data,PCIBIOS_entry entry);
205 ;----------------------------------------------------------------------------
206 ; Generate a special cycle via the PCI BIOS.
207 ;----------------------------------------------------------------------------
208 cprocstart _PCIBIOS_specialCycle
210 ARG bus:UINT, data:ULONG, entry:QWORD
218 call far dword [entry]
230 ;----------------------------------------------------------------------------
231 ; ushort _PCI_getCS(void)
232 ;----------------------------------------------------------------------------
233 cprocstart _PCI_getCS
240 ;----------------------------------------------------------------------------
241 ; int PM_inpb(int port)
242 ;----------------------------------------------------------------------------
243 ; Reads a byte from the specified port
244 ;----------------------------------------------------------------------------
259 ;----------------------------------------------------------------------------
260 ; int PM_inpw(int port)
261 ;----------------------------------------------------------------------------
262 ; Reads a word from the specified port
263 ;----------------------------------------------------------------------------
278 ;----------------------------------------------------------------------------
279 ; ulong PM_inpd(int port)
280 ;----------------------------------------------------------------------------
281 ; Reads a word from the specified port
282 ;----------------------------------------------------------------------------
292 shld edx,eax,16 ; DX:AX = result
299 ;----------------------------------------------------------------------------
300 ; void PM_outpb(int port,int value)
301 ;----------------------------------------------------------------------------
302 ; Write a byte to the specified port.
303 ;----------------------------------------------------------------------------
306 ARG port:UINT, value:UINT
318 ;----------------------------------------------------------------------------
319 ; void PM_outpw(int port,int value)
320 ;----------------------------------------------------------------------------
321 ; Write a word to the specified port.
322 ;----------------------------------------------------------------------------
325 ARG port:UINT, value:UINT
337 ;----------------------------------------------------------------------------
338 ; void PM_outpd(int port,ulong value)
339 ;----------------------------------------------------------------------------
340 ; Write a word to the specified port.
341 ;----------------------------------------------------------------------------
344 ARG port:UINT, value:ULONG