Geode (a5536) driver added to autobuild.

git-svn-id: svn://kolibrios.org@9503 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2021-12-27 20:10:59 +00:00
parent 3ad8304629
commit 87b4931235
7 changed files with 29 additions and 55 deletions

View File

@ -1,2 +1,19 @@
if tup.getconfig("NO_FASM") ~= "" then return end if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("geode.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "geode") if tup.getconfig("NO_GCC") ~= "" then return end
tup.include("../../../programs/use_gcc.lua")
DRV_DIR = "../.."
INCLUDES = string.format(" -I. -I. -I%s/include -I%s/include/linux -I%s/include/uapi ", DRV_DIR, DRV_DIR, DRV_DIR)
DEFINES = [[ -D__KERNEL__ -DGEODE_LOG="\"/tmp0/1/geode.log"\" -DCONFIG_X86_32 -DCONFIG_X86_L1_CACHE_SHIFT=6 -DCONFIG_ARCH_HAS_CACHE_LINE_SIZE -DCONFIG_PRINTK -DCONFIG_PCI ]]
CFLAGS = " -Os -fomit-frame-pointer -fno-builtin-printf " .. DEFINES
LDFLAGS = " -nostdlib -shared -s --image-base 0 --file-alignment 512 --section-alignment 4096 -L../../ddk "
NAME = "geode.sys"
compile_gcc{ "geode.c" }
OBJS.extra_inputs = {"../../ddk/libcore.a", "../../ddk/libddk.a"}
LIBS = " -lddk -lcore "
tup.rule(OBJS, "kos32-ld" .. LDFLAGS .. "%f -o %o " .. LIBS .. tup.getconfig("KPACK_CMD"), NAME);
tup.rule("geode.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "geode")

View File

@ -1,5 +1,3 @@
OUTPUT_FORMAT(pei-i386) OUTPUT_FORMAT(pei-i386)
ENTRY("_drvEntry") ENTRY("_drvEntry")

View File

@ -9,7 +9,7 @@ start:
inc eax inc eax
cmp [eax], byte 0 cmp [eax], byte 0
jne @b jne @b
mov [eax], dword '.drv' mov [eax], dword '.sys'
;------ writing some info ;------ writing some info
mov edx, info_msg mov edx, info_msg

View File

@ -1,3 +0,0 @@
del geode.dll
make
@pause

View File

@ -475,9 +475,9 @@ u32_t drvEntry(int action, char *cmdline)
if(action != 1) if(action != 1)
return 0; return 0;
if(!dbg_open("/rd/1/drivers/geode.log")) if(!dbg_open(GEODE_LOG))
{ {
printf("Can't open /rd/1/drivers/geode.log\nExit\n"); printf("Can't open %s\nExit\n", GEODE_LOG);
return 0; return 0;
} }
@ -490,13 +490,9 @@ u32_t drvEntry(int action, char *cmdline)
}; };
init_device(); init_device();
retval = RegService("SOUND", srv_sound); retval = RegService("SOUND", srv_sound);
AttachIntHandler(geode.irq_line, snd_interrupt, 0); AttachIntHandler(geode.irq_line, snd_interrupt, 0);
DBG("reg service %s as: %x\n", "SOUND", retval); DBG("reg service %s as: %x\n", "SOUND", retval);
return retval; return retval;
}; };
@ -563,5 +559,3 @@ int __stdcall srv_sound(ioctl_t *io)
}; };
return ERR_PARAM; return ERR_PARAM;
} }

View File

@ -1,39 +0,0 @@
CC = gcc
FASM = e:/fasm/fasm.exe
CFLAGS = -c -O2 -fomit-frame-pointer -fno-builtin-printf
LDFLAGS = -nostdlib -shared -s -Map geode.map --image-base 0\
--file-alignment 512 --section-alignment 4096
DEFINES = -D__KERNEL__ -DCONFIG_X86_32
DRV_TOPDIR = $(CURDIR)/../..
DRV_INCLUDES = $(DRV_TOPDIR)/include
INCLUDES = -I$(DRV_INCLUDES) \
-I$(DRV_INCLUDES)/linux
LIBPATH = $(DRV_TOPDIR)/ddk
LIBS:= -lddk -lcore
HFILES:= geode.h
SRC_DEP:=
GEODE_SRC:= amd_geode.h
NAME:= geode
GEODE:= geode.dll
all: $(GEODE)
$(GEODE): geode.obj $(SRC_DEP) $(HFILES) Makefile
ld $(LDFLAGS) -L$(LIBPATH) -T driver.lds -o $@ geode.obj $(LIBS)
kpack.exe geode.dll geode.drv
geode.obj : geode.c $(SRC_DEP) $(HFILES) Makefile
$(CC) $(DEFINES) $(INCLUDES) $(CFLAGS) -o geode.obj geode.c

View File

@ -1,5 +1,10 @@
#ifndef _GEODE_PCI_
#define _GEODE_PCI_
typedef int Bool; typedef int Bool;
typedef unsigned char u8_t;
typedef unsigned short u16_t;
typedef unsigned int u32_t;
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
@ -184,3 +189,5 @@ u32_t pciGetBaseSize(int bus, int devfn, int index, Bool destructive, Bool *min)
#define PCI_ANY_ID (~0) #define PCI_ANY_ID (~0)
#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d))!=-1) #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d))!=-1)
#endif // _GEODE_PCI_