From 87b4931235dcdd3f74c28a6386ff7d1daf88c716 Mon Sep 17 00:00:00 2001 From: turbocat Date: Mon, 27 Dec 2021 20:10:59 +0000 Subject: [PATCH] Geode (a5536) driver added to autobuild. git-svn-id: svn://kolibrios.org@9503 a494cfbc-eb01-0410-851d-a64ba20cac60 --- drivers/audio/a5536/Tupfile.lua | 21 ++++++++++++++++-- drivers/audio/a5536/driver.lds | 2 -- drivers/audio/a5536/geode.asm | 2 +- drivers/audio/a5536/geode.bat | 3 --- drivers/audio/a5536/geode.c | 10 ++------- drivers/audio/a5536/makefile | 39 --------------------------------- drivers/audio/a5536/pci.h | 7 ++++++ 7 files changed, 29 insertions(+), 55 deletions(-) delete mode 100644 drivers/audio/a5536/geode.bat delete mode 100644 drivers/audio/a5536/makefile diff --git a/drivers/audio/a5536/Tupfile.lua b/drivers/audio/a5536/Tupfile.lua index 3be1457cab..f4a6b03968 100644 --- a/drivers/audio/a5536/Tupfile.lua +++ b/drivers/audio/a5536/Tupfile.lua @@ -1,2 +1,19 @@ -if tup.getconfig("NO_FASM") ~= "" then return end -tup.rule("geode.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "geode") \ No newline at end of file +if tup.getconfig("NO_FASM") ~= "" then return end +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") diff --git a/drivers/audio/a5536/driver.lds b/drivers/audio/a5536/driver.lds index 8bb43eefae..d7c2c0c69e 100644 --- a/drivers/audio/a5536/driver.lds +++ b/drivers/audio/a5536/driver.lds @@ -1,5 +1,3 @@ - - OUTPUT_FORMAT(pei-i386) ENTRY("_drvEntry") diff --git a/drivers/audio/a5536/geode.asm b/drivers/audio/a5536/geode.asm index c180ba7e2d..b1aa1d8e02 100644 --- a/drivers/audio/a5536/geode.asm +++ b/drivers/audio/a5536/geode.asm @@ -9,7 +9,7 @@ start: inc eax cmp [eax], byte 0 jne @b - mov [eax], dword '.drv' + mov [eax], dword '.sys' ;------ writing some info mov edx, info_msg diff --git a/drivers/audio/a5536/geode.bat b/drivers/audio/a5536/geode.bat deleted file mode 100644 index 7ec2ec5f3b..0000000000 --- a/drivers/audio/a5536/geode.bat +++ /dev/null @@ -1,3 +0,0 @@ -del geode.dll -make -@pause diff --git a/drivers/audio/a5536/geode.c b/drivers/audio/a5536/geode.c index 7cb0f60dae..b91a2a21e5 100644 --- a/drivers/audio/a5536/geode.c +++ b/drivers/audio/a5536/geode.c @@ -475,9 +475,9 @@ u32_t drvEntry(int action, char *cmdline) if(action != 1) 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; } @@ -490,13 +490,9 @@ u32_t drvEntry(int action, char *cmdline) }; init_device(); - retval = RegService("SOUND", srv_sound); - AttachIntHandler(geode.irq_line, snd_interrupt, 0); - DBG("reg service %s as: %x\n", "SOUND", retval); - return retval; }; @@ -563,5 +559,3 @@ int __stdcall srv_sound(ioctl_t *io) }; return ERR_PARAM; } - - diff --git a/drivers/audio/a5536/makefile b/drivers/audio/a5536/makefile deleted file mode 100644 index 41a2fcaa60..0000000000 --- a/drivers/audio/a5536/makefile +++ /dev/null @@ -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 - - - diff --git a/drivers/audio/a5536/pci.h b/drivers/audio/a5536/pci.h index 169deffd65..f6df05b096 100644 --- a/drivers/audio/a5536/pci.h +++ b/drivers/audio/a5536/pci.h @@ -1,5 +1,10 @@ +#ifndef _GEODE_PCI_ +#define _GEODE_PCI_ typedef int Bool; +typedef unsigned char u8_t; +typedef unsigned short u16_t; +typedef unsigned int u32_t; #define TRUE 1 #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 for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d))!=-1) + +#endif // _GEODE_PCI_