Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 38 additions & 25 deletions arch/loongarch/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,36 +510,49 @@ static int __init add_legacy_isa_io(struct fwnode_handle *fwnode,
static __init int arch_reserve_pio_range(void)
{
struct device_node *np;
struct fwnode_handle *fwnode;

for_each_node_by_name(np, "isa") {
struct of_range range;
struct of_range_parser parser;
if (acpi_disabled) {
for_each_node_by_name(np, "isa") {
struct of_range range;
struct of_range_parser parser;

pr_info("ISA Bridge: %pOF\n", np);
pr_info("ISA Bridge: %pOF\n", np);

if (of_range_parser_init(&parser, np)) {
pr_info("Failed to parse resources.\n");
of_node_put(np);
break;
}

for_each_of_range(&parser, &range) {
switch (range.flags & IORESOURCE_TYPE_BITS) {
case IORESOURCE_IO:
pr_info(" IO 0x%016llx..0x%016llx -> 0x%016llx\n",
range.cpu_addr,
range.cpu_addr + range.size - 1,
range.bus_addr);
if (add_legacy_isa_io(&np->fwnode, range.cpu_addr, range.size))
pr_warn("Failed to reserve legacy IO in Logic PIO\n");
break;
case IORESOURCE_MEM:
pr_info(" MEM 0x%016llx..0x%016llx -> 0x%016llx\n",
range.cpu_addr,
range.cpu_addr + range.size - 1,
range.bus_addr);
if (of_range_parser_init(&parser, np)) {
pr_info("Failed to parse resources.\n");
of_node_put(np);
break;
}

for_each_of_range(&parser, &range) {
switch (range.flags & IORESOURCE_TYPE_BITS) {
case IORESOURCE_IO:
pr_info(" IO 0x%016llx..0x%016llx -> 0x%016llx\n",
range.cpu_addr,
range.cpu_addr + range.size - 1,
range.bus_addr);
if (add_legacy_isa_io(&np->fwnode, range.cpu_addr, range.size))
pr_warn("Failed to reserve legacy IO in Logic PIO\n");
break;
case IORESOURCE_MEM:
pr_info(" MEM 0x%016llx..0x%016llx -> 0x%016llx\n",
range.cpu_addr,
range.cpu_addr + range.size - 1,
range.bus_addr);
break;
}
}
}
} else {
fwnode = acpi_alloc_fwnode_static();
if (!fwnode) {
pr_warn("Failed to allocate fwnode for legacy ISA\n");
return 0;
}
if (add_legacy_isa_io(fwnode, LOONGSON_LIO_BASE, ISA_IOSIZE)) {
Copy link

@xry111 xry111 Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this patch can be merged as-is.

Both 7A1000 and 7A2000 manuals state that 0x18000000-0x1800ffff (64K) is for "LPC I/O", but this patch reserves 0x18000000-0x18003fff (16K). The only reference I can find about this 16K range is the 2K1000 ISA controller which is obviously unrelated to any desktop platform. The macro name ("ISA_IOSIZE") also seems something for 2K1000 now.

We need some detailed analysis of the issue and maybe some research on the ACPI specification.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, a fast search for ISA_IOSIZE shows that this marco was introduced in initial commits for LoongArch support at torvalds@7153c3c

It didn't explain why this marco should be 16K rather than 64K. Additionally, ISA_IOSIZE is also used in loongnix's patch for this issue. I agree that this issue needs more analysis :)

pr_warn("Failed to reserve legacy IO in Logic PIO\n");
acpi_free_fwnode_static(fwnode);
}
}

Expand Down