aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2018-01-31 11:12:56 -0500
committerBjorn Helgaas <helgaas@kernel.org>2018-01-31 11:12:56 -0500
commit414ae7609e19580a56647344e61f13f3768e0820 (patch)
treef4a2e50f589d459406e5c1dae1cb06b8f4668b03
parent11377725da463951cd501f5cecce30af999ee338 (diff)
parenta9b94b74806b47348727aa3334a0541427e0061b (diff)
Merge branch 'pci/resource' into next
* pci/resource: PCI: tegra: Remove PCI_REASSIGN_ALL_BUS use on Tegra resource: Set type when reserving new regions resource: Set type of "reserve=" user-specified resources irqchip/i8259: Set I/O port resource types correctly powerpc: Set I/O port resource types correctly MIPS: Set I/O port resource types correctly vgacon: Set VGA struct resource types PCI: Use dev_info() rather than dev_err() for ROM validation PCI: Remove PCI_REASSIGN_ALL_RSRC use on arm and arm64 PCI: Remove sysfs resource mmap warning Conflicts: drivers/pci/rom.c
-rw-r--r--Documentation/admin-guide/kernel-parameters.txt6
-rw-r--r--arch/alpha/kernel/console.c1
-rw-r--r--arch/arm/include/asm/pci.h5
-rw-r--r--arch/arm/kernel/bios32.c2
-rw-r--r--arch/mips/jazz/setup.c8
-rw-r--r--arch/mips/mti-malta/malta-setup.c10
-rw-r--r--arch/powerpc/platforms/maple/time.c2
-rw-r--r--arch/powerpc/sysdev/i8259.c6
-rw-r--r--drivers/irqchip/irq-i8259.c4
-rw-r--r--drivers/pci/host/pci-host-common.c2
-rw-r--r--drivers/pci/host/pci-tegra.c1
-rw-r--r--drivers/pci/host/pci-versatile.c2
-rw-r--r--drivers/pci/host/pcie-rcar.c2
-rw-r--r--drivers/pci/pci-sysfs.c9
-rw-r--r--drivers/pci/rom.c8
-rw-r--r--drivers/video/console/vgacon.c34
-rw-r--r--kernel/resource.c29
17 files changed, 79 insertions, 52 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 6571fbfdb2a1..78cdf6a637fc 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3675,7 +3675,11 @@
3675 [KNL, SMP] Set scheduler's default relax_domain_level. 3675 [KNL, SMP] Set scheduler's default relax_domain_level.
3676 See Documentation/cgroup-v1/cpusets.txt. 3676 See Documentation/cgroup-v1/cpusets.txt.
3677 3677
3678 reserve= [KNL,BUGS] Force the kernel to ignore some iomem area 3678 reserve= [KNL,BUGS] Force kernel to ignore I/O ports or memory
3679 Format: <base1>,<size1>[,<base2>,<size2>,...]
3680 Reserve I/O ports or memory so the kernel won't use
3681 them. If <base> is less than 0x10000, the region
3682 is assumed to be I/O ports; otherwise it is memory.
3679 3683
3680 reservetop= [X86-32] 3684 reservetop= [X86-32]
3681 Format: nn[KMG] 3685 Format: nn[KMG]
diff --git a/arch/alpha/kernel/console.c b/arch/alpha/kernel/console.c
index 8e9a41966881..5476279329a6 100644
--- a/arch/alpha/kernel/console.c
+++ b/arch/alpha/kernel/console.c
@@ -21,6 +21,7 @@
21struct pci_controller *pci_vga_hose; 21struct pci_controller *pci_vga_hose;
22static struct resource alpha_vga = { 22static struct resource alpha_vga = {
23 .name = "alpha-vga+", 23 .name = "alpha-vga+",
24 .flags = IORESOURCE_IO,
24 .start = 0x3C0, 25 .start = 0x3C0,
25 .end = 0x3DF 26 .end = 0x3DF
26}; 27};
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h
index 960d9dc4f380..1f0de808d111 100644
--- a/arch/arm/include/asm/pci.h
+++ b/arch/arm/include/asm/pci.h
@@ -10,10 +10,7 @@ extern unsigned long pcibios_min_io;
10extern unsigned long pcibios_min_mem; 10extern unsigned long pcibios_min_mem;
11#define PCIBIOS_MIN_MEM pcibios_min_mem 11#define PCIBIOS_MIN_MEM pcibios_min_mem
12 12
13static inline int pcibios_assign_all_busses(void) 13#define pcibios_assign_all_busses() pci_has_flag(PCI_REASSIGN_ALL_BUS)
14{
15 return pci_has_flag(PCI_REASSIGN_ALL_RSRC);
16}
17 14
18#ifdef CONFIG_PCI_DOMAINS 15#ifdef CONFIG_PCI_DOMAINS
19static inline int pci_proc_domain(struct pci_bus *bus) 16static inline int pci_proc_domain(struct pci_bus *bus)
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 0cd0aefb3a8f..ed46ca69813d 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -527,7 +527,7 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw)
527 struct pci_sys_data *sys; 527 struct pci_sys_data *sys;
528 LIST_HEAD(head); 528 LIST_HEAD(head);
529 529
530 pci_add_flags(PCI_REASSIGN_ALL_RSRC); 530 pci_add_flags(PCI_REASSIGN_ALL_BUS);
531 if (hw->preinit) 531 if (hw->preinit)
532 hw->preinit(); 532 hw->preinit();
533 pcibios_init_hw(parent, hw, &head); 533 pcibios_init_hw(parent, hw, &head);
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
index e4374a5651ce..448fd41792e4 100644
--- a/arch/mips/jazz/setup.c
+++ b/arch/mips/jazz/setup.c
@@ -32,22 +32,22 @@ static struct resource jazz_io_resources[] = {
32 .start = 0x00, 32 .start = 0x00,
33 .end = 0x1f, 33 .end = 0x1f,
34 .name = "dma1", 34 .name = "dma1",
35 .flags = IORESOURCE_BUSY 35 .flags = IORESOURCE_IO | IORESOURCE_BUSY
36 }, { 36 }, {
37 .start = 0x40, 37 .start = 0x40,
38 .end = 0x5f, 38 .end = 0x5f,
39 .name = "timer", 39 .name = "timer",
40 .flags = IORESOURCE_BUSY 40 .flags = IORESOURCE_IO | IORESOURCE_BUSY
41 }, { 41 }, {
42 .start = 0x80, 42 .start = 0x80,
43 .end = 0x8f, 43 .end = 0x8f,
44 .name = "dma page reg", 44 .name = "dma page reg",
45 .flags = IORESOURCE_BUSY 45 .flags = IORESOURCE_IO | IORESOURCE_BUSY
46 }, { 46 }, {
47 .start = 0xc0, 47 .start = 0xc0,
48 .end = 0xdf, 48 .end = 0xdf,
49 .name = "dma2", 49 .name = "dma2",
50 .flags = IORESOURCE_BUSY 50 .flags = IORESOURCE_IO | IORESOURCE_BUSY
51 } 51 }
52}; 52};
53 53
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
index de34adb76157..7b63914d2e58 100644
--- a/arch/mips/mti-malta/malta-setup.c
+++ b/arch/mips/mti-malta/malta-setup.c
@@ -47,31 +47,31 @@ static struct resource standard_io_resources[] = {
47 .name = "dma1", 47 .name = "dma1",
48 .start = 0x00, 48 .start = 0x00,
49 .end = 0x1f, 49 .end = 0x1f,
50 .flags = IORESOURCE_BUSY 50 .flags = IORESOURCE_IO | IORESOURCE_BUSY
51 }, 51 },
52 { 52 {
53 .name = "timer", 53 .name = "timer",
54 .start = 0x40, 54 .start = 0x40,
55 .end = 0x5f, 55 .end = 0x5f,
56 .flags = IORESOURCE_BUSY 56 .flags = IORESOURCE_IO | IORESOURCE_BUSY
57 }, 57 },
58 { 58 {
59 .name = "keyboard", 59 .name = "keyboard",
60 .start = 0x60, 60 .start = 0x60,
61 .end = 0x6f, 61 .end = 0x6f,
62 .flags = IORESOURCE_BUSY 62 .flags = IORESOURCE_IO | IORESOURCE_BUSY
63 }, 63 },
64 { 64 {
65 .name = "dma page reg", 65 .name = "dma page reg",
66 .start = 0x80, 66 .start = 0x80,
67 .end = 0x8f, 67 .end = 0x8f,
68 .flags = IORESOURCE_BUSY 68 .flags = IORESOURCE_IO | IORESOURCE_BUSY
69 }, 69 },
70 { 70 {
71 .name = "dma2", 71 .name = "dma2",
72 .start = 0xc0, 72 .start = 0xc0,
73 .end = 0xdf, 73 .end = 0xdf,
74 .flags = IORESOURCE_BUSY 74 .flags = IORESOURCE_IO | IORESOURCE_BUSY
75 }, 75 },
76}; 76};
77 77
diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c
index 81799d70a1ee..cfddc87f81bf 100644
--- a/arch/powerpc/platforms/maple/time.c
+++ b/arch/powerpc/platforms/maple/time.c
@@ -134,7 +134,7 @@ int maple_set_rtc_time(struct rtc_time *tm)
134 134
135static struct resource rtc_iores = { 135static struct resource rtc_iores = {
136 .name = "rtc", 136 .name = "rtc",
137 .flags = IORESOURCE_BUSY, 137 .flags = IORESOURCE_IO | IORESOURCE_BUSY,
138}; 138};
139 139
140unsigned long __init maple_get_boot_time(void) 140unsigned long __init maple_get_boot_time(void)
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c
index bafb014e1a7e..cb9a8b71fd0f 100644
--- a/arch/powerpc/sysdev/i8259.c
+++ b/arch/powerpc/sysdev/i8259.c
@@ -145,21 +145,21 @@ static struct resource pic1_iores = {
145 .name = "8259 (master)", 145 .name = "8259 (master)",
146 .start = 0x20, 146 .start = 0x20,
147 .end = 0x21, 147 .end = 0x21,
148 .flags = IORESOURCE_BUSY, 148 .flags = IORESOURCE_IO | IORESOURCE_BUSY,
149}; 149};
150 150
151static struct resource pic2_iores = { 151static struct resource pic2_iores = {
152 .name = "8259 (slave)", 152 .name = "8259 (slave)",
153 .start = 0xa0, 153 .start = 0xa0,
154 .end = 0xa1, 154 .end = 0xa1,
155 .flags = IORESOURCE_BUSY, 155 .flags = IORESOURCE_IO | IORESOURCE_BUSY,
156}; 156};
157 157
158static struct resource pic_edgectrl_iores = { 158static struct resource pic_edgectrl_iores = {
159 .name = "8259 edge control", 159 .name = "8259 edge control",
160 .start = 0x4d0, 160 .start = 0x4d0,
161 .end = 0x4d1, 161 .end = 0x4d1,
162 .flags = IORESOURCE_BUSY, 162 .flags = IORESOURCE_IO | IORESOURCE_BUSY,
163}; 163};
164 164
165static int i8259_host_match(struct irq_domain *h, struct device_node *node, 165static int i8259_host_match(struct irq_domain *h, struct device_node *node,
diff --git a/drivers/irqchip/irq-i8259.c b/drivers/irqchip/irq-i8259.c
index 7aafbb091b67..b0d4aab1a58c 100644
--- a/drivers/irqchip/irq-i8259.c
+++ b/drivers/irqchip/irq-i8259.c
@@ -289,14 +289,14 @@ static struct resource pic1_io_resource = {
289 .name = "pic1", 289 .name = "pic1",
290 .start = PIC_MASTER_CMD, 290 .start = PIC_MASTER_CMD,
291 .end = PIC_MASTER_IMR, 291 .end = PIC_MASTER_IMR,
292 .flags = IORESOURCE_BUSY 292 .flags = IORESOURCE_IO | IORESOURCE_BUSY
293}; 293};
294 294
295static struct resource pic2_io_resource = { 295static struct resource pic2_io_resource = {
296 .name = "pic2", 296 .name = "pic2",
297 .start = PIC_SLAVE_CMD, 297 .start = PIC_SLAVE_CMD,
298 .end = PIC_SLAVE_IMR, 298 .end = PIC_SLAVE_IMR,
299 .flags = IORESOURCE_BUSY 299 .flags = IORESOURCE_IO | IORESOURCE_BUSY
300}; 300};
301 301
302static int i8259A_irq_domain_map(struct irq_domain *d, unsigned int virq, 302static int i8259A_irq_domain_map(struct irq_domain *d, unsigned int virq,
diff --git a/drivers/pci/host/pci-host-common.c b/drivers/pci/host/pci-host-common.c
index 44a47d4f0b8f..c4b891c84703 100644
--- a/drivers/pci/host/pci-host-common.c
+++ b/drivers/pci/host/pci-host-common.c
@@ -142,7 +142,7 @@ int pci_host_common_probe(struct platform_device *pdev,
142 142
143 /* Do not reassign resources if probe only */ 143 /* Do not reassign resources if probe only */
144 if (!pci_has_flag(PCI_PROBE_ONLY)) 144 if (!pci_has_flag(PCI_PROBE_ONLY))
145 pci_add_flags(PCI_REASSIGN_ALL_RSRC | PCI_REASSIGN_ALL_BUS); 145 pci_add_flags(PCI_REASSIGN_ALL_BUS);
146 146
147 list_splice_init(&resources, &bridge->windows); 147 list_splice_init(&resources, &bridge->windows);
148 bridge->dev.parent = dev; 148 bridge->dev.parent = dev;
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index f9d3960dc39f..67328a21d0ee 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -2382,7 +2382,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
2382 2382
2383 tegra_pcie_enable_ports(pcie); 2383 tegra_pcie_enable_ports(pcie);
2384 2384
2385 pci_add_flags(PCI_REASSIGN_ALL_RSRC | PCI_REASSIGN_ALL_BUS);
2386 host->busnr = pcie->busn.start; 2385 host->busnr = pcie->busn.start;
2387 host->dev.parent = &pdev->dev; 2386 host->dev.parent = &pdev->dev;
2388 host->ops = &tegra_pcie_ops; 2387 host->ops = &tegra_pcie_ops;
diff --git a/drivers/pci/host/pci-versatile.c b/drivers/pci/host/pci-versatile.c
index d417acab0ecf..2a2dfcd68e86 100644
--- a/drivers/pci/host/pci-versatile.c
+++ b/drivers/pci/host/pci-versatile.c
@@ -202,7 +202,7 @@ static int versatile_pci_probe(struct platform_device *pdev)
202 writel(0, versatile_cfg_base[0] + PCI_INTERRUPT_LINE); 202 writel(0, versatile_cfg_base[0] + PCI_INTERRUPT_LINE);
203 203
204 pci_add_flags(PCI_ENABLE_PROC_DOMAINS); 204 pci_add_flags(PCI_ENABLE_PROC_DOMAINS);
205 pci_add_flags(PCI_REASSIGN_ALL_BUS | PCI_REASSIGN_ALL_RSRC); 205 pci_add_flags(PCI_REASSIGN_ALL_BUS);
206 206
207 list_splice_init(&pci_res, &bridge->windows); 207 list_splice_init(&pci_res, &bridge->windows);
208 bridge->dev.parent = dev; 208 bridge->dev.parent = dev;
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 52ab3cb0a0bf..2ef5ff9cddf6 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -459,7 +459,7 @@ static int rcar_pcie_enable(struct rcar_pcie *pcie)
459 459
460 rcar_pcie_setup(&bridge->windows, pcie); 460 rcar_pcie_setup(&bridge->windows, pcie);
461 461
462 pci_add_flags(PCI_REASSIGN_ALL_RSRC | PCI_REASSIGN_ALL_BUS); 462 pci_add_flags(PCI_REASSIGN_ALL_BUS);
463 463
464 bridge->dev.parent = dev; 464 bridge->dev.parent = dev;
465 bridge->sysdata = pcie; 465 bridge->sysdata = pcie;
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index c7941a0512a5..7b282f4ba8dc 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1216,14 +1216,9 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
1216 if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(res->start)) 1216 if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(res->start))
1217 return -EINVAL; 1217 return -EINVAL;
1218 1218
1219 if (!pci_mmap_fits(pdev, bar, vma, PCI_MMAP_SYSFS)) { 1219 if (!pci_mmap_fits(pdev, bar, vma, PCI_MMAP_SYSFS))
1220 WARN(1, "process \"%s\" tried to map 0x%08lx bytes at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n",
1221 current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff,
1222 pci_name(pdev), bar,
1223 (u64)pci_resource_start(pdev, bar),
1224 (u64)pci_resource_len(pdev, bar));
1225 return -EINVAL; 1220 return -EINVAL;
1226 } 1221
1227 mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; 1222 mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io;
1228 1223
1229 return pci_mmap_resource_range(pdev, bar, vma, mmap_type, write_combine); 1224 return pci_mmap_resource_range(pdev, bar, vma, mmap_type, write_combine);
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 61f9e8a5ea8b..2f8fcd9ba5c1 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -92,15 +92,15 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
92 void __iomem *pds; 92 void __iomem *pds;
93 /* Standard PCI ROMs start out with these bytes 55 AA */ 93 /* Standard PCI ROMs start out with these bytes 55 AA */
94 if (readw(image) != 0xAA55) { 94 if (readw(image) != 0xAA55) {
95 pci_err(pdev, "Invalid PCI ROM header signature: expecting 0xaa55, got %#06x\n", 95 pci_info(pdev, "Invalid PCI ROM header signature: expecting 0xaa55, got %#06x\n",
96 readw(image)); 96 readw(image));
97 break; 97 break;
98 } 98 }
99 /* get the PCI data structure and check its "PCIR" signature */ 99 /* get the PCI data structure and check its "PCIR" signature */
100 pds = image + readw(image + 24); 100 pds = image + readw(image + 24);
101 if (readl(pds) != 0x52494350) { 101 if (readl(pds) != 0x52494350) {
102 pci_err(pdev, "Invalid PCI ROM data signature: expecting 0x52494350, got %#010x\n", 102 pci_info(pdev, "Invalid PCI ROM data signature: expecting 0x52494350, got %#010x\n",
103 readl(pds)); 103 readl(pds));
104 break; 104 break;
105 } 105 }
106 last_image = readb(pds + 21) & 0x80; 106 last_image = readb(pds + 21) & 0x80;
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 445b1dc5d441..a17ba1465815 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -422,7 +422,10 @@ static const char *vgacon_startup(void)
422 vga_video_port_val = VGA_CRT_DM; 422 vga_video_port_val = VGA_CRT_DM;
423 if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) { 423 if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) {
424 static struct resource ega_console_resource = 424 static struct resource ega_console_resource =
425 { .name = "ega", .start = 0x3B0, .end = 0x3BF }; 425 { .name = "ega",
426 .flags = IORESOURCE_IO,
427 .start = 0x3B0,
428 .end = 0x3BF };
426 vga_video_type = VIDEO_TYPE_EGAM; 429 vga_video_type = VIDEO_TYPE_EGAM;
427 vga_vram_size = 0x8000; 430 vga_vram_size = 0x8000;
428 display_desc = "EGA+"; 431 display_desc = "EGA+";
@@ -430,9 +433,15 @@ static const char *vgacon_startup(void)
430 &ega_console_resource); 433 &ega_console_resource);
431 } else { 434 } else {
432 static struct resource mda1_console_resource = 435 static struct resource mda1_console_resource =
433 { .name = "mda", .start = 0x3B0, .end = 0x3BB }; 436 { .name = "mda",
437 .flags = IORESOURCE_IO,
438 .start = 0x3B0,
439 .end = 0x3BB };
434 static struct resource mda2_console_resource = 440 static struct resource mda2_console_resource =
435 { .name = "mda", .start = 0x3BF, .end = 0x3BF }; 441 { .name = "mda",
442 .flags = IORESOURCE_IO,
443 .start = 0x3BF,
444 .end = 0x3BF };
436 vga_video_type = VIDEO_TYPE_MDA; 445 vga_video_type = VIDEO_TYPE_MDA;
437 vga_vram_size = 0x2000; 446 vga_vram_size = 0x2000;
438 display_desc = "*MDA"; 447 display_desc = "*MDA";
@@ -454,15 +463,21 @@ static const char *vgacon_startup(void)
454 vga_vram_size = 0x8000; 463 vga_vram_size = 0x8000;
455 464
456 if (!screen_info.orig_video_isVGA) { 465 if (!screen_info.orig_video_isVGA) {
457 static struct resource ega_console_resource 466 static struct resource ega_console_resource =
458 = { .name = "ega", .start = 0x3C0, .end = 0x3DF }; 467 { .name = "ega",
468 .flags = IORESOURCE_IO,
469 .start = 0x3C0,
470 .end = 0x3DF };
459 vga_video_type = VIDEO_TYPE_EGAC; 471 vga_video_type = VIDEO_TYPE_EGAC;
460 display_desc = "EGA"; 472 display_desc = "EGA";
461 request_resource(&ioport_resource, 473 request_resource(&ioport_resource,
462 &ega_console_resource); 474 &ega_console_resource);
463 } else { 475 } else {
464 static struct resource vga_console_resource 476 static struct resource vga_console_resource =
465 = { .name = "vga+", .start = 0x3C0, .end = 0x3DF }; 477 { .name = "vga+",
478 .flags = IORESOURCE_IO,
479 .start = 0x3C0,
480 .end = 0x3DF };
466 vga_video_type = VIDEO_TYPE_VGAC; 481 vga_video_type = VIDEO_TYPE_VGAC;
467 display_desc = "VGA+"; 482 display_desc = "VGA+";
468 request_resource(&ioport_resource, 483 request_resource(&ioport_resource,
@@ -494,7 +509,10 @@ static const char *vgacon_startup(void)
494 } 509 }
495 } else { 510 } else {
496 static struct resource cga_console_resource = 511 static struct resource cga_console_resource =
497 { .name = "cga", .start = 0x3D4, .end = 0x3D5 }; 512 { .name = "cga",
513 .flags = IORESOURCE_IO,
514 .start = 0x3D4,
515 .end = 0x3D5 };
498 vga_video_type = VIDEO_TYPE_CGA; 516 vga_video_type = VIDEO_TYPE_CGA;
499 vga_vram_size = 0x2000; 517 vga_vram_size = 0x2000;
500 display_desc = "*CGA"; 518 display_desc = "*CGA";
diff --git a/kernel/resource.c b/kernel/resource.c
index 54ba6de3757c..8c527d83ca76 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -1022,6 +1022,7 @@ static void __init __reserve_region_with_split(struct resource *root,
1022 struct resource *conflict; 1022 struct resource *conflict;
1023 struct resource *res = alloc_resource(GFP_ATOMIC); 1023 struct resource *res = alloc_resource(GFP_ATOMIC);
1024 struct resource *next_res = NULL; 1024 struct resource *next_res = NULL;
1025 int type = resource_type(root);
1025 1026
1026 if (!res) 1027 if (!res)
1027 return; 1028 return;
@@ -1029,7 +1030,7 @@ static void __init __reserve_region_with_split(struct resource *root,
1029 res->name = name; 1030 res->name = name;
1030 res->start = start; 1031 res->start = start;
1031 res->end = end; 1032 res->end = end;
1032 res->flags = IORESOURCE_BUSY; 1033 res->flags = type | IORESOURCE_BUSY;
1033 res->desc = IORES_DESC_NONE; 1034 res->desc = IORES_DESC_NONE;
1034 1035
1035 while (1) { 1036 while (1) {
@@ -1064,7 +1065,7 @@ static void __init __reserve_region_with_split(struct resource *root,
1064 next_res->name = name; 1065 next_res->name = name;
1065 next_res->start = conflict->end + 1; 1066 next_res->start = conflict->end + 1;
1066 next_res->end = end; 1067 next_res->end = end;
1067 next_res->flags = IORESOURCE_BUSY; 1068 next_res->flags = type | IORESOURCE_BUSY;
1068 next_res->desc = IORES_DESC_NONE; 1069 next_res->desc = IORES_DESC_NONE;
1069 } 1070 }
1070 } else { 1071 } else {
@@ -1478,7 +1479,7 @@ void __devm_release_region(struct device *dev, struct resource *parent,
1478EXPORT_SYMBOL(__devm_release_region); 1479EXPORT_SYMBOL(__devm_release_region);
1479 1480
1480/* 1481/*
1481 * Called from init/main.c to reserve IO ports. 1482 * Reserve I/O ports or memory based on "reserve=" kernel parameter.
1482 */ 1483 */
1483#define MAXRESERVE 4 1484#define MAXRESERVE 4
1484static int __init reserve_setup(char *str) 1485static int __init reserve_setup(char *str)
@@ -1489,26 +1490,38 @@ static int __init reserve_setup(char *str)
1489 for (;;) { 1490 for (;;) {
1490 unsigned int io_start, io_num; 1491 unsigned int io_start, io_num;
1491 int x = reserved; 1492 int x = reserved;
1493 struct resource *parent;
1492 1494
1493 if (get_option (&str, &io_start) != 2) 1495 if (get_option(&str, &io_start) != 2)
1494 break; 1496 break;
1495 if (get_option (&str, &io_num) == 0) 1497 if (get_option(&str, &io_num) == 0)
1496 break; 1498 break;
1497 if (x < MAXRESERVE) { 1499 if (x < MAXRESERVE) {
1498 struct resource *res = reserve + x; 1500 struct resource *res = reserve + x;
1501
1502 /*
1503 * If the region starts below 0x10000, we assume it's
1504 * I/O port space; otherwise assume it's memory.
1505 */
1506 if (io_start < 0x10000) {
1507 res->flags = IORESOURCE_IO;
1508 parent = &ioport_resource;
1509 } else {
1510 res->flags = IORESOURCE_MEM;
1511 parent = &iomem_resource;
1512 }
1499 res->name = "reserved"; 1513 res->name = "reserved";
1500 res->start = io_start; 1514 res->start = io_start;
1501 res->end = io_start + io_num - 1; 1515 res->end = io_start + io_num - 1;
1502 res->flags = IORESOURCE_BUSY; 1516 res->flags |= IORESOURCE_BUSY;
1503 res->desc = IORES_DESC_NONE; 1517 res->desc = IORES_DESC_NONE;
1504 res->child = NULL; 1518 res->child = NULL;
1505 if (request_resource(res->start >= 0x10000 ? &iomem_resource : &ioport_resource, res) == 0) 1519 if (request_resource(parent, res) == 0)
1506 reserved = x+1; 1520 reserved = x+1;
1507 } 1521 }
1508 } 1522 }
1509 return 1; 1523 return 1;
1510} 1524}
1511
1512__setup("reserve=", reserve_setup); 1525__setup("reserve=", reserve_setup);
1513 1526
1514/* 1527/*