1 2 #ifndef _MACROS_H 3 #define _MACROS_H 4 5 /* 6 ** Load a long integer into a register 7 */ 8 .macro liw reg, value 9 lis \reg, \value@h 10 ori \reg, \reg, \value@l 11 .endm 12 13 14 /* 15 ** Generate config_addr request 16 ** This macro expects the values in registers: 17 ** r3 - bus 18 ** r4 - devfn 19 ** r5 - offset 20 */ 21 .macro config_addr 22 rlwinm r9, r5, 2, 0, 31 23 rlwinm r8, r4, 8, 0, 31 24 rlwinm r7, r3, 16, 0, 31 25 or r9, r8, r9 26 or r9, r7, r9 27 oris r9, r9, 0x8000 28 liw r10, 0xeec00000 29 stw r9, 0(r10) 30 eieio 31 sync 32 .endm 33 34 35 /* 36 ** Generate config_data address 37 */ 38 .macro config_data mask 39 andi. r9, r5, \mask 40 addi r9, r9, 0x004 41 oris r9, r9, 0xeec0 42 .endm 43 44 45 /* 46 ** Write a byte value to an output port 47 */ 48 .macro outb port, value 49 lis r2, 0xe800 50 li r0, \value 51 stb r0, \port(r2) 52 .endm 53 54 55 /* 56 ** Write a register byte value to an output port 57 */ 58 .macro outbr port, value 59 lis r2, 0xe800 60 stb \value, \port(r2) 61 .endm 62 63 64 /* 65 ** Read a byte value from a port into a specified register 66 */ 67 .macro inb reg, port 68 lis r2, 0xe800 69 lbz \reg, \port(r2) 70 .endm 71 72 73 /* 74 ** Write a byte to the SuperIO config area 75 */ 76 .macro siowb offset, value 77 li r3, 0 78 li r4, (7<<3) 79 li r5, \offset 80 li r6, \value 81 bl pci_write_cfg_byte 82 .endm 83 84 #endif 85