summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/shared/pci/pcibios.h
blob: 0bd693ab0e12ceea464c33dcd59515c7483a3f89 (plain) (blame)
1
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
 * @file
 * @ingroup i386_pcibios
 * @brief
 */

/*
 * This software is Copyright (C) 1998 by T.sqware - all rights limited
 * It is provided in to the public domain "as is", can be freely modified
 * as far as this copyight notice is kept unchanged, but does not imply
 * an endorsement by T.sqware of the product in which it is included.
 */

/**
 * @defgroup i386_pcibios
 * @ingroup i386_pci
 * @brief
 * @{
 */

#ifndef _PCIB_H
#define _PCIB_H

#include <rtems/pci.h>

/** @brief
 * Make device signature from bus number, device numebr and function
 * number
 */
#define PCIB_DEVSIG_MAKE(b,d,f) ((b<<8)|(d<<3)|(f))

/** @brief
 * Extract valrous part from device signature
 */
#define PCIB_DEVSIG_BUS(x) (((x)>>8) &0xff)
#define PCIB_DEVSIG_DEV(x) (((x)>>3) & 0x1f)
#define PCIB_DEVSIG_FUNC(x) ((x) & 0x7)

#ifdef __cplusplus
extern "C" {
#endif

int pcib_find_by_class(int classCode, int idx, int *sig);
int pcib_special_cycle(int busNo, int data);
int pcib_conf_read8(int sig, int off, uint8_t *data);
int pcib_conf_read16(int sig, int off, uint16_t *data);
int pcib_conf_read32(int sig, int off, uint32_t *data);
int pcib_conf_write8(int sig, int off, uint8_t data);
int pcib_conf_write16(int sig, int off, uint16_t data);
int pcib_conf_write32(int sig, int off, uint32_t data);

int
pci_find_device( unsigned short vendorid, unsigned short deviceid,
                   int instance, int *pbus, int *pdev, int *pfun );

/** @} */

#ifdef __cplusplus
}
#endif

#endif /* _PCIB_H */