]>
Commit | Line | Data |
---|---|---|
0889f342 JP |
1 | #include <sys/io.h> |
2 | #include <reg-82801b.h> | |
3 | #include <string.h> | |
4 | #include <stdint.h> | |
ea6c242b | 5 | #include <stdlib.h> |
0889f342 JP |
6 | |
7 | static uint16_t _get_PMBASE() | |
8 | { | |
9 | static long pmbase = -1; | |
10 | ||
11 | if (pmbase == -1) | |
12 | pmbase = pci_read32(ICH2_LPC_BUS, ICH2_LPC_DEV, ICH2_LPC_FN, ICH2_LPC_PCI_PMBASE) & ICH2_PMBASE_MASK; | |
13 | ||
14 | return pmbase; | |
15 | } | |
16 | ||
0cd80c51 JP |
17 | typedef struct { |
18 | uint32_t signature; | |
19 | uint32_t type; | |
20 | uint8_t data[]; | |
21 | } packet_t; | |
0889f342 | 22 | |
0cd80c51 | 23 | extern unsigned int poke(unsigned long addr, unsigned long * value); |
0889f342 JP |
24 | |
25 | int main(int argc, char **argv) | |
26 | { | |
27 | unsigned int res; | |
0cd80c51 JP |
28 | packet_t * packet = (packet_t *)memalign(4096, sizeof(packet_t)); |
29 | ||
30 | packet->signature = 0x1BADD00D; | |
31 | packet->type = 0xF00FC7C8; | |
0889f342 JP |
32 | |
33 | if (iopl(3) < 0) | |
34 | { | |
35 | perror("iopl"); | |
36 | return 1; | |
37 | } | |
ea6c242b | 38 | |
0cd80c51 JP |
39 | res = poke(_get_PMBASE() + 0x04, (void *)packet); |
40 | printf("returned %p\n", res); | |
0889f342 | 41 | } |