2 * $Id: internal.h,v 1.6 2002/03/30 15:39:25 mj Exp $
4 * The PCI Library -- Internal Include File
6 * Copyright (c) 1997--2000 Martin Mares <mj@ucw.cz>
8 * Can be freely distributed and used under the terms of the GNU GPL.
14 #define UNUSED __attribute__((unused))
20 #ifdef HAVE_PM_LINUX_BYTEORDER_H
22 #include <asm/byteorder.h>
23 #define cpu_to_le16 __cpu_to_le16
24 #define cpu_to_le32 __cpu_to_le32
25 #define le16_to_cpu __le16_to_cpu
26 #define le32_to_cpu __le32_to_cpu
32 #define BYTE_ORDER __BYTE_ORDER
33 #define BIG_ENDIAN __BIG_ENDIAN
37 #include <sys/types.h>
40 #if BYTE_ORDER == BIG_ENDIAN
41 #define cpu_to_le16 swab16
42 #define cpu_to_le32 swab32
43 #define le16_to_cpu swab16
44 #define le32_to_cpu swab32
46 static inline word
swab16(word w
)
48 return (w
<< 8) | ((w
>> 8) & 0xff);
51 static inline u32
swab32(u32 w
)
53 return ((w
& 0xff000000) >> 24) |
54 ((w
& 0x00ff0000) >> 8) |
55 ((w
& 0x0000ff00) << 8) |
56 ((w
& 0x000000ff) << 24);
59 #define cpu_to_le16(x) (x)
60 #define cpu_to_le32(x) (x)
61 #define le16_to_cpu(x) (x)
62 #define le32_to_cpu(x) (x)
69 void (*config
)(struct pci_access
*);
70 int (*detect
)(struct pci_access
*);
71 void (*init
)(struct pci_access
*);
72 void (*cleanup
)(struct pci_access
*);
73 void (*scan
)(struct pci_access
*);
74 int (*fill_info
)(struct pci_dev
*, int flags
);
75 int (*read
)(struct pci_dev
*, int pos
, byte
*buf
, int len
);
76 int (*write
)(struct pci_dev
*, int pos
, byte
*buf
, int len
);
77 void (*init_dev
)(struct pci_dev
*);
78 void (*cleanup_dev
)(struct pci_dev
*);
81 void pci_generic_scan_bus(struct pci_access
*, byte
*busmap
, int bus
);
82 void pci_generic_scan(struct pci_access
*);
83 int pci_generic_fill_info(struct pci_dev
*, int flags
);
84 int pci_generic_block_read(struct pci_dev
*, int pos
, byte
*buf
, int len
);
85 int pci_generic_block_write(struct pci_dev
*, int pos
, byte
*buf
, int len
);
87 void *pci_malloc(struct pci_access
*, int);
88 void pci_mfree(void *);
90 struct pci_dev
*pci_alloc_dev(struct pci_access
*);
91 int pci_link_dev(struct pci_access
*, struct pci_dev
*);
93 extern struct pci_methods pm_intel_conf1
, pm_intel_conf2
, pm_linux_proc
,
94 pm_syscalls
, pm_fbsd_device
, pm_aix_device
, pm_dump
;