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; |
}; |