2 * $Id: internal.h,v 1.3 1999/07/20 14:01:32 mj Exp $
4 * The PCI Library -- Internal Include File
6 * Copyright (c) 1997--1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
8 * Can be freely distributed and used under the terms of the GNU GPL.
13 #ifdef HAVE_PM_LINUX_BYTEORDER_H
15 #include <asm/byteorder.h>
16 #define cpu_to_le16 __cpu_to_le16
17 #define cpu_to_le32 __cpu_to_le32
18 #define le16_to_cpu __le16_to_cpu
19 #define le32_to_cpu __le32_to_cpu
25 #define BYTE_ORDER __BYTE_ORDER
26 #define BIG_ENDIAN __BIG_ENDIAN
30 #include <sys/types.h>
33 #if BYTE_ORDER == BIG_ENDIAN
34 #define cpu_to_le16 swab16
35 #define cpu_to_le32 swab32
36 #define le16_to_cpu swab16
37 #define le32_to_cpu swab32
39 static inline word
swab16(word w
)
41 return (w
<< 8) | ((w
>> 8) & 0xff);
44 static inline u32
swab32(u32 w
)
46 return ((w
& 0xff000000) >> 24) |
47 ((w
& 0x00ff0000) >> 8) |
48 ((w
& 0x0000ff00) << 8) |
49 ((w
& 0x000000ff) << 24);
52 #define cpu_to_le16(x) (x)
53 #define cpu_to_le32(x) (x)
54 #define le16_to_cpu(x) (x)
55 #define le32_to_cpu(x) (x)
62 void (*config
)(struct pci_access
*);
63 int (*detect
)(struct pci_access
*);
64 void (*init
)(struct pci_access
*);
65 void (*cleanup
)(struct pci_access
*);
66 void (*scan
)(struct pci_access
*);
67 int (*fill_info
)(struct pci_dev
*, int flags
);
68 int (*read
)(struct pci_dev
*, int pos
, byte
*buf
, int len
);
69 int (*write
)(struct pci_dev
*, int pos
, byte
*buf
, int len
);
70 void (*init_dev
)(struct pci_dev
*);
71 void (*cleanup_dev
)(struct pci_dev
*);
74 void pci_generic_scan(struct pci_access
*);
75 int pci_generic_fill_info(struct pci_dev
*, int flags
);
76 int pci_generic_block_read(struct pci_dev
*, int pos
, byte
*buf
, int len
);
77 int pci_generic_block_write(struct pci_dev
*, int pos
, byte
*buf
, int len
);
79 void *pci_malloc(struct pci_access
*, int);
80 void pci_mfree(void *);
82 struct pci_dev
*pci_alloc_dev(struct pci_access
*);
83 int pci_link_dev(struct pci_access
*, struct pci_dev
*);
85 extern struct pci_methods pm_intel_conf1
, pm_intel_conf2
, pm_linux_proc
,
86 pm_syscalls
, pm_fbsd_device
, pm_dump
;
88 #define UNUSED __attribute__((unused))