OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [io/] [pci/] [current/] [doc/] [pci.sgml] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
2
 
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
28
29
 
30
31
PCI Library
32
33
The eCos PCI Library
34
The PCI library is an optional part of eCos, and is only
35
        applicable to some platforms.
36
37
PCI Library
38
The eCos PCI library provides the following functionality:
39
40
Scan the PCI bus for specific devices or devices of a certain
41
class.
42
Read and change generic PCI information.
43
Read and change device-specific PCI information.
44
Allocate PCI memory and IO space to devices.
45
Translate a device's PCI interrupts to equivalent HAL
46
vectors.
47
48
Example code fragments are from the pci1 test (see io/pci/<release>/tests/pci1.c).
49
All of the functions described below are declared in the header
50
file <cyg/io/pci.h> which all
51
clients of the PCI library should include.
52
53
PCI Overview
54
The PCI bus supports several address spaces: memory, IO, and configuration. All PCI
55
devices must support mandatory configuration space registers. Some devices may also present
56
IO mapped and/or memory mapped resources. Before devices on the bus can be used, they must
57
be configured. Basically, configuration will assign PCI IO and/or memory address ranges to
58
each device and then enable that device. All PCI devices have a unique address in
59
configuration space. This address is comprised of a bus number, a device number, and a
60
function number. Special devices called bridges are used to connect two PCI busses together.
61
The PCI standard supports up to 255 busses with each bus having up to 32 devices and each
62
device having up to 8 functions.
63
64
The environment in which a platform operates will dictate if and how eCos should
65
configure devices on the PCI bus. If the platform acts as a host on a single PCI bus,
66
then devices may be configured individually from the relevant device driver. If the
67
platform is not the primary host, such as a PCI card plugged into a PC, configuration
68
of PCI devices may be left to the PC BIOS. If PCI-PCI bridges are involved, configuration
69
of all devices is best done all at once early in the boot process. This is because all
70
devices on the secondary side of a bridge must be evaluated for their IO and memory space
71
requirements before the bridge can be configured.
72
73
74
75
Initializing the bus
76
The PCI bus needs to be initialized before it can be used.
77
This only needs to be done once - some HALs may do it as part of
78
the platform initialization procedure, other HALs may leave it to
79
the application or device drivers to do it. The following function
80
will do the initialization only once, so it's safe to call from
81
multiple drivers:
82
void cyg_pci_init( void );
83
84
85
Scanning for devices
86
After the bus has been initialized, it is possible to scan
87
it for devices. This is done using the function:
88
cyg_bool cyg_pci_find_next(  cyg_pci_device_id cur_devid,
89
                             cyg_pci_device_id *next_devid );
90
91
It will scan the bus for devices starting at cur_devid
92
. If a device is found, its devid is stored in 
93
next_devid and the function returns true.
94
95
The pci1 test's outer loop looks like:
96
97
    cyg_pci_init();
98
    if (cyg_pci_find_next(CYG_PCI_NULL_DEVID, &devid)) {
99
        do {
100
             <use devid>
101
        } while (cyg_pci_find_next(devid, &devid));
102
    }
103
What happens is that the bus gets initialized and a scan is
104
started. CYG_PCI_NULL_DEVID causes 
105
cyg_pci_find_next() to restart its scan. If the bus does not
106
contain any devices, the first call to cyg_pci_find_next()
107
will return false.
108
If the call returns true, a loop is entered where
109
the found devid is used. After devid processing has completed, the next device
110
on the bus is searched for; cyg_pci_find_next()
111
continues its scan from the current devid. The loop terminates when
112
no more devices are found on the bus.
113
This is the generic way of scanning the bus, enumerating all
114
the devices on the bus. But if the application is looking for a
115
device of a given device class (e.g., a SCSI controller), or a specific
116
vendor device, these functions simplify the task a bit:
117
118
cyg_bool cyg_pci_find_class(  cyg_uint32 dev_class,
119
                              cyg_pci_device_id *devid );
