| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-ftree-pre -fcode-hoisting" } */ |
| 3 |
|
| 4 |
__extension__ typedef __UINTPTR_TYPE__ uintptr_t; |
| 5 |
|
| 6 |
typedef unsigned char u8; |
| 7 |
extern unsigned long pci_io_base; |
| 8 |
u8 in_8 (const volatile void *); |
| 9 |
int eeh_enabled (); |
| 10 |
void eeh_check_failure (); |
| 11 |
static inline |
| 12 |
u8 eeh_readb(const volatile void *addr) |
| 13 |
{ |
| 14 |
u8 val = in_8(addr); |
| 15 |
if (((val) == (u8)~0 && eeh_enabled())) eeh_check_failure(); |
| 16 |
return val; |
| 17 |
} |
| 18 |
extern struct ppc_pci_io { |
| 19 |
void (*outb) (u8 val, unsigned long port); |
| 20 |
} |
| 21 |
ppc_pci_io; |
| 22 |
static inline |
| 23 |
u8 readb (const volatile void * addr) |
| 24 |
{ |
| 25 |
return eeh_readb((addr)); |
| 26 |
} |
| 27 |
static inline |
| 28 |
u8 inb (unsigned long port) |
| 29 |
{ |
| 30 |
return readb((volatile void *)(uintptr_t)pci_io_base + port); |
| 31 |
} |
| 32 |
static inline |
| 33 |
void outb (u8 val, unsigned long port) |
| 34 |
{ |
| 35 |
if (ppc_pci_io.outb != ((void *)0)) ppc_pci_io.outb (val, port); |
| 36 |
}; |
| 37 |
void frob_econtrol(unsigned long base_hi, unsigned char m, unsigned char v) |
| 38 |
{ |
| 39 |
unsigned char ectr = 0; |
| 40 |
if (m != 0xff) ectr = inb((base_hi + 0x2)); |
| 41 |
outb((ectr & ~m) ^ v, (base_hi + 0x2)); |
| 42 |
} |