Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 9498 → Rev 9499

/drivers/devman/Makefile
1,56 → 1,42
CC = kos32-gcc
LD = kos32-ld
KPACK = kpack
 
CFLAGS = -c -w -O2 -fomit-frame-pointer -fno-builtin-printf
 
CC = gcc
FASM = e:/fasm/fasm.exe
 
CFLAGS = -c -O2 -fomit-frame-pointer -fno-builtin-printf
 
 
DRV_DIR = $(CURDIR)/..
INCLUDES = -I$(DRV_DIR)/devman/acpica/include -I$(DRV_DIR)/devman -I$(DRV_DIR)/include/linux -I$(DRV_DIR)/include -I$(DRV_DIR)/include/uapi
 
DRV_INCLUDES = $(DRV_DIR)/include
DEFINES = -D__KERNEL__ -DCONFIG_X86_32 -DCONFIG_X86_L1_CACHE_SHIFT=6 -DCONFIG_ARCH_HAS_CACHE_LINE_SIZE -DHAVE_ACPICA -DCONFIG_ACPI -DLINUX_MOD_DEVICETABLE_H -DCONFIG_PCI
 
ACPI_INCLUDES = ./acpica/include
LDFLAGS = -nostdlib -shared -s -Map acpi.map --image-base 0 --file-alignment 512 --section-alignment 4096
 
INCLUDES = -I$(DRV_INCLUDES) -I$(ACPI_INCLUDES) -I$(DRV_DIR)/include/linux
 
DEFINES = -D__KERNEL__ -DCONFIG_X86_32
 
LDFLAGS = -nostdlib -shared -s -Map acpi.map --image-base 0\
--file-alignment 512 --section-alignment 4096
 
LIBPATH:= -L$(DRV_DIR)/ddk -L./acpica
 
LIBPATH := -L$(DRV_DIR)/ddk -L../devman/acpica -L../../contrib/sdk/lib
LIBS:= -lacpica -lgcc -lddk -lcore
 
NAME = acpi.sys
 
NAME= acpi
 
NAME_SRCS= acpi.c \
scan.c \
pci_root.c \
pci_bind.c \
pci_irq.c \
pci_root.c \
pci/access.c \
pci/probe.c \
pci/pci.c \
pci/probe.c \
pci_bind.c
pci/access.c
 
all: $(NAME)
 
all: $(NAME).dll
 
NAME_OBJS = $(patsubst %.S, %.o, $(patsubst %.asm, %.o,\
$(patsubst %.c, %.o, $(NAME_SRCS))))
 
 
$(NAME).dll: $(NAME_OBJS) acpi.lds Makefile
ld $(LIBPATH) $(LDFLAGS) -T acpi.lds -o $@ $(NAME_OBJS) $(LIBS)
kpack $(NAME).dll
$(NAME): $(NAME_OBJS) ../devman/acpi.lds Makefile
$(LD) $(LIBPATH) $(LDFLAGS) -T ../devman/acpi.lds -o $@ $(NAME_OBJS) $(LIBS)
$(KPACK) $(NAME)
 
%.o : %.c $(HFILES) Makefile
$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
 
%.o : %.S $(HFILES) Makefile
as -o $@ $<
 
 
 
clean:
rm -rf *.o
/drivers/devman/Tupfile.lua
0,0 → 1,21
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./include -I./acpica/include -I. -I%s/include -I%s/include/linux -I%s/include/uapi ", DRV_DIR, DRV_DIR, DRV_DIR)
 
DEFINES = " -D__KERNEL__ -DCONFIG_X86_32 -DCONFIG_X86_L1_CACHE_SHIFT=6 -DCONFIG_ARCH_HAS_CACHE_LINE_SIZE -DHAVE_ACPICA -DCONFIG_ACPI -DLINUX_MOD_DEVICETABLE_H -DCONFIG_PCI "
 
CFLAGS = " -w -Os -march=i686 -fno-ident -msse2 -fomit-frame-pointer -fno-builtin-printf -mno-stack-arg-probe -mpreferred-stack-boundary=2 -mincoming-stack-boundary=2 -mno-ms-bitfields " .. DEFINES
 
LDFLAGS = " -nostdlib -T acpi.lds -shared -s --image-base 0 --file-alignment 512 --section-alignment 4096 -L../../contrib/sdk/lib -L../ddk -Lacpica "
 
NAME = "acpi.sys"
 
compile_gcc{ "acpi.c", "scan.c", "pci_root.c", "pci_bind.c", "pci_irq.c", "pci/probe.c", "pci/pci.c", "pci/access.c" }
OBJS.extra_inputs = {"../ddk/libcore.a", "../ddk/libddk.a", "./acpica/libacpica.a"}
 
