12 void outb(unsigned char value, unsigned short port)
14 __builtin_outb(value, port);
17 unsigned char inb(unsigned short port)
19 return __builtin_inb(port);
22 static unsigned int config_cmd2(unsigned char bus, unsigned devfn, unsigned where)
24 return 0x80000000 | (bus << 16) | (devfn << 8) | (where & ~3) ;
28 #ifndef CONFIG_TTYS0_BASE
29 #define CONFIG_TTYS0_BASE 0x3f8
32 #ifndef CONFIG_TTYS0_BAUD
33 #define CONFIG_TTYS0_BAUD 115200
36 #if ((115200%CONFIG_TTYS0_BAUD) != 0)
37 #error Bad ttys0 baud rate
40 #define CONFIG_TTYS0_DIV (115200/CONFIG_TTYS0_BAUD)
42 /* Line Control Settings */
43 #ifndef CONFIG_TTYS0_LCS
44 /* Set 8bit, 1 stop bit, no parity */
45 #define CONFIG_TTYS0_LCS 0x3
48 #define UART_LCS CONFIG_TTYS0_LCS
68 int uart_can_tx_byte(void)
70 return inb(CONFIG_TTYS0_BASE + UART_LSR) & 0x20;
73 void uart_wait_to_tx_byte(void)
75 while(!uart_can_tx_byte())
79 void uart_wait_until_sent(void)
81 while(!(inb(CONFIG_TTYS0_BASE + UART_LSR) & 0x40))
85 void uart_tx_byte(unsigned char data)
87 uart_wait_to_tx_byte();
88 outb(data, CONFIG_TTYS0_BASE + UART_TBR);
89 /* Make certain the data clears the fifos */
90 uart_wait_until_sent();
98 #define PIIX4_DEVFN 0x90
99 #define SMBUS_MEM_DEVICE_START 0x50
100 #define SMBUS_MEM_DEVICE_END 0x53
101 #define SMBUS_MEM_DEVICE_INC 1
105 #define PM_DEVFN (PIIX4_DEVFN+3)
107 #define SMBUS_IO_BASE 0x1000
116 static void smbus_wait_until_done(void)
120 byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
121 }while((byte &1) == 1);
123 while( (byte & ~1) == 0) {
124 byte = inb(SMBUS_IO_BASE + SMBHSTSTAT);
130 void ifthenelse(void)
143 static int add(int left, int right)
151 static int add(int left, int right)
159 static void assign(void)
167 static void and(void)
175 static void and_test(void)
182 static void inc(void)
198 static void inc_test(void)
205 static void loop(void)
208 for(i = 0; i < 10; i++) {
213 static void loop_test(void)
220 static void simple(void)
227 static void fun(void)
236 static void func(void)
245 for(i = 0; i < 10; i = i + 1) {