]> Joshua Wise's Git repositories - netwatch.git/blame_incremental - aseg/firstrun.c
second arg of memcpy should be const
[netwatch.git] / aseg / firstrun.c
... / ...
CommitLineData
1#include <io.h>
2#include <smi.h>
3#include <pci.h>
4#include <reg-82801b.h>
5#include <output.h>
6#include "vga-overlay.h"
7#include <smram.h>
8
9extern int _bss, _bssend;
10
11extern void timer_handler(smi_event_t ev);
12extern void kbc_handler(smi_event_t ev);
13extern void gbl_rls_handler(smi_event_t ev);
14
15static int found = 0, _bus, _dev, _fn;
16
17void do_bother()
18{
19 int bar;
20
21 if (!found)
22 return;
23
24 pci_write16(_bus, _dev, _fn, 0x04, 0x00);
25 for (bar = 0; bar < 6; bar++)
26 pci_write32(_bus, _dev, _fn, 0x10 + bar*4, 0x1FFFFFFF);
27}
28
29int bother_3c905(pci_dev_t *dev)
30{
31 if (dev->vid == 0x10B7 || dev->did == 0x9200)
32 {
33 outputf("Found a 3c905 to bother");
34
35 _bus = dev->bus;
36 _dev = dev->dev;
37 _fn = dev->fn;
38 found = 1;
39
40 do_bother();
41
42 return 1;
43 }
44 return 0;
45}
46
47void __firstrun_start() {
48 unsigned char *bp;
49 smram_state_t smram;
50
51 smram = smram_save_state();
52 smram_tseg_set_state(SMRAM_TSEG_OPEN);
53
54 for (bp = (void *)&_bss; (void *)bp < (void *)&_bssend; bp++)
55 *bp = 0;
56
57 outputf("NetWatch running");
58
59 /* Try really hard to shut up USB_LEGKEY. */
60 pci_write16(0, 31, 2, 0xC0, pci_read16(0, 31, 2, 0xC0));
61 pci_write16(0, 31, 2, 0xC0, 0);
62 pci_write16(0, 31, 4, 0xC0, pci_read16(0, 31, 4, 0xC0));
63 pci_write16(0, 31, 4, 0xC0, 0);
64
65 /* Turn on the SMIs we want */
66 smi_disable();
67
68 pci_probe(bother_3c905);
69
70 smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
71 smi_enable_event(SMI_EVENT_FAST_TIMER);
72
73 smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
74 smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
75
76 smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler);
77 smi_enable_event(SMI_EVENT_GBL_RLS);
78
79 smi_enable();
80
81 smram_restore_state(smram);
82}
83
This page took 0.026398 seconds and 4 git commands to generate.