Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2187 → Rev 2186

/drivers/devman/acpica/osunixxf.c
702,7 → 702,7
ACPI_OSD_HANDLER ServiceRoutine,
void *Context)
{
dbgprintf("%s irq %d\n", InterruptNumber );
 
return (AE_OK);
}
 
995,8 → 995,6
return (AE_BAD_PARAMETER);
}
 
dbgprintf("%s %x, %x\n",__FUNCTION__, Address, *Value);
 
return (AE_OK);
}
 
1039,8 → 1037,6
return (AE_ERROR);
}
 
dbgprintf("%s %x, %x\n",__FUNCTION__, Address, Value);
 
return (AE_OK);
};
 
1064,40 → 1060,10
UINT32 *Value,
UINT32 Width)
{
void *memptr;
ACPI_STATUS status = AE_ERROR;
 
dbgprintf("%s %x\n",__FUNCTION__, Address);
if( Address > 0x400000)
return (AE_BAD_PARAMETER);
 
if( Address >= 0x400000)
{
memptr = AcpiOsMapMemory(Address, Width);
 
if(memptr)
{
status = AE_OK;
 
switch (Width)
{
case 8:
*Value = *(UINT8*)Address;
break;
 
case 16:
*Value = *(UINT16*)Address;
break;
 
case 32:
*Value = *(UINT32*)Address;
break;
 
default:
status = (AE_BAD_PARAMETER);
}
FreeKernelSpace(memptr);
}
return status;
}
else
Address+= 0x80000000;
 
1104,13 → 1070,7
switch (Width)
{
case 8:
*Value = *(UINT8*)Address;
break;
 
case 16:
*Value = *(UINT16*)Address;
break;
 
case 32:
*Value = *(UINT32*)Address;
break;
1143,40 → 1103,9
UINT32 Width)
{
 
void *memptr;
ACPI_STATUS status = AE_ERROR;
if( Address > 0x400000)
return (AE_BAD_PARAMETER);
 
dbgprintf("%s %x, %x\n",__FUNCTION__, Address, Value);
 
if( Address >= 0x400000)
{
memptr = AcpiOsMapMemory(Address, Width);
 
if(memptr)
{
status = AE_OK;
 
switch (Width)
{
case 8:
*(UINT8*)Address = (UINT8)Value;
break;
 
case 16:
*(UINT16*)Address = (UINT16)Value;
break;
 
case 32:
*(UINT32*)Address = Value;
break;
 
default:
status = (AE_BAD_PARAMETER);
}
FreeKernelSpace(memptr);
}
return status;
}
else
Address+= 0x80000000;
 
1183,13 → 1112,7
switch (Width)
{
case 8:
*(UINT8*)Address = (UINT8)Value;
break;
 
case 16:
*(UINT16*)Address = (UINT16)Value;
break;
 
case 32:
*(UINT32*)Address = Value;
break;
/drivers/devman/pci/probe.c
3,7 → 3,6
#include <linux/errno.h>
#include <mutex.h>
#include <pci.h>
#include <list.h>
#include <syscall.h>
 
LIST_HEAD(pci_root_buses);
/drivers/devman/pci/pci.c
5,7 → 5,6
#include <pci.h>
#include <syscall.h>
 
extern struct list_head pci_root_buses;
 
#define IO_SPACE_LIMIT 0xffff
#define PCIBIOS_SUCCESSFUL 0x00
/drivers/devman/Makefile
1,11 → 1,9
 
 
CC = gcc
FASM = e:/fasm/fasm.exe
 
CFLAGS = -c -O2 -fomit-frame-pointer -fno-builtin-printf
 
 
DRV_DIR = $(CURDIR)/..
 
DRV_INCLUDES = $(DRV_DIR)/include
/drivers/devman/acpi.c
90,9 → 90,7
 
static void print_dm_list();
 
int write_device_dat(char *path);
 
 
static void set_pic_mode(enum pic_mode mode)
{
ACPI_OBJECT arg1;
115,6 → 113,10
 
 
 
 
 
 
 
static bool pci_use_crs = false;
 
#define IORESOURCE_BUS 0x00001000
261,6 → 263,7
struct acpi_resource_address64 addr;
ACPI_STATUS status;
unsigned long flags;
struct resource *root, *conflict;
u64 start, end;
 
status = resource_to_addr(acpi_res, &addr);
269,6 → 272,7
 
if (addr.ResourceType == ACPI_MEMORY_RANGE)
{
root = &iomem_resource;
flags = IORESOURCE_MEM;
if (addr.Info.Mem.Caching == ACPI_PREFETCHABLE_MEMORY)
flags |= IORESOURCE_PREFETCH;
275,6 → 279,7
}
else if (addr.ResourceType == ACPI_IO_RANGE)
{
root = &ioport_resource;
flags = IORESOURCE_IO;
} else
return AE_OK;
294,17 → 299,27
return AE_OK;
}
 
#if 0
conflict = insert_resource_conflict(root, res);
if (conflict) {
dev_err(&info->bridge->dev,
"address space collision: host bridge window %pR "
"conflicts with %s %pR\n",
res, conflict->name, conflict);
} else {
pci_bus_add_resource(info->bus, res, 0);
info->res_num++;
if (addr.TranslationOffset)
dev_info(NULL, "host bridge window %pR "
if (addr.translation_offset)
dev_info(&info->bridge->dev, "host bridge window %pR "
"(PCI address [%#llx-%#llx])\n",
res, res->start - addr.TranslationOffset,
res->end - addr.TranslationOffset);
res, res->start - addr.translation_offset,
res->end - addr.translation_offset);
else
dev_info(NULL,
dev_info(&info->bridge->dev,
"host bridge window %pR\n", res);
 
}
return AE_OK;
#endif
}
 
 
353,6 → 368,8
}
 
 
 
 
struct pci_ops pci_root_ops = {
.read = NULL,
.write = NULL,
375,7 → 392,6
return NULL;
}
 
node = -1;
/* Allocate per-root-bus (not per bus) arch-specific data.
* TODO: leak; this memory is never freed.
* It's arguable whether it's worth the trouble to care.
616,7 → 632,7
 
// u32_t mode = ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE;
 
status = AcpiEnableSubsystem(ACPI_NO_HANDLER_INIT | ACPI_NO_HARDWARE_INIT);
status = AcpiEnableSubsystem(0);
if (status != AE_OK) {
dbgprintf("AcpiEnableSubsystem failed (%s)\n",
AcpiFormatException(status));
623,7 → 639,7
goto err;
}
 
status = AcpiInitializeObjects (ACPI_FULL_INITIALIZATION);
status = AcpiInitializeObjects (0);
if (ACPI_FAILURE (status))
{
dbgprintf("AcpiInitializeObjects failed (%s)\n",
644,8 → 660,6
 
print_dm_list();
 
write_device_dat("/RD/1/DRIVERS/DEVICES.DAT");
 
err:
 
return 0;
907,137 → 921,3
};
 
 
typedef struct
{
uint32_t busaddr;
uint32_t devid;
uint32_t irq;
uint32_t unused;
}devinfo_t;
 
#pragma pack(push, 1)
typedef struct
{
char sec;
char min;
char hour;
char rsv;
}detime_t;
 
typedef struct
{
char day;
char month;
short year;
}dedate_t;
 
typedef struct
{
unsigned attr;
unsigned flags;
union
{
detime_t ctime;
unsigned cr_time;
};
union
{
dedate_t cdate;
unsigned cr_date;
};
union
{
detime_t atime;
unsigned acc_time;
};
union
{
dedate_t adate;
unsigned acc_date;
};
union
{
detime_t mtime;
unsigned mod_time;
};
union
{
dedate_t mdate;
unsigned mod_date;
};
unsigned size;
unsigned size_high;
} FILEINFO;
 
#pragma pack(pop)
 
 
int write_device_dat(char *path)
{
struct pci_dev *pcidev;
dmdev_t *dmdev;
devinfo_t *data;
int writes;
int len;
int i = 0;
 
list_for_each_entry(dmdev, &dmdev_tree, list)
{
if(dmdev->type ==1)
{
if(dmdev->pci_dev != NULL)
{
pcidev = dmdev->pci_dev;
if(pcidev->pin)
i++;
};
};
};
 
len = sizeof(devinfo_t)*i + 4;
data = (devinfo_t*)malloc(len);
 
i = 0;
 
list_for_each_entry(dmdev, &dmdev_tree, list)
{
if(dmdev->type == 1)
{
 
if(dmdev->pci_dev != NULL)
{
pcidev = dmdev->pci_dev;
if(pcidev->pin && (acpi_get_irq(pcidev) != -1) )
{
data[i].busaddr = (pcidev->busnr<<8)|pcidev->devfn;
data[i].devid = ((uint32_t)pcidev->device<<16) |
pcidev->vendor;
data[i].irq = acpi_get_irq(pcidev);
data[i].unused = 0;
i++;
}
};
};
};
 
data[i].busaddr = -1;
 
FILEINFO info;
 
int offset = 0;
 
if(get_fileinfo(path,&info))
{
if( create_file(path))
{
free(data);
return false;
}
}
else
set_file_size(path, 0);
 
write_file(path, data, 0, len, &writes);
 
return true;
};