]> Joshua Wise's Git repositories - netwatch.git/commitdiff
p2v and v2p, in a manner of type A...
authorJoshua Wise <joshua@rebirth.joshuawise.com>
Mon, 10 Nov 2008 19:10:54 +0000 (14:10 -0500)
committerJoshua Wise <joshua@rebirth.joshuawise.com>
Mon, 10 Nov 2008 19:10:54 +0000 (14:10 -0500)
aseg-paging/Makefile
aseg-paging/smi.c
include/paging.h [new file with mode: 0644]
lib/paging.c [new file with mode: 0644]
net/3c90x.c
net/etherboot-compat.h

index 58d2652eabb0609311f3c3b411940dc63fd80408..0bbe0489e106960d998566a78ab9cf6bc016ec83 100644 (file)
@@ -46,6 +46,7 @@ OBJS =        ../ich2/smi.o \
        ../lib/sprintf.o \
        ../lib/console.o \
        ../lib/serial.o \
        ../lib/sprintf.o \
        ../lib/console.o \
        ../lib/serial.o \
+       ../lib/paging.o \
        ../aseg/keyboard.o \
        ../aseg/packet.o \
        $(LWIP_OBJS) \
        ../aseg/keyboard.o \
        ../aseg/packet.o \
        $(LWIP_OBJS) \
index eada78df797f1e81514c0977649bf13c5bfc5e25..bd29f64f81713da06febd76e5b8cbc028ae368f1 100644 (file)
@@ -15,27 +15,17 @@ unsigned char vgasave = 0;
 void smi_entry(void)
 {
        char statstr[512];
 void smi_entry(void)
 {
        char statstr[512];
-       outb(0x80, 0x0B);
+
        pcisave = inl(0xCF8);
        vgasave = inb(0x3D4);
        pcisave = inl(0xCF8);
        vgasave = inb(0x3D4);
-       outb(0x80, 0x1B);
-/*
        pci_unbother_all();
        pci_unbother_all();
- */
+
        counter++;
        counter++;
-       outb(0x80, 0x2B);
        sprintf(statstr, "NetWatch! %08x %08x", smi_status(), counter);
        sprintf(statstr, "NetWatch! %08x %08x", smi_status(), counter);
-       outb(0x80, 0x3B);
        strblit(statstr, 0, 0);
        strblit(statstr, 0, 0);
-       outb(0x80, 0x4B);
        
        serial_init();
        
        serial_init();
-/*     dolog("wee!");
- */
-       
-       /*
        eth_poll();
        eth_poll();
-       */
        
        if (inl(0x840) & 0x1000)
        {
        
        if (inl(0x840) & 0x1000)
        {
@@ -48,9 +38,8 @@ void smi_entry(void)
 
 
        smi_poll();
 
 
        smi_poll();
-/*     
+       
        pci_bother_all();
        pci_bother_all();
- */
        outl(0xCF8, pcisave);
        outb(0x3D4, vgasave);
 }
        outl(0xCF8, pcisave);
        outb(0x3D4, vgasave);
 }
diff --git a/include/paging.h b/include/paging.h
new file mode 100644 (file)
index 0000000..69c12eb
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __PAGING_H
+#define __PAGING_H
+
+extern unsigned long memory_v2p(void *virt);
+extern void *memory_p2v(unsigned long phys);
+
+#endif
diff --git a/lib/paging.c b/lib/paging.c
new file mode 100644 (file)
index 0000000..8fe80a9
--- /dev/null
@@ -0,0 +1,24 @@
+#include <minilib.h>
+#include <output.h>
+
+unsigned long memory_v2p(void *virt)
+{
+       unsigned long _virt = (unsigned long)virt;
+       
+       if (_virt >= 0xA0000 && _virt < 0xC0000)
+               return _virt;
+       if (_virt >= 0x200000 && _virt < 0x300000)
+               return _virt - 0x200000 + /* XXX */ 0x1FF80000;
+       outputf("WARNING: v2p(%08x)", _virt);
+       return 0xFFFFFFFF;
+}
+
+void *memory_p2v(unsigned long phys)
+{
+       if (phys >= 0xA0000 && phys < 0xC0000)
+               return (void*)phys;
+       if (phys >= 0x1FF80000 && phys < 0x20000000)
+               return (void*)(phys - 0x1FF80000 + 0x200000);
+       outputf("WARNING: p2v(%08x)", phys);
+       return (void *)0xFFFFFFFF;
+}
index 336e2a705ddca35b5d64581d145a55993a986c66..83a30efc67c8a4efad12655b40ccb467b3f0f589 100644 (file)
@@ -45,6 +45,7 @@
 #include <pci-bother.h>
 #include <minilib.h>
 #include <output.h>
 #include <pci-bother.h>
 #include <minilib.h>
 #include <output.h>
+#include <paging.h>
 
 #define        XCVR_MAGIC      (0x5A00)
 /** any single transmission fails after 16 collisions or other errors
 
 #define        XCVR_MAGIC      (0x5A00)
 /** any single transmission fails after 16 collisions or other errors
index 2d8d98fb47efb3ad40588810a44988a29bb75c1a..b72885bce707f78eb0f3d2b48ceef2dad492ce13 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _ETHERBOOT_COMPAT_H
 #define _ETHERBOOT_COMPAT_H
 
 #ifndef _ETHERBOOT_COMPAT_H
 #define _ETHERBOOT_COMPAT_H
 
+#include <paging.h>
+
 #define ETH_ALEN       6
 
 struct dev {
 #define ETH_ALEN       6
 
 struct dev {
@@ -18,6 +20,6 @@ struct nic {
        void (*transmit) (const char *dest_addr, unsigned int proto, unsigned int size, const char *pkt);
 };
 
        void (*transmit) (const char *dest_addr, unsigned int proto, unsigned int size, const char *pkt);
 };
 
-#define virt_to_bus(x) ((unsigned long)x)
+#define virt_to_bus(x) memory_v2p((void *)(x))
 
 #endif
 
 #endif
This page took 0.029717 seconds and 4 git commands to generate.