Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2176 → Rev 2187

/drivers/devman/Makefile
1,9 → 1,11
 
 
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,7 → 90,9
 
static void print_dm_list();
 
int write_device_dat(char *path);
 
 
static void set_pic_mode(enum pic_mode mode)
{
ACPI_OBJECT arg1;
113,10 → 115,6
 
 
 
 
 
 
 
static bool pci_use_crs = false;
 
#define IORESOURCE_BUS 0x00001000
263,7 → 261,6
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);
272,7 → 269,6
 
if (addr.ResourceType == ACPI_MEMORY_RANGE)
{
root = &iomem_resource;
flags = IORESOURCE_MEM;
if (addr.Info.Mem.Caching == ACPI_PREFETCHABLE_MEMORY)
flags |= IORESOURCE_PREFETCH;
279,7 → 275,6
}
else if (addr.ResourceType == ACPI_IO_RANGE)
{
root = &ioport_resource;
flags = IORESOURCE_IO;
} else
return AE_OK;
299,27 → 294,17
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.translation_offset)
dev_info(&info->bridge->dev, "host bridge window %pR "
if (addr.TranslationOffset)
dev_info(NULL, "host bridge window %pR "
"(PCI address [%#llx-%#llx])\n",
res, res->start - addr.translation_offset,
res->end - addr.translation_offset);
res, res->start - addr.TranslationOffset,
res->end - addr.TranslationOffset);
else
dev_info(&info->bridge->dev,
dev_info(NULL,
"host bridge window %pR\n", res);
}
 
return AE_OK;
#endif
}
 
 
368,8 → 353,6
}
 
 
 
 
struct pci_ops pci_root_ops = {
.read = NULL,
.write = NULL,
392,6 → 375,7
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.
632,7 → 616,7
 
// u32_t mode = ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE;
 
status = AcpiEnableSubsystem(0);
status = AcpiEnableSubsystem(ACPI_NO_HANDLER_INIT | ACPI_NO_HARDWARE_INIT);
if (status != AE_OK) {
dbgprintf("AcpiEnableSubsystem failed (%s)\n",
AcpiFormatException(status));
639,7 → 623,7
goto err;
}
 
status = AcpiInitializeObjects (0);
status = AcpiInitializeObjects (ACPI_FULL_INITIALIZATION);
if (ACPI_FAILURE (status))
{
dbgprintf("AcpiInitializeObjects failed (%s)\n",
660,6 → 644,8
 
print_dm_list();
 
write_device_dat("/RD/1/DRIVERS/DEVICES.DAT");
 
err:
 
return 0;
921,3 → 907,137
};
 
 
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;
};
/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,6 → 995,8
return (AE_BAD_PARAMETER);
}
 
dbgprintf("%s %x, %x\n",__FUNCTION__, Address, *Value);
 
return (AE_OK);
}
 
1037,6 → 1039,8
return (AE_ERROR);
}
 
dbgprintf("%s %x, %x\n",__FUNCTION__, Address, Value);
 
return (AE_OK);
};
 
1060,10 → 1064,40
UINT32 *Value,
UINT32 Width)
{
void *memptr;
ACPI_STATUS status = AE_ERROR;
 
if( Address > 0x400000)
return (AE_BAD_PARAMETER);
dbgprintf("%s %x\n",__FUNCTION__, Address);
 
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;
 
1070,7 → 1104,13
switch (Width)
{
case 8:
*Value = *(UINT8*)Address;
break;
 
case 16:
*Value = *(UINT16*)Address;
break;
 
case 32:
*Value = *(UINT32*)Address;
break;
1103,9 → 1143,40
UINT32 Width)
{
 
if( Address > 0x400000)
return (AE_BAD_PARAMETER);
void *memptr;
ACPI_STATUS status = AE_ERROR;
 
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;
 
1112,7 → 1183,13
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/pci.c
5,6 → 5,7
#include <pci.h>
#include <syscall.h>
 
extern struct list_head pci_root_buses;
 
#define IO_SPACE_LIMIT 0xffff
#define PCIBIOS_SUCCESSFUL 0x00
/drivers/devman/pci/probe.c
3,6 → 3,7
#include <linux/errno.h>
#include <mutex.h>
#include <pci.h>
#include <list.h>
#include <syscall.h>
 
LIST_HEAD(pci_root_buses);