120
cyg_bool cyg_pci_find_device(  cyg_uint16 vendor, cyg_uint16 device,
121
                               cyg_pci_device_id *devid );
122
They work just like cyg_pci_find_next(),
123
but only return true when the dev_class or vendor/device
124
qualifiers match those of a device on the bus. The devid serves
125
as both an input and an output operand: the scan starts at the given
126
device, and if a device is found devid is updated with the value
127
for the found device.
128
The <cyg/io/pci_cfg.h> header
129
file (included by pci.h) contains definitions for PCI
130
class, vendor and device codes which can be used as arguments to the find
131
functions.
132
The list of vendor and device codes is not complete: add new codes
133
as necessary. If possible also register the codes at the PCI Code
134
List (http://www.yourvote.com/pci)
135
 which is where the eCos definitions are generated from.
136
137
138
Generic config information
139
When a valid device ID (devid) is found using one of the above
140
functions, the associated device can be queried and controlled using
141
the functions:
142
143
void cyg_pci_get_device_info (  cyg_pci_device_id devid,
144
                                cyg_pci_device *dev_info );
145
void cyg_pci_set_device_info (  cyg_pci_device_id devid,
146
                                cyg_pci_device *dev_info );
147
The cyg_pci_device structure (defined in
148
pci.h) primarily holds information as described by the PCI
149
 specification [1].
150
The pci1 test prints out some of this information:
151
            // Get device info
152
            cyg_pci_get_device_info(devid, &dev_info);
153
            diag_printf("\n Command   0x%04x, Status 0x%04x\n",
154
                        dev_info.command, dev_info.status);
155
The command register can also be written to, controlling (among
156
other things) whether the device responds to IO and memory access
157
from the bus. 
158
159
160
Specific config information
161
The above functions only allow access to generic PCI config
162
registers. A device can have extra config registers not specified
163
by the PCI specification. These can be accessed with these functions:
164
165
void cyg_pci_read_config_uint8(  cyg_pci_device_id devid,
166
                                 cyg_uint8 offset, cyg_uint8 *val);
167
void cyg_pci_read_config_uint16(  cyg_pci_device_id devid,
168
                                  cyg_uint8 offset, cyg_uint16 *val);
169
void cyg_pci_read_config_uint32(  cyg_pci_device_id devid,
170
                                  cyg_uint8 offset, cyg_uint32 *val);
171
void cyg_pci_write_config_uint8(  cyg_pci_device_id devid,
172
                                  cyg_uint8 offset, cyg_uint8 val);
173
void cyg_pci_write_config_uint16(  cyg_pci_device_id devid,
174
                                   cyg_uint8 offset, cyg_uint16 val);
175
void cyg_pci_write_config_uint32(  cyg_pci_device_id devid,
176
                                   cyg_uint8 offset, cyg_uint32 val);
177
178
The write functions should only be used for device-specific
179
config registers since using them on generic registers may invalidate
180
the contents of a previously fetched cyg_pci_device
181
structure.
182
183
184
Allocating memory
185
A PCI device ignores all IO and memory access from the PCI
186
bus until it has been activated. Activation cannot happen until
187
after device configuration. Configuration means telling the device
188
where it should map its IO and memory resources. This is done with
189
one of the following functions::
190
cyg_bool cyg_pci_configure_device( cyg_pci_device *dev_info );
191
cyg_bool cyg_pci_configure_bus( cyg_uint8 bus, cyg_uint8 *next_bus );
192
193
The cyg_pci_configure_device handles all IO
194
and memory regions that need configuration on non-bridge devices. On
195
platforms with multiple busses connected by bridges, the 
196
cyg_pci_configure_bus function should be used. It will recursively
197
configure all devices on the given bus and all
198
subordinate busses. cyg_pci_configure_bus will
199
use cyg_pci_configure_device to configure
200
individual non-bridge devices.
201
202
 Each region is represented in the PCI device's config space by BARs
203
(Base Address Registers) and is handled individually according to type
204
using these functions:
205
cyg_bool cyg_pci_allocate_memory(  cyg_pci_device *dev_info,
206
                                   cyg_uint32 bar,
207
                                   CYG_PCI_ADDRESS64 *base );
208
cyg_bool cyg_pci_allocate_io(  cyg_pci_device *dev_info,
209
                               cyg_uint32 bar,
210
                               CYG_PCI_ADDRESS32 *base );
211
The memory bases (in two distinct address spaces) are increased
212
as memory regions are allocated to devices. Allocation will fail
213
(the function returns false) if the base exceeds the limits of the
214
address space (IO is 1MB, memory is 2^32 or 2^64 bytes).
215
These functions can also be called directly by the application/driver
216
if necessary, but this should not be necessary.
217
The bases are initialized with default values provided by
218
the HAL. It is possible for an application to override these using
219
the following functions: 
220
void cyg_pci_set_memory_base(  CYG_PCI_ADDRESS64 base );
221
void cyg_pci_set_io_base( CYG_PCI_ADDRESS32 base );
222
When a device has been configured, the cyg_pci_device
223
structure will contain the physical address in the CPU's
224
address space where the device's memory regions can be
225
accessed. 
226
This information is provided in base_map[] -
227
there is a 32 bit word for each of the device's BARs. For
228
32 bit PCI memory regions, each 32 bit word will be an actual pointer
229
that can be used immediately by the driver: the memory space will normally
230
be linearly addressable by the CPU.
231
However, for 64 bit PCI memory regions, some (or all) of the
232
region may be outside of the CPUs address space. In this case the
233
driver will need to know how to access the region in segments. This
234
functionality may be adopted by the eCos HAL if deemed useful in
235
the future. The 2GB available on many systems should suffice though.
236
237
238
Interrupts
239
A device may generate interrupts. The HAL vector associated
240
with a given device on the bus is platform specific. This function
241
allows a driver to find the actual interrupt vector for a given
242
device:
243
cyg_bool cyg_pci_translate_interrupt(  cyg_pci_device *dev_info,
244
                                       CYG_ADDRWORD *vec );
245
If the function returns false, no interrupts will be generated
246
by the device. If it returns true, the CYG_ADDRWORD pointed
247
to by vec is updated with the HAL interrupt vector the device will
248
be using. This is how the function is used in the pci1
249
test:
250
            if (cyg_pci_translate_interrupt(&dev_info, &irq))
251
                diag_printf(" Wired to HAL vector %d\n", irq);
252
            else
253
                diag_printf(" Does not generate interrupts.\n");
254
The application/drive should attach an interrupt
255
handler to a device's interrupt before activating the device.
256
257
258
Activating a device
259
When the device has been allocated memory space it can be
260
activated. This is not done by the library since a driver may have
261
to initialize more state on the device before it can be safely activated.
262
Activating the device is done by enabling flags in its command
263
word. As an example, see the pci1 test which can be
264
configured to enable the devices it finds. This allows these to be accessed from
265
GDB (if a breakpoint is set on cyg_test_exit):
266
#ifdef ENABLE_PCI_DEVICES
267
      {
268
          cyg_uint16 cmd;
269
 
270
          // Don't use cyg_pci_set_device_info since it clears
271
          // some of the fields we want to print out below.
272
          cyg_pci_read_config_uint16(dev_info.devid,
273
                                     CYG_PCI_CFG_COMMAND, &cmd);
274
          cmd |= CYG_PCI_CFG_COMMAND_IO|CYG_PCI_CFG_COMMAND_MEMORY;
275
          cyg_pci_write_config_uint16(dev_info.devid,
276
                                      CYG_PCI_CFG_COMMAND, cmd);
277
      }
278
      diag_printf(" **** Device IO and MEM access enabled\n");
279
#endif
280
NoteThe best way to activate a device is actually
281
through cyg_pci_set_device_info(),
282
but in this particular case the cyg_pci_device
283
structure contents from before the activation is required for printout
284
further down in the code.
285
286
287
Links
288
See these links for more information about PCI:
289
290
291
http://www.pcisig.com/ - information on the PCI specifications
292
293
294
http://www.yourvote.com/pci/
295
 - list of vendor and device IDs
296
297
298
http://www.picmg.org/
299
 - PCI Industrial Computer Manufacturers Group
300
301
302
303
304
305
PCI Library reference
306
This document defines the PCI Support Library for eCos.
307
The PCI support library provides a set of routines for accessing
308
the PCI bus configuration space in a portable manner. This is provided
309
by two APIs. The high level API is used by device drivers, or other
310
code, to access the PCI configuration space portably. The low level
311
API is used by the PCI library itself to access the hardware in
312
a platform-specific manner, and may also be used by device drivers
313
to access the PCI configuration space directly.
314
Underlying the low-level API is HAL support for the basic
315
configuration space operations. These should not generally be used
316
by any code other than the PCI library, and are present in the HAL
317
to allow low level initialization of the PCI bus and devices to
318
take place if necessary.
319
320
PCI Library API
321
The PCI library provides the following routines and types
322
for accessing the PCI configuration space.
323
The API for the PCI library is found in the header file
324
<cyg/io/pci.h>.
325
326
327
Definitions
328
The header file contains definitions for the common configuration
329
structure offsets and specimen values for device, vendor and class
330
code.
331
332
333
Types and data structures
334
The following types are defined:
335
typedef CYG_WORD32 cyg_pci_device_id;
336
This is comprised of the bus number, device number and functional
337
unit numbers packed into a single word. The macro CYG_PCI_DEV_MAKE_ID()
338
, in conjunction with the CYG_PCI_DEV_MAKE_DEVFN()
339
macro, may be used to construct a device id from the bus, device and functional
340
unit numbers. Similarly the macros CYG_PCI_DEV_GET_BUS(),
341
CYG_PCI_DEV_GET_DEVFN(),
342
CYG_PCI_DEV_GET_DEV(), and
343
CYG_PCI_DEV_GET_FN() may be used to extract the
344
constituent parts of a device id. It should not be necessary to use these
345
macros under normal circumstances. The following code fragment demonstrates
346
how these macros may be used:
347
348
  // Create a packed representation of device 1, function 0
349
  cyg_uint8 devfn = CYG_PCI_DEV_MAKE_DEVFN(1,0);
350
 
351
  // Create a packed devid for that device on bus 2
352
  cyg_pci_device_id devid = CYG_PCI_DEV_MAKE_ID(2, devfn);
353
 
354
  diag_printf("bus %d, dev %d, func %d\n",
355
              CYG_PCI_DEV_GET_BUS(devid),
356
              CYG_PCI_DEV_GET_DEV(CYG_PCI_DEV_GET_DEVFN(devid)),
357
              CYG_PCI_DEV_GET_FN(CYG_PCI_DEV_GET_DEVFN(devid));
358
359
typedef struct cyg_pci_device;
360
This structure is used to contain data read from a PCI device's
361
configuration header by cyg_pci_get_device_info().
362
It is also used to record the resource allocations made to the device.
363
typedef CYG_WORD64 CYG_PCI_ADDRESS64;
364
typedef CYG_WORD32 CYG_PCI_ADDRESS32;
365
Pointers in the PCI address space are 32 bit (IO space) or
366
32/64 bit (memory space). In most platform and device configurations
367
all of PCI memory will be linearly addressable using only 32 bit
368
pointers as read from base_map[].
369
The 64 bit type is used to allow handling 64 bit devices in
370
the future, should it be necessary, without changing the library's
371
API.
372
373
374
Functions
375
void cyg_pci_init(void);
376
Initialize the PCI library and establish contact with the
377
hardware. This function is idempotent and can be called either by
378
all drivers in the system, or just from an application initialization
379
function.
380
cyg_bool cyg_pci_find_device( cyg_uint16 vendor,
381
                              cyg_uint16 device,
382
                              cyg_pci_device_id *devid );
383
Searches the PCI bus configuration space for a device with
384
the given vendor and device
385
ids. The search starts at the device pointed to by devid,
386
or at the first slot if it contains CYG_PCI_NULL_DEVID.
387
*devid will be updated with the ID of the next device
388
found. Returns true if one is found and false
389
 if not.
390
cyg_bool cyg_pci_find_class( cyg_uint32 dev_class,
391
                             cyg_pci_device_id *devid );
392
Searches the PCI bus configuration space for a device with
393
the given dev_class class code.  The search starts at the
394
device pointed to by devid, or at the first slot if it
395
contains CYG_PCI_NULL_DEVID.
396
*devid will be updated with the ID of the next
397
device found. Returns true if one is found and
398
false if not.
399
cyg_bool cyg_pci_find_next( cyg_pci_device_id cur_devid,
400
                            cyg_pci_device_id *next_devid );
401
Searches the PCI configuration space for the next valid device
402
after cur_devid. If cur_devid
403
is given the value CYG_PCI_NULL_DEVID, then the search starts
404
at the first slot. It is permitted for next_devid to
405
point to cur_devid.  Returns true
406
if another device is found and false if not.
407
408
cyg_bool cyg_pci_find_matching( cyg_pci_match_func *matchp,
409
                                void * match_callback_data,
410
                                cyg_pci_device_id *devid );
411
412
Searches the PCI bus configuration space for a device whose properties
413
match those required by the caller supplied cyg_pci_match_func.
414
The search starts at the device pointed to by devid, or
415
at the first slot if it contains CYG_PCI_NULL_DEVID. The
416
devid will be updated with the ID of the next device found.
417
This function returns true if a matching device is found
418
and false if not.
419
420
The match_func has a type declared as:
421
422
typedef cyg_bool (cyg_pci_match_func)( cyg_uint16 vendor,
423
                                       cyg_uint16 device,
424
                                       cyg_uint32 class,
425
                                       void *     user_data);
426
427
The vendor, device, and
428
class are from the device configuration space. The
429
user_data is the callback data passed to 
430
cyg_pci_find_matching.
431
432
void cyg_pci_get_device_info ( cyg_pci_device_id devid,
433
                               cyg_pci_device *dev_info );
434
This function gets the PCI configuration information for the
435
device indicated in devid. The common fields of the
436
cyg_pci_device structure, and the appropriate fields
437
of the relevant header union member are filled in from the device's
438
configuration space.
439
If the device has not been enabled, then this function will also fetch
440
the size and type information from the base address registers and
441
place it in the base_size[] array.
442
void cyg_pci_set_device_info ( cyg_pci_device_id devid,
443
                               cyg_pci_device *dev_info );
444
This function sets the PCI configuration information for the
445
device indicated in devid. Only the configuration space
446
registers that are writable are actually written. Once all the fields have
447
been written, the device info will be read back into *dev_info
448
, so that it reflects the true state of the hardware.
449
450
void cyg_pci_read_config_uint8(  cyg_pci_device_id devid,
451
                                 cyg_uint8 offset, cyg_uint8 *val );
452
void cyg_pci_read_config_uint16( cyg_pci_device_id devid,
453
                                 cyg_uint8 offset, cyg_uint16 *val );
454
void cyg_pci_read_config_uint32( cyg_pci_device_id devid,
455
                                 cyg_uint8 offset, cyg_uint32 *val );
456
457
These functions read registers of the appropriate size from
458
the configuration space of the given device. They should mainly
459
be used to access registers that are device specific. General PCI
460
registers are best accessed through cyg_pci_get_device_info()
461
.
462
463
void cyg_pci_write_config_uint8(  cyg_pci_device_id devid,
464
                                  cyg_uint8 offset, cyg_uint8 val );
465
void cyg_pci_write_config_uint16( cyg_pci_device_id devid,
466
                                  cyg_uint8 offset, cyg_uint16 val );
467
void cyg_pci_write_config_uint32( cyg_pci_device_id devid,
468
                                  cyg_uint8 offset, cyg_uint32 val );
469
470
These functions write registers of the appropriate size to
471
the configuration space of the given device. They should mainly
472
be used to access registers that are device specific. General PCI
473
registers are best accessed through cyg_pci_get_device_info()
474
. Writing the general registers this way may render the contents of
475
a cyg_pci_device structure invalid.
476
477
478
Resource allocation
479
These routines allocate memory and I/O space to PCI devices.
480
cyg_bool cyg_pci_configure_device( cyg_pci_device *dev_info )
481
Allocate memory and IO space to all base address registers
482
using the current memory and IO base addresses in the library. The
483
allocated base addresses, translated into directly usable values,
484
will be put into the matching base_map[] entries
485
in *dev_info. If *dev_info does
486
not contain valid base_size[] entries, then the result is
487
false. This function will also call 
488
cyg_pci_translate_interrupt() to put the interrupt vector into the
489
HAL vector entry.
490
cyg_bool cyg_pci_configure_bus( cyg_uint8 bus, cyg_uint8 *next_bus )
491
492
Allocate memory and IO space to all base address registers on all devices
493
on the given bus and all subordinate busses. If a PCI-PCI bridge is found on
494
bus, this function will call itself recursively in order
495
to configure the bus on the other side of the bridge. Because of the nature of
496
bridge devices, all devices on the secondary side of a bridge must be allocated
497
memory and IO space before the memory and IO windows on the bridge device can be
498
properly configured. The next_bus argument points to the
499
bus number to assign to the next subordinate bus found. The number will be
500
incremented as new busses are discovered. If successful, true
501
is returned. Otherwise, false is returned.
502
503
504
cyg_bool cyg_pci_translate_interrupt( cyg_pci_device *dev_info,
505
                                      CYG_ADDRWORD *vec );
506
507
Translate the device's PCI interrupt (INTA#-INTD#)
508
to the associated HAL vector. This may also depend on which slot
509
the device occupies. If the device may generate interrupts, the
510
translated vector number will be stored in vec and the
511
result is true. Otherwise the result is false
512
.
513
514
cyg_bool cyg_pci_allocate_memory( cyg_pci_device *dev_info,
515
                                  cyg_uint32 bar,
516
                                  CYG_PCI_ADDRESS64 *base );
517
cyg_bool cyg_pci_allocate_io( cyg_pci_device *dev_info,
518
                              cyg_uint32 bar,
519
                              CYG_PCI_ADDRESS32 *base );
520
521
These routines allocate memory or I/O space to the base address
522
register indicated by bar. The base address in
523
*base will be correctly aligned and the address of the
524
next free location will be written back into it if the allocation succeeds. If
525
the base address register is of the wrong type for this allocation, or
526
dev_info does not contain valid base_size[]
527
 entries, the result is false. These functions
528
allow a device driver to set up its own mappings if it wants. Most devices
529
should probably use cyg_pci_configure_device().
530
void cyg_pci_set_memory_base( CYG_PCI_ADDRESS64 base );
531
void cyg_pci_set_io_base( CYG_PCI_ADDRESS32 base );
532
These routines set the base addresses for memory and I/O mappings
533
to be used by the memory allocation routines. Normally these base
534
addresses will be set to default values based on the platform. These
535
routines allow these to be changed by application code if necessary.
536
537
538
PCI Library Hardware API
539
This API is used by the PCI library to access the PCI bus
540
configuration space. Although it should not normally be necessary,
541
this API may also be used by device driver or application code to
542
perform PCI bus operations not supported by the PCI library.
543
void cyg_pcihw_init(void);
544
Initialize the PCI hardware so that the configuration space
545
may be accessed.
546
547
void cyg_pcihw_read_config_uint8(  cyg_uint8 bus,
548
               cyg_uint8 devfn, cyg_uint8 offset, cyg_uint8 *val);
549
void cyg_pcihw_read_config_uint16( cyg_uint8 bus,
550
               cyg_uint8 devfn, cyg_uint8 offset, cyg_uint16 *val);
551
void cyg_pcihw_read_config_uint32( cyg_uint8 bus,
552
               cyg_uint8 devfn, cyg_uint8 offset, cyg_uint32 *val);
553
554
These functions read a register of the appropriate size from
555
the PCI configuration space at an address composed from the bus
556
, devfn and offset
557
arguments.
558
559
void cyg_pcihw_write_config_uint8(  cyg_uint8 bus,
560
                cyg_uint8 devfn, cyg_uint8 offset, cyg_uint8 val);
561
void cyg_pcihw_write_config_uint16( cyg_uint8 bus,
562
                cyg_uint8 devfn, cyg_uint8 offset, cyg_uint16 val);
563
void cyg_pcihw_write_config_uint32( cyg_uint8 bus,
564
                cyg_uint8 devfn, cyg_uint8 offset, cyg_uint32 val);
565
566
These functions write a register of the appropriate size to
567
the PCI configuration space at an address composed from the
568
bus, devfn and
569
offset arguments.
570
571
cyg_bool cyg_pcihw_translate_interrupt( cyg_uint8 bus,
572
                                        cyg_uint8 devfn,
573
                                        CYG_ADDRWORD *vec);
574
575
This function interrogates the device and determines which
576
HAL interrupt vector it is connected to.
577
578
579
HAL PCI support
580
HAL support consists of a set of C macros that provide the
581
implementation of the low level PCI API.
582
HAL_PCI_INIT()
583
Initialize the PCI bus.
584
HAL_PCI_READ_UINT8( bus, devfn, offset, val )
585
HAL_PCI_READ_UINT16( bus, devfn, offset, val )
586
HAL_PCI_READ_UINT32( bus, devfn, offset, val )
587
Read a value from the PCI configuration space of the appropriate
588
size at an address composed from the bus, 
589
devfn and offset.
590
HAL_PCI_WRITE_UINT8( bus, devfn, offset, val )
591
HAL_PCI_WRITE_UINT16( bus, devfn, offset, val )
592
HAL_PCI_WRITE_UINT32( bus, devfn, offset, val )
593
Write a value to the PCI configuration space of the appropriate
594
size at an address composed from the bus, 
595
devfn and offset.
596
HAL_PCI_TRANSLATE_INTERRUPT( bus, devfn, *vec, valid )
597
Translate the device's interrupt line into a HAL
598
interrupt vector.
599
HAL_PCI_ALLOC_BASE_MEMORY
600
HAL_PCI_ALLOC_BASE_IO
601
These macros define the default base addresses used to initialize
602
the memory and I/O allocation pointers.
603
HAL_PCI_PHYSICAL_MEMORY_BASE
604
HAL_PCI_PHYSICAL_IO_BASE
605
PCI memory and IO range do not always correspond directly
606
to physical memory or IO addresses. Frequently the PCI address spaces
607
are windowed into the processor's address range at some
608
offset. These macros define offsets to be added to the PCI base
609
addresses to translate PCI bus addresses into physical memory addresses
610
that can be used to access the allocated memory or IO space.
611
612
The chunk of PCI memory space directly addressable though
613
the window by the CPU may be smaller than the amount of PCI memory
614
actually provided. In that case drivers will have to access PCI
615
memory space in segments. Doing this will be platform specific and
616
is currently beyond the scope of the HAL.
617
618
HAL_PCI_IGNORE_DEVICE( bus, dev, fn )
619
This macro, if defined, may be used to limit the devices which are
620
found by the bus scanning functions. This is sometimes necessary for
621
devices which need special handling. If this macro evaluates to true
622
, the given device will not be found by cyg_pci_find_next
623
 or other bus scanning functions.
624
625
HAL_PCI_IGNORE_BAR( dev_info, bar_num )
626
This macro, if defined, may be used to limit which BARs are discovered
627
and configured. This is sometimes necessary for platforms with limited PCI
628
windows. If this macro evaluates to true, the given BAR
629
will not be discovered by cyg_pci_get_device_info and
630
therefore not configured by cyg_pci_configure_device.
631
632
633
634
635

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.