LIBS = " -lacpica -lgcc -lddk -lcore "
tup.rule(OBJS, "kos32-ld" .. LDFLAGS .. "%f -o %o " .. LIBS .. tup.getconfig("KPACK_CMD"), NAME);
tup.rule("acpi.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "acpi")
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/drivers/devman/acpi.asm
27,7 → 27,7
 
align 4
app_path rb 2048
sz_dll db '.dll',0
sz_dll db '.sys',0
i_end:
rb 128
mem:
/drivers/devman/acpi.c
571,27 → 571,18
 
};
 
 
u32_t drvEntry(int action, char *cmdline)
uint32_t drvEntry(int action, char *cmdline)
{
u32_t retval;
 
uint32_t retval;
ACPI_STATUS status;
 
int i;
 
if(action != 1)
return 0;
 
if( !dbg_open("/rd/1/drivers/acpi.log") )
{
printf("Can't open /rd/1/drivers/acpi.log\nExit\n");
return 0;
}
 
status = AcpiInitializeSubsystem();
if (status != AE_OK) {
dbgprintf("AcpiInitializeSubsystem failed (%s)\n",
printf("AcpiInitializeSubsystem failed (%s)\n",
AcpiFormatException(status));
goto err;
}
598,7 → 589,7
 
status = AcpiInitializeTables (NULL, 16, FALSE);
if (status != AE_OK) {
dbgprintf("AcpiInitializeTables failed (%s)\n",
printf("AcpiInitializeTables failed (%s)\n",
AcpiFormatException(status));
goto err;
}
605,7 → 596,7
 
status = AcpiLoadTables();
if (status != AE_OK) {
dbgprintf("AcpiLoadTables failed (%s)\n",
printf("AcpiLoadTables failed (%s)\n",
AcpiFormatException(status));
goto err;
}
627,25 → 618,17
goto err;
}
 
 
set_pic_mode(IO_APIC);
 
acpi_scan();
 
acpi_init_pci(acpi_root);
 
print_pci_irqs();
 
create_dm_list();
 
print_dm_list();
 
write_device_dat("/RD/1/DRIVERS/DEVICES.DAT");
 
err:
 
return 0;
 
};
 
char* strdup(const char *str)
699,7 → 682,6
return AE_OK;
}
 
 
static void dm_add_acpi(struct acpi_device *device)
{
struct acpi_device *child;
748,7 → 730,6
{
struct acpi_pci_root *root;
 
 
list_for_each_entry(root, &acpi_pci_roots, node)
{
struct pci_bus *pbus, *tbus;
/drivers/devman/pci/access.c
5,55 → 5,6
#include <pci.h>
#include <syscall.h>
 
 
int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val)
{
*val = PciRead8(dev->busnr, dev->devfn, where);
return 0;
}
 
int pci_read_config_word(struct pci_dev *dev, int where, u16 *val)
{
 
if ( where & 1)
return PCIBIOS_BAD_REGISTER_NUMBER;
*val = PciRead16(dev->busnr, dev->devfn, where);
return 0;
}
 
int pci_read_config_dword(struct pci_dev *dev, int where, u32 *val)
{
 
if ( where & 3)
return PCIBIOS_BAD_REGISTER_NUMBER;
*val = PciRead32(dev->busnr, dev->devfn, where);
return 0;
}
 
int pci_write_config_byte(struct pci_dev *dev, int where, u8 val)
{
PciWrite8(dev->busnr, dev->devfn, where, val);
return 0;
};
 
int pci_write_config_word(struct pci_dev *dev, int where, u16 val)
{
if ( where & 1)
return PCIBIOS_BAD_REGISTER_NUMBER;
PciWrite16(dev->busnr, dev->devfn, where, val);
return 0;
}
 
int pci_write_config_dword(struct pci_dev *dev, int where,
u32 val)
{
if ( where & 3)
return PCIBIOS_BAD_REGISTER_NUMBER;
PciWrite32(dev->busnr, dev->devfn, where, val);
return 0;
}
 
 
int pci_bus_read_config_byte (struct pci_bus *bus, u32 devfn,
int pos, u8 *value)
{
/drivers/devman/pci/pci.c
2,7 → 2,7
#include <ddk.h>
#include <linux/errno.h>
#include <mutex.h>
#include <pci.h>
#include <linux/pci.h>
#include <syscall.h>
 
extern struct list_head pci_root_buses;
/drivers/devman/pci/probe.c
18,22 → 18,11
#define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */
#define CARDBUS_RESERVE_BUSNR 3
 
static int pcibios_assign_all_busses(void)
int pcibios_assign_all_busses(void)
{
return 0;
};
 
/**
* pci_ari_enabled - query ARI forwarding status
* @bus: the PCI bus
*
* Returns 1 if ARI forwarding is enabled, or 0 if not enabled;
*/
static inline int pci_ari_enabled(struct pci_bus *bus)
{
return bus->self && bus->self->ari_enabled;
}
 
/*
* Translate the low bits of the PCI base
* to the resource type
632,7 → 621,7
pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
}
 
vsprintf(child->name,
sprintf(child->name,
(is_cardbus ? "PCI CardBus %04x:%02x" : "PCI Bus %04x:%02x"),
pci_domain_nr(bus), child->number);
 
669,7 → 658,7
pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
if (!pos)
return;
pdev->is_pcie = 1;
//pdev->is_pcie = 1;
pdev->pcie_cap = pos;
pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, &reg16);
pdev->pcie_type = (reg16 & PCI_EXP_FLAGS_TYPE) >> 4;
1062,7 → 1051,7
pci_scan_slot(bus, devfn);
 
/* Reserve buses for SR-IOV capability. */
max += pci_iov_bus_range(bus);
//max += pci_iov_bus_range(bus);
 
/*
* After performing arch-dependent fixup of the bus, look behind
/drivers/devman/scan.c
784,4 → 784,3
 
return err;
};