Rev 1324 | Rev 1336 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1324 | Rev 1335 | ||
|---|---|---|---|
| Line 11... | Line 11... | ||
| 11 | 11 | ||
| 12 | #include <stdio.h> |
12 | #include <stdio.h> |
| 13 | #include <ddi.h> |
13 | #include <ddi.h> |
| 14 | #include <task.h> |
14 | #include <task.h> |
| 15 | #include <stdlib.h> |
15 | #include <stdlib.h> |
| - | 16 | #include <ipc.h> |
|
| - | 17 | #include <errno.h> |
|
| 16 | 18 | ||
| 17 | #include "libpci/pci.h" |
19 | #include "libpci/pci.h" |
| 18 | 20 | ||
| 19 | #define PCI_CONF1 0xcf8 |
21 | #define PCI_CONF1 0xcf8 |
| 20 | #define PCI_CONF1_SIZE 8 |
22 | #define PCI_CONF1_SIZE 8 |
| 21 | 23 | ||
| - | 24 | #define NAME "PCI" |
|
| - | 25 | ||
| 22 | int main(int argc, char *argv[]) |
26 | int main(int argc, char *argv[]) |
| 23 | { |
27 | { |
| 24 | struct pci_access *pacc; |
28 | struct pci_access *pacc; |
| 25 | struct pci_dev *dev; |
29 | struct pci_dev *dev; |
| 26 | unsigned int c; |
30 | unsigned int c; |
| 27 | char buf[80]; |
31 | char buf[80]; |
| 28 | 32 | ||
| - | 33 | int ipc_res; |
|
| - | 34 | ipcarg_t ns_phone_addr; |
|
| - | 35 | ||
| 29 | printf("HelenOS PCI driver\n"); |
36 | printf("%s: HelenOS PCI driver\n", NAME); |
| 30 | 37 | ||
| 31 | /* |
38 | /* |
| 32 | * Gain control over PCI configuration ports. |
39 | * Gain control over PCI configuration ports. |
| 33 | */ |
40 | */ |
| 34 | iospace_enable(task_get_id(), (void *) PCI_CONF1, PCI_CONF1_SIZE); |
41 | iospace_enable(task_get_id(), (void *) PCI_CONF1, PCI_CONF1_SIZE); |
| Line 45... | Line 52... | ||
| 45 | printf("\t%s\n", pci_lookup_name(pacc, buf, sizeof(buf), PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE, |
52 | printf("\t%s\n", pci_lookup_name(pacc, buf, sizeof(buf), PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE, |
| 46 | dev->vendor_id, dev->device_id)); |
53 | dev->vendor_id, dev->device_id)); |
| 47 | } |
54 | } |
| 48 | pci_cleanup(pacc); /* Close everything */ |
55 | pci_cleanup(pacc); /* Close everything */ |
| 49 | 56 | ||
| - | 57 | printf("%s: registering at naming service.\n", NAME); |
|
| - | 58 | if (ipc_connect_to_me(PHONE_NS, 40, 70, &ns_phone_addr) != 0) { |
|
| - | 59 | printf("Failed to register %s at naming service.\n", NAME); |
|
| - | 60 | return -1; |
|
| - | 61 | } |
|
| - | 62 | ||
| - | 63 | printf("%s: accepting connections\n", NAME); |
|
| - | 64 | while (1) { |
|
| - | 65 | ipc_call_t call; |
|
| - | 66 | ipc_callid_t callid; |
|
| - | 67 | ||
| - | 68 | callid = ipc_wait_for_call(&call, 0); |
|
| - | 69 | ipc_answer(callid, EHANGUP, 0, 0); |
|
| - | 70 | } |
|
| 50 | return 0; |
71 | return 0; |
| 51 | } |
72 | } |