1 //==========================================================================
5 // HAL platform miscellaneous functions
7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
13 // eCos is free software; you can redistribute it and/or modify it under
14 // the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 2 or (at your option) any later version.
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 // You should have received a copy of the GNU General Public License along
23 // with eCos; if not, write to the Free Software Foundation, Inc.,
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 // As a special exception, if other files instantiate templates or use macros
27 // or inline functions from this file, or you compile this file and link it
28 // with other works to produce a work based on this file, this file does not
29 // by itself cause the resulting work to be covered by the GNU General Public
30 // License. However the source code for this file must still be made available
31 // in accordance with section (3) of the GNU General Public License.
33 // This exception does not invalidate any other reasons why a work based on
34 // this file might be covered by the GNU General Public License.
36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37 // at http://sources.redhat.com/ecos/ecos-license/
38 // -------------------------------------------
39 //####ECOSGPLCOPYRIGHTEND####
40 //==========================================================================
41 //#####DESCRIPTIONBEGIN####
43 // Author(s): tmichals
46 // Purpose: HAL miscellaneous functions
47 // Description: This file contains miscellaneous functions provided by the
50 //####DESCRIPTIONEND####
52 //========================================================================*/
54 #include <pkgconf/hal.h>
55 #include <pkgconf/system.h>
57 #include CYGBLD_HAL_PLATFORM_H
59 #include <cyg/infra/cyg_type.h> // Base types
60 #include <cyg/infra/cyg_trac.h> // tracing macros
61 #include <cyg/infra/cyg_ass.h> // assertion macros
62 #include <cyg/hal/hal_arch.h> // architectural definitions
63 #include <cyg/hal/hal_intr.h> // Interrupt handling
64 #include <cyg/hal/hal_cache.h> // Cache handling
66 /* This is the Reference board configuration */
67 #include <cyg/hal/idt79rc233x.h>
69 #include <cyg/io/pci_hw.h>
70 #include <cyg/io/pci.h>
72 void hal_rc334PciInit (void);
73 static void mmuInit (void);
74 static void sysDisableBusError (void) ;
75 static void sysEnableBusError(void);
76 void ecosPciConfigOutByte( int busNo, int devFnNo,int regOffset,unsigned char data );
77 void ecosPciConfigOutHalfWord( int busNo,int devFnNo,int regOffset,unsigned short data );
78 void ecosPciConfigOutWord( int busNo,int devFnNo,int regOffset,unsigned int data );
79 unsigned char ecosPciConfigInByte(int busNo, int devFnNo,int regOffset);
80 unsigned short ecosPciConfigInHalfWord( int busNo,int devFnNo,int regOffset);
81 unsigned int ecosPciConfigInWord( int busNo, int devFnNo,int regOffset);
82 void displayLED(char *str, int count);
84 /*------------------------------------------------------------------------*/
86 /* this is called from the kernel */
87 void hal_platform_init(void)
90 HAL_ICACHE_INVALIDATE_ALL();
92 HAL_DCACHE_INVALIDATE_ALL();
95 displayLED("eCOS", 4);
103 /* PCI Configuration Registers */
104 #define PCI_CFG_VENDORID 0x00
105 #define PCI_CFG_DEVICEID 0x02
106 #define PCI_CFG_COMMAND 0x04
107 #define PCI_CFG_STATUS 0x06
108 #define PCI_CFG_REVID 0x08
109 #define PCI_CFG_CLASS_CODE 0x09
110 #define PCI_CFG_CACHELINE 0x0c
111 #define PCI_CFG_LATENCY_TIMER 0x0d
112 #define PCI_CFG_HEADER_TYPE 0x0e
113 #define PCI_CFG_BIST 0x0f
114 #define PCI_CFG_BAR0 0x10
115 #define PCI_CFG_BAR1 0x14
116 #define PCI_CFG_BAR2 0x18
117 #define PCI_CFG_BAR3 0x1c
118 #define PCI_CFG_BAR4 0x20
119 #define PCI_CFG_BAR5 0x24
120 #define PCI_CFG_CIS_POINTER 0x28
121 #define PCI_CFG_SUB_VENDORID 0x2c
122 #define PCI_CFG_SUB_SYSTEMID 0x2e
123 #define PCI_CFG_EXP_ROM 0x30
124 #define PCI_CFG_CAPABILITIES 0x34
125 #define PCI_CFG_RESERVED1 0x35
126 #define PCI_CFG_RESERVED2 0x38
127 #define PCI_CFG_INT_LINE 0x3c
128 #define PCI_CFG_INT_PIN 0x3d
129 #define PCI_CFG_MIN_GRANT 0x3e
130 #define PCI_CFG_MAX_LATENCY 0x3f
131 #define PCI_CFG_TRDY_TIMEOUT 0x40
132 #define PCI_CFG_RETRY_TIMEOUT 0x41
134 #define RC334_CONFIG0 0x80000000
135 /* Typical values used in this example */
136 #define RC334_PCI_CONFIG0 0x0204111D /* Device ID & Vendor ID */
137 #define RC334_PCI_CONFIG1 0x00200157 /* Command : MWINV, Enable bus master,
139 #define RC334_PCI_CONFIG2 0x06800001 /* Class Code & Revision ID */
140 #define RC334_PCI_CONFIG3 0x0000ff04 /* BIST, Header Type, Master Latency,
142 #define RC334_PCI_CONFIG4 0xA0000008 /* Memory Base Address Reg, prefetchable */
143 #define RC334_PCI_CONFIG5 0x60000000 /* Integrated Controller Reg, non-prefetchable */
144 #define RC334_PCI_CONFIG6 0x00800001 /* IO Base Address Reg */
145 #define RC334_PCI_CONFIG7 0x00000000 /* Unused BAR space, assign some address
146 that never gets generated on PCI Bus */
148 /* Reserved registers */
149 #define RC334_PCI_CONFIG8 0x00000000
150 #define RC334_PCI_CONFIG9 0x00000000
151 #define RC334_PCI_CONFIG10 0x00000000
153 /* Subsystem ID and the subsystem Vendor ID */
154 #define RC334_PCI_CONFIG11 0x00000000
156 /* Reserved registers */
157 #define RC334_PCI_CONFIG12 0x00000000
158 #define RC334_PCI_CONFIG13 0x00000000
159 #define RC334_PCI_CONFIG14 0x00000000
161 /* Max latency, Min Grant, Interrupt pin and interrupt line */
162 #define RC334_PCI_CONFIG15 0x38080101
164 /* Retry timeout value, TRDY timeout value. Set to default 0x80 */
165 #define RC334_PCI_CONFIG16 0x00008080
167 /* Rc32334 specific PCI registers */
168 #define RC334_PCI_REG_BASE 0xb8000000
169 #define RC334_CPUTOPCI_BASE_REG1 (RC334_PCI_REG_BASE + 0x20B0)
170 #define RC334_CPUTOPCI_BASE_REG2 (RC334_PCI_REG_BASE + 0x20B8)
171 #define RC334_CPUTOPCI_BASE_REG3 (RC334_PCI_REG_BASE + 0x20C0)
172 #define RC334_CPUTOPCI_BASE_REG4 (RC334_PCI_REG_BASE + 0x20C8)
174 #define RC334_PCI_ARB_REG (RC334_PCI_REG_BASE + 0x20E0)
175 #define RC334_PCITOCPU__BASE_REG1 (RC334_PCI_REG_BASE + 0x20E8)
176 #define RC334_PCITOCPU__BASE_REG2 (RC334_PCI_REG_BASE + 0x20F4)
177 #define RC334_PCITOCPU__BASE_REG3 (RC334_PCI_REG_BASE + 0x2100)
178 #define RC334_PCITOCPU__BASE_REG4 (RC334_PCI_REG_BASE + 0x210C)
180 /* Considering a typical case */
181 #define CPUTOPCI_BASE_REG1_VAL 0x40000001
182 #define CPUTOPCI_BASE_REG2_VAL 0x00000000
183 #define CPUTOPCI_BASE_REG3_VAL 0x00000000
184 #define CPUTOPCI_BASE_REG4_VAL 0x18800001
186 //TCM#define PCITOCPU_BASE_REG3_VAL 0x00000000
187 //TCM#define PCITOCPU_BASE_REG4_VAL 0x18000051 /* Size field set to 0x14 : 1MB size */
189 #define RC334_PCITOCPU_BASE_REG1 (RC334_PCI_REG_BASE+0x20E8)
190 #define RC334_PCITOCPU_BASE_REG2 (RC334_PCI_REG_BASE+0x20F4)
191 #define RC334_PCITOCPU_BASE_REG3 (RC334_PCI_REG_BASE+0x2100)
192 #define RC334_PCITOCPU_BASE_REG4 (RC334_PCI_REG_BASE+0x210C)
194 #define PCITOCPU_MEM_BASE(addr) ( (addr & 0xFFFFFF)<<8)
195 #define PCITOCPU_SIZE(i) ( ( i & 0x1F) << 2 )
196 #define PCITOCPU_EN_SWAP 1
198 #define SIZE_1MB 0x14
199 #define SIZE_64MB 0x1A
201 #define SYS_MEM_BASE 0x0 /* local sdram starting address */
202 #define RC32334_INT_REG_BASE 0x18000000 /* Integrated controller's internal registers */
204 /* PCI Target Control Register is provided in the RC32334 to utilize
205 eager prefetches and reduce target disconnects and retries. In the
206 following example, an optimized value is picked that enables eager
207 prefetch for all BAR's, enables Memory Write and Memory Write and
208 Invalidate (MWMWI), uses threshold for target write FIFO of 8 words,
209 and sets disconnect and retry timer to 40 PCI clocks */
211 #define PCI_TARGET_CONTROL_REG 0xB80020A4
212 #define PCI_TARGET_CONTROL_REG_VAL 0x7EF02828
214 /* BAR1 is selected as memory base register with 64 Mbyte address
215 range starting at physical address 0x0000_0000, allowing external PCI
216 masters to access the local SDRAM for data read and write. This
217 register setting works with the BAR1 register in the PCI configuration
218 register in the PCI bridge of the RC32334 which, in this example, has
219 been set to 0xA000_0000. With the given settings, the external PCI
220 masters can access addresses in the range 0xA000_0000 through
221 0xA3FF_FFFF using BAR1 which gets translated to address range
222 0x0000_0000 through 0x03FF_FFFF on the local CPU bus owing to the
223 PCITOCPU_BASE_REG1 settings. */
225 #define PCITOCPU_BASE_REG1_VAL ((PCITOCPU_MEM_BASE(SYS_MEM_BASE)) | \
226 (PCITOCPU_SIZE(SIZE_64MB) ) | \
229 /* BAR2 is selected as memory base register with 1 Mbyte range
230 starting at the physical address 0x1800_0000. This maps to the RC32334
231 internal registers allowing external PCI masters to read/modify the
232 RC32334 registers. In this example, the BAR2 register in the PCI
233 configuration register of the RC32334 PCI bridge has been set to
234 0xB800_0000 (note that this address is in the PCI space and should not
235 be confused with the CPU address map). External PCI masters can access
236 memory range 0xB800_0000 through 0xB80F_FFFF, sufficient enough to
237 access all the RC32334 internal registers. The PCITOCPU_BASE_REG2
238 settings map all PCI cycles falling in the above range to physical
239 address range 0x1800_0000
\97 0x180F_FFFF on the local CPU bus. */
241 #define PCITOCPU_BASE_REG2_VAL ((PCITOCPU_MEM_BASE(RC32334_INT_REG_BASE)) | \
242 (PCITOCPU_SIZE(SIZE_1MB) ) | \
245 /* BAR3 is selected as IO base register with 1 Mbyte range mapped to
246 address 0x1800_0000, providing another window for accessing the
247 Integrated controller registers. In this example, the value for the
248 BAR3 has been picked as 0x0000_0000 (address range 0x0000_00000
249 through 0x000F_FFFF). Any PCI IO cycles to this address range would
250 get translated to local CPU address range of 0x1800_0000 through
251 0x180F_FFFF using this register settings. */
253 #define PCITOCPU_BASE_REG3_VAL ( \
254 (PCITOCPU_MEM_BASE(RC32334_INT_REG_BASE)) | \
255 (PCITOCPU_SIZE(SIZE_1MB) ) | \
258 /* BAR4 register is not used. Therefore, it can be disabled by selecting the SIZE value 1-7 */
259 #define PCITOCPU_BASE_REG4_VAL ( PCITOCPU_SIZE( 1 ) )
261 /* Arbitration register value:
262 Target Ready, internal arbiter, fixed priority
264 #define PCI_ARB_REG_VAL 0x00000001
266 /* Rc32334 config address/data definitions */
267 #define PCI_CONFIG_ADDR_REG 0xb8002cf8
268 #define PCI_CONFIG_DATA_REG 0xb8002cfc
270 /* BYTE SWAP macros */
271 #define HALF_WORD_SWAP(x) \
272 ( ( ( x << 8 ) & 0xff00) | \
273 ( (x >> 8 ) & 0x00ff ) )
275 #define WORD_SWAP(x)\
276 ( ( ( x << 24 ) & 0xff000000 ) | \
277 ( (x << 8 ) & 0x00ff0000 ) | \
278 ( (x >> 8 ) & 0x0000ff00 ) | \
279 ( (x >> 24 ) & 0x000000ff ) )
282 unsigned int pciConfigInWord( int busNo, int devNo, int funcNo, int regOffset);
283 unsigned short pciConfigInHalfWord( int busNo, int devNo, int funcNo, int regOffset);
284 unsigned char pciConfigInByte( int busNo, int devNo, int funcNo, int regOffset);
285 void pciConfigOutWord ( int busNo, int devNo, int funcNo, int regOffset, unsigned int data );
286 void pciConfigOutHalfWord ( int busNo, int devNo, int funcNo, int regOffset, unsigned short data );
287 void pciConfigOutChar ( int busNo, int devNo, int funcNo, int regOffset, unsigned char data );
289 /* Rc32334 Bus error register. The bit7 of this register can be used
290 to enable or disable the BusError. The bus error is disabled briefly
291 at the time of pci Scanning and enabled thereafter. */
293 #define RC334_BUS_ERR_CNTL_REG 0xb8000010
296 Function name : hal_rc334PciInit
297 Parameters passed : none
299 The function initialises the configuration registers of Rc32334 PCI interface controller.
301 void hal_rc334PciInit ( )
304 unsigned int pciConfigData[17];
306 volatile unsigned int *configAddrReg ;
307 volatile unsigned int *configDataReg ;
308 volatile unsigned int *regPointer ;
310 configAddrReg = (volatile unsigned int*) PCI_CONFIG_ADDR_REG;
311 configDataReg = (volatile unsigned int*) PCI_CONFIG_DATA_REG;
313 pciConfigData[0] = RC334_PCI_CONFIG0;
314 pciConfigData[1] = RC334_PCI_CONFIG1;
315 pciConfigData[2] = RC334_PCI_CONFIG2;
316 pciConfigData[3] = RC334_PCI_CONFIG3;
317 pciConfigData[4] = RC334_PCI_CONFIG4;
318 pciConfigData[5] = RC334_PCI_CONFIG5;
319 pciConfigData[6] = RC334_PCI_CONFIG6;
320 pciConfigData[7] = RC334_PCI_CONFIG7;
321 pciConfigData[8] = RC334_PCI_CONFIG8;
322 pciConfigData[9] = RC334_PCI_CONFIG9;
323 pciConfigData[10] = RC334_PCI_CONFIG10;
324 pciConfigData[11] = RC334_PCI_CONFIG11;
325 pciConfigData[12] = RC334_PCI_CONFIG12;
326 pciConfigData[13] = RC334_PCI_CONFIG13;
327 pciConfigData[14] = RC334_PCI_CONFIG14;
328 pciConfigData[15] = RC334_PCI_CONFIG15;
329 pciConfigData[16] = RC334_PCI_CONFIG16;
331 *configAddrReg = (unsigned int)RC334_CONFIG0 ;
332 /* This example writes to all the configuration registers. Some of
333 the PCI configuration registers (such as Device ID, Vendor ID, Class
334 Code, Revision ID, BIST, Header Type, Subsystem Vendor ID, Maximum
335 Latency, Minimum Grant, Interrupt Pin) need not be initialized */
337 for (index =0; index <17; index++ )
339 *configDataReg = pciConfigData[index];
340 *configAddrReg = *configAddrReg + 4;
343 /* Park the Address Register */
344 configAddrReg = ( volatile unsigned int*)0x0 ;
346 /* Set Rc32334 specific registers */
348 regPointer = ( volatile unsigned int*)(RC334_CPUTOPCI_BASE_REG1) ;
349 *regPointer = (unsigned int)(CPUTOPCI_BASE_REG1_VAL );
351 regPointer = (volatile unsigned int*)(RC334_CPUTOPCI_BASE_REG2) ;
352 *regPointer = (unsigned int)(CPUTOPCI_BASE_REG2_VAL );
354 regPointer = (volatile unsigned int*)(RC334_CPUTOPCI_BASE_REG3) ;
355 *regPointer = (unsigned int)(CPUTOPCI_BASE_REG3_VAL );
357 regPointer = (volatile unsigned int*)(RC334_CPUTOPCI_BASE_REG4) ;
358 *regPointer = (unsigned int)(CPUTOPCI_BASE_REG4_VAL );
360 regPointer = (volatile unsigned int*)(RC334_PCITOCPU_BASE_REG1) ;
361 *regPointer = (unsigned int)(PCITOCPU_BASE_REG1_VAL );
363 regPointer = ( volatile unsigned int*)(RC334_PCITOCPU_BASE_REG2) ;
364 *regPointer = (unsigned int)(PCITOCPU_BASE_REG2_VAL );
366 regPointer = (volatile unsigned int*)(RC334_PCITOCPU_BASE_REG3) ;
367 *regPointer = (unsigned int)(PCITOCPU_BASE_REG3_VAL );
369 regPointer = (volatile unsigned int*)(RC334_PCITOCPU_BASE_REG4) ;
370 *regPointer = (unsigned int)(PCITOCPU_BASE_REG4_VAL );
372 regPointer = (volatile unsigned int*)PCI_TARGET_CONTROL_REG ;
373 *regPointer = (unsigned int)PCI_TARGET_CONTROL_REG_VAL ;
375 regPointer = (volatile unsigned int*)(RC334_PCI_ARB_REG);
376 *regPointer = (unsigned int)(PCI_ARB_REG_VAL);
380 /* Function name : sysDisableBusError
381 Disables the Bus Error prior to pciScan.
383 static void sysDisableBusError ( ) {
384 unsigned int* regPointer ;
386 regPointer = (unsigned int*) ( RC334_BUS_ERR_CNTL_REG);
388 /* Set bit7 to disable busError */
389 data = data | 0x00000080 ;
393 /* Function name : sysEnableBusError
394 Enables the Bus Error after pciScan
396 static void sysEnableBusError ( ) {
397 unsigned int* regPointer ;
399 regPointer = (unsigned int*) ( RC334_BUS_ERR_CNTL_REG);
401 /* Reset bit7 to enable busError */
402 data = data & 0xffffff7f;
409 #define TLB_HI_MASK 0xffffe000
410 #define TLB_LO_MASK 0x3fffffff
411 #define PAGEMASK_SHIFT 13
412 #define TLB_LO_SHIFT 6
413 #define PCI_PAGE_SIZE 0x01000000 /* 16 Mbyte */
414 #define MMU_PAGE_UNCACHED 0x00000010
415 #define MMU_PAGE_DIRTY 0x00000004
416 #define MMU_PAGE_VALID 0x00000002
417 #define MMU_PAGE_GLOBAL 0x00000001
418 #define PCI_MMU_PAGEMASK 0x00000fff
419 #define PCI_MMU_PAGEATTRIB (MMU_PAGE_UNCACHED|MMU_PAGE_DIRTY| MMU_PAGE_VALID|MMU_PAGE_GLOBAL)
420 #define PCI_MEMORY_SPACE1 0x40000000
421 #define PCI_MEMORY_SPACE2 0x60000000
422 #define PCI_IO_SPACE 0x18000000
424 Function name : mmuInit
425 Tlb Initialisation for the PCI memory/IO windows.
427 static void mmuInit ( ) {
428 unsigned int Tlb_Attrib ;
429 unsigned int Tlb_Hi ;
430 unsigned int Tlb_Lo0 ;
431 unsigned int Tlb_Lo1 ;
432 unsigned int Page_Size ;
433 unsigned int pageFrame ;
434 unsigned int Tlb_Inx ;
436 /* Uncached, dirty, global and valid MMU page */
437 Tlb_Attrib = PCI_MMU_PAGEATTRIB ;
439 Page_Size = PCI_MMU_PAGEMASK ;
440 Page_Size = (Page_Size << (PAGEMASK_SHIFT));
441 hal_setPageSize(Page_Size);
444 * MMU mapping for PCI_MEMORY_SPACE1
446 * Virtual 0x40000000-0x40ffffff to Physical 0x40000000 - 0x40ffffff
447 * Virtual 0x41000000-0x41ffffff to Physical 0x41000000 - 0x41ffffff
450 Tlb_Hi = PCI_MEMORY_SPACE1 ; /* VPN2:VirtualPageframeNumber%2 */
451 Tlb_Hi = (Tlb_Hi & TLB_HI_MASK) ;
453 pageFrame = PCI_MEMORY_SPACE1 ;
454 /* Even PFN:Page Frame Number */
455 pageFrame = pageFrame >> TLB_LO_SHIFT;
456 Tlb_Lo0 = pageFrame ;
457 Tlb_Lo0 = ( Tlb_Lo0 | Tlb_Attrib) ;
458 Tlb_Lo0 = ( Tlb_Lo0 & TLB_LO_MASK);
460 pageFrame = (PCI_MEMORY_SPACE1 | PCI_PAGE_SIZE) ;
461 /* Odd PFN:Page Frame Number*/
462 pageFrame = pageFrame >> TLB_LO_SHIFT ;
463 Tlb_Lo1 = pageFrame ;
464 Tlb_Lo1 = ( Tlb_Lo1 | Tlb_Attrib) ;
465 Tlb_Lo1 = ( Tlb_Lo1 & TLB_LO_MASK);
467 hal_setTlbEntry(Tlb_Inx, Tlb_Hi, Tlb_Lo0, Tlb_Lo1);
470 * MMU mapping for PCI_MEMORY_SPACE2
471 * Virtual 0x60000000-0x60ffffff to Physical 0x60000000 - 0x60ffffff
472 * Virtual 0x61000000-0x61ffffff to Physical 0x61000000 - 0x61ffffff
474 Tlb_Hi = PCI_MEMORY_SPACE2 ; /* VPN2 */
475 Tlb_Hi = ( Tlb_Hi & TLB_HI_MASK );
477 pageFrame = PCI_MEMORY_SPACE2 ;
478 pageFrame = pageFrame >> TLB_LO_SHIFT ; /*Even PFN */
479 Tlb_Lo0 = pageFrame ;
481 Tlb_Lo0 = ( Tlb_Lo0 | Tlb_Attrib) ;
482 Tlb_Lo0 = ( Tlb_Lo0 & TLB_LO_MASK);
484 pageFrame = ( PCI_MEMORY_SPACE2 | PCI_PAGE_SIZE ) ;
485 pageFrame = pageFrame >> TLB_LO_SHIFT ; /* Odd PFN */
486 Tlb_Lo1 = pageFrame ;
487 Tlb_Lo1 = ( Tlb_Lo1 | Tlb_Attrib) ;
488 Tlb_Lo1 = ( Tlb_Lo1 & TLB_LO_MASK);
490 hal_setTlbEntry(Tlb_Inx, Tlb_Hi, Tlb_Lo0, Tlb_Lo1);
493 * MMU mapping PCI IO space
494 * Virtual 0x18000000-0x18ffffff to Physical 0x18000000 - 0x18ffffff
495 * Virtual 0x19000000-0x19ffffff to Physical 0x19000000 - 0x19ffffff
497 Tlb_Hi = PCI_IO_SPACE ; /* VPN2 */
498 Tlb_Hi = ( Tlb_Hi & TLB_HI_MASK );
500 pageFrame = PCI_IO_SPACE ;
502 pageFrame = pageFrame >> TLB_LO_SHIFT ; /* Even PFN */
503 Tlb_Lo0 = pageFrame ;
504 Tlb_Lo0 = ( Tlb_Lo0 | Tlb_Attrib) ;
505 Tlb_Lo0 = ( Tlb_Lo0 & TLB_LO_MASK);
507 pageFrame = (PCI_IO_SPACE | PCI_PAGE_SIZE) ;
508 pageFrame = pageFrame >> TLB_LO_SHIFT ; /* Odd PFN */
509 Tlb_Lo1 = pageFrame ;
510 Tlb_Lo1 = ( Tlb_Lo1 | Tlb_Attrib) ;
511 Tlb_Lo1 = ( Tlb_Lo1 & TLB_LO_MASK);
513 hal_setTlbEntry(Tlb_Inx, Tlb_Hi, Tlb_Lo0, Tlb_Lo1);
519 /* ecos PCI functions */
522 void ecosPciConfigOutByte
526 unsigned char data ){
528 unsigned int address ;
530 address = ( ( (busNo << 16) & 0x00ff0000 ) |
531 ( ( devFnNo << 8 ) & 0x0000ff00 )
533 address = ( address | 0x80000000 | (regOffset ) );
534 hal_sysConfigOutByte(address, data, (regOffset & 0x3) );
537 void ecosPciConfigOutHalfWord
541 unsigned short data ){
543 unsigned int address ;
545 address = ( ( (busNo << 16) & 0x00ff0000 ) |
546 ( ( devFnNo << 8 ) & 0x0000ff00)
548 address = ( address | 0x80000000 | (regOffset ) );
549 hal_sysConfigOutHalfWord(address, data, (regOffset & 0x3) );
553 void ecosPciConfigOutWord
559 unsigned int address ;
560 address = ( ( (busNo << 16) & 0x00ff0000 ) |
561 ( ( devFnNo << 8 ) & 0x0000ff00)
563 address = ( address | 0x80000000 | (regOffset ) );
565 hal_sysConfigOutWord(address, data);
568 unsigned char ecosPciConfigInByte
574 unsigned int address ;
575 unsigned char retVal ;
577 address = ( ( (busNo << 16) & 0x00ff0000 ) |
578 ( ( devFnNo << 8 ) & 0x0000ff00)
580 address = ( address | 0x80000000 | (regOffset ) );
581 sysDisableBusError( );
582 retVal = (unsigned char)(hal_sysConfigInByte(address));
583 sysEnableBusError( );
587 unsigned short ecosPciConfigInHalfWord
593 unsigned int address;
594 unsigned short retVal;
596 address = ( ( (busNo << 16) & 0x00ff0000 ) |
597 ( ( devFnNo << 8 ) & 0x0000ff00)
599 address = ( address | 0x80000000 | (regOffset ) );
600 sysDisableBusError( );
601 retVal = (unsigned short)hal_sysConfigInHalfWord(address);
602 sysEnableBusError( );
606 unsigned int ecosPciConfigInWord
612 unsigned int address;
615 address = ( ( (busNo << 16) & 0x00ff0000 ) |
616 ( ( devFnNo << 8 ) & 0x0000ff00)
618 address = ( address | 0x80000000 | regOffset );
619 sysDisableBusError( );
620 retVal = hal_sysConfigInWord(address);
621 sysEnableBusError( );
626 void displayLED(char *str, int count)
628 char *pChar = (char *)0xB4000000;
657 /*------------------------------------------------------------------------*/
658 /* End of plf_misc.c */