1 /* $NetBSD: globals.h,v 1.10 2009/07/03 10:31:19 nisimura Exp $ */
5 #define TICKS_PER_SEC (100000000 / 4) /* 100MHz front bus */
7 #define NS_PER_TICK (1000000000 / TICKS_PER_SEC)
11 #define BRD_SANDPOINTX2 2
12 #define BRD_SANDPOINTX3 3
13 #define BRD_ENCOREPP1 10
14 #define BRD_KUROBOX 100
15 #define BRD_UNKNOWN -1
17 extern char *consname
;
20 extern int ticks_per_sec
;
22 unsigned mpc107memsize(void);
24 /* PPC processor ctl */
25 void __syncicache(void *, size_t);
27 /* byte swap access */
28 void out16rb(unsigned, unsigned);
29 void out32rb(unsigned, unsigned);
30 unsigned in16rb(unsigned);
31 unsigned in32rb(unsigned);
32 void iohtole16(unsigned, unsigned);
33 void iohtole32(unsigned, unsigned);
34 unsigned iole32toh(unsigned);
35 unsigned iole16toh(unsigned);
37 /* far call would never return */
38 void run(void *, void *, void *, void *, void *);
40 /* micro second precision delay */
46 unsigned pcimaketag(int, int, int);
47 void pcidecomposetag(unsigned, int *, int *, int *);
48 int pcifinddev(unsigned, unsigned, unsigned *);
49 int pcilookup(unsigned, unsigned [][2], int);
50 unsigned pcicfgread(unsigned, int);
51 void pcicfgwrite(unsigned, int, unsigned);
53 #define PCI_ID_REG 0x00
54 #define PCI_COMMAND_STATUS_REG 0x04
55 #define PCI_VENDOR(id) ((id) & 0xffff)
56 #define PCI_PRODUCT(id) (((id) >> 16) & 0xffff)
57 #define PCI_VENDOR_INVALID 0xffff
58 #define PCI_DEVICE(v,p) ((v) | ((p) << 16))
59 #define PCI_CLASS_REG 0x08
60 #define PCI_CLASS_PPB 0x0604
61 #define PCI_CLASS_ETH 0x0200
62 #define PCI_CLASS_IDE 0x0101
63 #define PCI_CLASS_RAID 0x0104
64 #define PCI_CLASS_SATA 0x0106
65 #define PCI_BHLC_REG 0x0c
66 #define PCI_HDRTYPE_TYPE(r) (((r) >> 16) & 0x7f)
67 #define PCI_HDRTYPE_MULTIFN(r) ((r) & (0x80 << 16))
70 void _wb(uint32_t, uint32_t);
71 void _wbinv(uint32_t, uint32_t);
72 void _inv(uint32_t, uint32_t);
75 int net_open(struct open_file
*, ...);
76 int net_close(struct open_file
*);
77 int net_strategy(void *, int, daddr_t
, size_t, void *, size_t *);
79 int netif_init(unsigned);
80 int netif_open(void *);
83 #define NIF_DECL(xxx) \
84 int xxx ## _match(unsigned, void *); \
85 void * xxx ## _init(unsigned, void *); \
86 int xxx ## _send(void *, char *, unsigned); \
87 int xxx ## _recv(void *, char *, unsigned, unsigned)