Commit 3c794096 authored by Richard Henderson's avatar Richard Henderson

Save and restore CIA window configuration data.

parent 0fc1896d
...@@ -47,6 +47,15 @@ ...@@ -47,6 +47,15 @@
#define vip volatile int * #define vip volatile int *
/* Save CIA configuration data as the console had it set up. */
struct
{
unsigned int w_base;
unsigned int w_mask;
unsigned int t_base;
} saved_config[4] __attribute((common));
/* /*
* Given a bus, device, and function number, compute resulting * Given a bus, device, and function number, compute resulting
* configuration space address. It is therefore not safe to have * configuration space address. It is therefore not safe to have
...@@ -648,6 +657,24 @@ do_init_arch(int is_pyxis) ...@@ -648,6 +657,24 @@ do_init_arch(int is_pyxis)
hose->dense_io_base = CIA_BW_IO - IDENT_ADDR; hose->dense_io_base = CIA_BW_IO - IDENT_ADDR;
} }
/* Save CIA configuration data as the console had it set up. */
saved_config[0].w_base = *(vip)CIA_IOC_PCI_W0_BASE;
saved_config[0].w_mask = *(vip)CIA_IOC_PCI_W0_MASK;
saved_config[0].t_base = *(vip)CIA_IOC_PCI_T0_BASE;
saved_config[1].w_base = *(vip)CIA_IOC_PCI_W1_BASE;
saved_config[1].w_mask = *(vip)CIA_IOC_PCI_W1_MASK;
saved_config[1].t_base = *(vip)CIA_IOC_PCI_T1_BASE;
saved_config[2].w_base = *(vip)CIA_IOC_PCI_W2_BASE;
saved_config[2].w_mask = *(vip)CIA_IOC_PCI_W2_MASK;
saved_config[2].t_base = *(vip)CIA_IOC_PCI_T2_BASE;
saved_config[3].w_base = *(vip)CIA_IOC_PCI_W3_BASE;
saved_config[3].w_mask = *(vip)CIA_IOC_PCI_W3_MASK;
saved_config[3].t_base = *(vip)CIA_IOC_PCI_T3_BASE;
/* /*
* Set up the PCI to main memory translation windows. * Set up the PCI to main memory translation windows.
* *
...@@ -736,6 +763,26 @@ pyxis_init_arch(void) ...@@ -736,6 +763,26 @@ pyxis_init_arch(void)
do_init_arch(1); do_init_arch(1);
} }
void
cia_kill_arch(int mode)
{
*(vip)CIA_IOC_PCI_W0_BASE = saved_config[0].w_base;
*(vip)CIA_IOC_PCI_W0_MASK = saved_config[0].w_mask;
*(vip)CIA_IOC_PCI_T0_BASE = saved_config[0].t_base;
*(vip)CIA_IOC_PCI_W1_BASE = saved_config[1].w_base;
*(vip)CIA_IOC_PCI_W1_MASK = saved_config[1].w_mask;
*(vip)CIA_IOC_PCI_T1_BASE = saved_config[1].t_base;
*(vip)CIA_IOC_PCI_W2_BASE = saved_config[2].w_base;
*(vip)CIA_IOC_PCI_W2_MASK = saved_config[2].w_mask;
*(vip)CIA_IOC_PCI_T2_BASE = saved_config[2].t_base;
*(vip)CIA_IOC_PCI_W3_BASE = saved_config[3].w_base;
*(vip)CIA_IOC_PCI_W3_MASK = saved_config[3].w_mask;
*(vip)CIA_IOC_PCI_T3_BASE = saved_config[3].t_base;
}
void __init void __init
cia_init_pci(void) cia_init_pci(void)
{ {
......
...@@ -27,12 +27,14 @@ ...@@ -27,12 +27,14 @@
unsigned TITAN_agp = 0; unsigned TITAN_agp = 0;
static struct /* Save Titan configuration data as the console had it set up. */
struct
{ {
unsigned long wsba[4]; unsigned long wsba[4];
unsigned long wsm[4]; unsigned long wsm[4];
unsigned long tba[4]; unsigned long tba[4];
} saved_pachip_port[4]; } saved_config[4] __attribute__((common));
/* /*
* BIOS32-style PCI interface: * BIOS32-style PCI interface:
...@@ -289,21 +291,21 @@ titan_init_one_pachip_port(titan_pachip_port *port, int index) ...@@ -289,21 +291,21 @@ titan_init_one_pachip_port(titan_pachip_port *port, int index)
* Save the existing PCI window translations. SRM will * Save the existing PCI window translations. SRM will
* need them when we go to reboot. * need them when we go to reboot.
*/ */
saved_pachip_port[index].wsba[0] = port->wsba[0].csr; saved_config[index].wsba[0] = port->wsba[0].csr;
saved_pachip_port[index].wsm[0] = port->wsm[0].csr; saved_config[index].wsm[0] = port->wsm[0].csr;
saved_pachip_port[index].tba[0] = port->tba[0].csr; saved_config[index].tba[0] = port->tba[0].csr;
saved_pachip_port[index].wsba[1] = port->wsba[1].csr; saved_config[index].wsba[1] = port->wsba[1].csr;
saved_pachip_port[index].wsm[1] = port->wsm[1].csr; saved_config[index].wsm[1] = port->wsm[1].csr;
saved_pachip_port[index].tba[1] = port->tba[1].csr; saved_config[index].tba[1] = port->tba[1].csr;
saved_pachip_port[index].wsba[2] = port->wsba[2].csr; saved_config[index].wsba[2] = port->wsba[2].csr;
saved_pachip_port[index].wsm[2] = port->wsm[2].csr; saved_config[index].wsm[2] = port->wsm[2].csr;
saved_pachip_port[index].tba[2] = port->tba[2].csr; saved_config[index].tba[2] = port->tba[2].csr;
saved_pachip_port[index].wsba[3] = port->wsba[3].csr; saved_config[index].wsba[3] = port->wsba[3].csr;
saved_pachip_port[index].wsm[3] = port->wsm[3].csr; saved_config[index].wsm[3] = port->wsm[3].csr;
saved_pachip_port[index].tba[3] = port->tba[3].csr; saved_config[index].tba[3] = port->tba[3].csr;
/* /*
* Set up the PCI to main memory translation windows. * Set up the PCI to main memory translation windows.
...@@ -392,21 +394,21 @@ titan_init_arch(void) ...@@ -392,21 +394,21 @@ titan_init_arch(void)
static void static void
titan_kill_one_pachip_port(titan_pachip_port *port, int index) titan_kill_one_pachip_port(titan_pachip_port *port, int index)
{ {
port->wsba[0].csr = saved_pachip_port[index].wsba[0]; port->wsba[0].csr = saved_config[index].wsba[0];
port->wsm[0].csr = saved_pachip_port[index].wsm[0]; port->wsm[0].csr = saved_config[index].wsm[0];
port->tba[0].csr = saved_pachip_port[index].tba[0]; port->tba[0].csr = saved_config[index].tba[0];
port->wsba[1].csr = saved_pachip_port[index].wsba[1]; port->wsba[1].csr = saved_config[index].wsba[1];
port->wsm[1].csr = saved_pachip_port[index].wsm[1]; port->wsm[1].csr = saved_config[index].wsm[1];
port->tba[1].csr = saved_pachip_port[index].tba[1]; port->tba[1].csr = saved_config[index].tba[1];
port->wsba[2].csr = saved_pachip_port[index].wsba[2]; port->wsba[2].csr = saved_config[index].wsba[2];
port->wsm[2].csr = saved_pachip_port[index].wsm[2]; port->wsm[2].csr = saved_config[index].wsm[2];
port->tba[2].csr = saved_pachip_port[index].tba[2]; port->tba[2].csr = saved_config[index].tba[2];
port->wsba[3].csr = saved_pachip_port[index].wsba[3]; port->wsba[3].csr = saved_config[index].wsba[3];
port->wsm[3].csr = saved_pachip_port[index].wsm[3]; port->wsm[3].csr = saved_config[index].wsm[3];
port->tba[3].csr = saved_pachip_port[index].tba[3]; port->tba[3].csr = saved_config[index].tba[3];
} }
static void static void
......
...@@ -26,13 +26,14 @@ ...@@ -26,13 +26,14 @@
#include "proto.h" #include "proto.h"
#include "pci_impl.h" #include "pci_impl.h"
/* Save Tsunami configuration data as the console had it set up. */
static struct struct
{ {
unsigned long wsba[4]; unsigned long wsba[4];
unsigned long wsm[4]; unsigned long wsm[4];
unsigned long tba[4]; unsigned long tba[4];
} saved_pchip[2]; } saved_config[2] __attribute__((common));
/* /*
* NOTE: Herein lie back-to-back mb instructions. They are magic. * NOTE: Herein lie back-to-back mb instructions. They are magic.
...@@ -293,21 +294,21 @@ tsunami_init_one_pchip(tsunami_pchip *pchip, int index) ...@@ -293,21 +294,21 @@ tsunami_init_one_pchip(tsunami_pchip *pchip, int index)
* need them when we go to reboot. * need them when we go to reboot.
*/ */
saved_pchip[index].wsba[0] = pchip->wsba[0].csr; saved_config[index].wsba[0] = pchip->wsba[0].csr;
saved_pchip[index].wsm[0] = pchip->wsm[0].csr; saved_config[index].wsm[0] = pchip->wsm[0].csr;
saved_pchip[index].tba[0] = pchip->tba[0].csr; saved_config[index].tba[0] = pchip->tba[0].csr;
saved_pchip[index].wsba[1] = pchip->wsba[1].csr; saved_config[index].wsba[1] = pchip->wsba[1].csr;
saved_pchip[index].wsm[1] = pchip->wsm[1].csr; saved_config[index].wsm[1] = pchip->wsm[1].csr;
saved_pchip[index].tba[1] = pchip->tba[1].csr; saved_config[index].tba[1] = pchip->tba[1].csr;
saved_pchip[index].wsba[2] = pchip->wsba[2].csr; saved_config[index].wsba[2] = pchip->wsba[2].csr;
saved_pchip[index].wsm[2] = pchip->wsm[2].csr; saved_config[index].wsm[2] = pchip->wsm[2].csr;
saved_pchip[index].tba[2] = pchip->tba[2].csr; saved_config[index].tba[2] = pchip->tba[2].csr;
saved_pchip[index].wsba[3] = pchip->wsba[3].csr; saved_config[index].wsba[3] = pchip->wsba[3].csr;
saved_pchip[index].wsm[3] = pchip->wsm[3].csr; saved_config[index].wsm[3] = pchip->wsm[3].csr;
saved_pchip[index].tba[3] = pchip->tba[3].csr; saved_config[index].tba[3] = pchip->tba[3].csr;
/* /*
* Set up the PCI to main memory translation windows. * Set up the PCI to main memory translation windows.
...@@ -403,21 +404,21 @@ tsunami_init_arch(void) ...@@ -403,21 +404,21 @@ tsunami_init_arch(void)
static void static void
tsunami_kill_one_pchip(tsunami_pchip *pchip, int index) tsunami_kill_one_pchip(tsunami_pchip *pchip, int index)
{ {
pchip->wsba[0].csr = saved_pchip[index].wsba[0]; pchip->wsba[0].csr = saved_config[index].wsba[0];
pchip->wsm[0].csr = saved_pchip[index].wsm[0]; pchip->wsm[0].csr = saved_config[index].wsm[0];
pchip->tba[0].csr = saved_pchip[index].tba[0]; pchip->tba[0].csr = saved_config[index].tba[0];
pchip->wsba[1].csr = saved_pchip[index].wsba[1]; pchip->wsba[1].csr = saved_config[index].wsba[1];
pchip->wsm[1].csr = saved_pchip[index].wsm[1]; pchip->wsm[1].csr = saved_config[index].wsm[1];
pchip->tba[1].csr = saved_pchip[index].tba[1]; pchip->tba[1].csr = saved_config[index].tba[1];
pchip->wsba[2].csr = saved_pchip[index].wsba[2]; pchip->wsba[2].csr = saved_config[index].wsba[2];
pchip->wsm[2].csr = saved_pchip[index].wsm[2]; pchip->wsm[2].csr = saved_config[index].wsm[2];
pchip->tba[2].csr = saved_pchip[index].tba[2]; pchip->tba[2].csr = saved_config[index].tba[2];
pchip->wsba[3].csr = saved_pchip[index].wsba[3]; pchip->wsba[3].csr = saved_config[index].wsba[3];
pchip->wsm[3].csr = saved_pchip[index].wsm[3]; pchip->wsm[3].csr = saved_config[index].wsm[3];
pchip->tba[3].csr = saved_pchip[index].tba[3]; pchip->tba[3].csr = saved_config[index].tba[3];
} }
void void
......
...@@ -24,6 +24,7 @@ extern struct pci_ops cia_pci_ops; ...@@ -24,6 +24,7 @@ extern struct pci_ops cia_pci_ops;
extern void cia_init_pci(void); extern void cia_init_pci(void);
extern void cia_init_arch(void); extern void cia_init_arch(void);
extern void pyxis_init_arch(void); extern void pyxis_init_arch(void);
extern void cia_kill_arch(int);
extern void cia_machine_check(u64, u64, struct pt_regs *); extern void cia_machine_check(u64, u64, struct pt_regs *);
extern void cia_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t); extern void cia_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t);
......
...@@ -221,6 +221,8 @@ alcor_map_irq(struct pci_dev *dev, u8 slot, u8 pin) ...@@ -221,6 +221,8 @@ alcor_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
static void static void
alcor_kill_arch(int mode) alcor_kill_arch(int mode)
{ {
cia_kill_arch(mode);
switch(mode) { switch(mode) {
case LINUX_REBOOT_CMD_RESTART: case LINUX_REBOOT_CMD_RESTART:
/* Who said DEC engineer's have no sense of humor? ;-) */ /* Who said DEC engineer's have no sense of humor? ;-) */
......
...@@ -338,7 +338,6 @@ struct alpha_machine_vector cabriolet_mv __initmv = { ...@@ -338,7 +338,6 @@ struct alpha_machine_vector cabriolet_mv __initmv = {
init_irq: cabriolet_init_irq, init_irq: cabriolet_init_irq,
init_rtc: common_init_rtc, init_rtc: common_init_rtc,
init_pci: cabriolet_init_pci, init_pci: cabriolet_init_pci,
kill_arch: NULL,
pci_map_irq: cabriolet_map_irq, pci_map_irq: cabriolet_map_irq,
pci_swizzle: common_swizzle, pci_swizzle: common_swizzle,
}; };
...@@ -366,6 +365,7 @@ struct alpha_machine_vector eb164_mv __initmv = { ...@@ -366,6 +365,7 @@ struct alpha_machine_vector eb164_mv __initmv = {
init_irq: cabriolet_init_irq, init_irq: cabriolet_init_irq,
init_rtc: common_init_rtc, init_rtc: common_init_rtc,
init_pci: cia_cab_init_pci, init_pci: cia_cab_init_pci,
kill_arch: cia_kill_arch,
pci_map_irq: cabriolet_map_irq, pci_map_irq: cabriolet_map_irq,
pci_swizzle: common_swizzle, pci_swizzle: common_swizzle,
}; };
...@@ -417,6 +417,7 @@ struct alpha_machine_vector lx164_mv __initmv = { ...@@ -417,6 +417,7 @@ struct alpha_machine_vector lx164_mv __initmv = {
init_irq: cabriolet_init_irq, init_irq: cabriolet_init_irq,
init_rtc: common_init_rtc, init_rtc: common_init_rtc,
init_pci: alphapc164_init_pci, init_pci: alphapc164_init_pci,
kill_arch: cia_kill_arch,
pci_map_irq: alphapc164_map_irq, pci_map_irq: alphapc164_map_irq,
pci_swizzle: common_swizzle, pci_swizzle: common_swizzle,
}; };
...@@ -442,6 +443,7 @@ struct alpha_machine_vector pc164_mv __initmv = { ...@@ -442,6 +443,7 @@ struct alpha_machine_vector pc164_mv __initmv = {
init_irq: pc164_init_irq, init_irq: pc164_init_irq,
init_rtc: common_init_rtc, init_rtc: common_init_rtc,
init_pci: alphapc164_init_pci, init_pci: alphapc164_init_pci,
kill_arch: cia_kill_arch,
pci_map_irq: alphapc164_map_irq, pci_map_irq: alphapc164_map_irq,
pci_swizzle: common_swizzle, pci_swizzle: common_swizzle,
}; };
......
...@@ -238,6 +238,8 @@ miata_init_pci(void) ...@@ -238,6 +238,8 @@ miata_init_pci(void)
static void static void
miata_kill_arch(int mode) miata_kill_arch(int mode)
{ {
cia_kill_arch(mode);
switch(mode) { switch(mode) {
case LINUX_REBOOT_CMD_RESTART: case LINUX_REBOOT_CMD_RESTART:
/* Who said DEC engineers have no sense of humor? ;-) */ /* Who said DEC engineers have no sense of humor? ;-) */
......
...@@ -234,7 +234,6 @@ struct alpha_machine_vector mikasa_mv __initmv = { ...@@ -234,7 +234,6 @@ struct alpha_machine_vector mikasa_mv __initmv = {
init_irq: mikasa_init_irq, init_irq: mikasa_init_irq,
init_rtc: common_init_rtc, init_rtc: common_init_rtc,
init_pci: common_init_pci, init_pci: common_init_pci,
kill_arch: NULL,
pci_map_irq: mikasa_map_irq, pci_map_irq: mikasa_map_irq,
pci_swizzle: common_swizzle, pci_swizzle: common_swizzle,
}; };
...@@ -260,6 +259,7 @@ struct alpha_machine_vector mikasa_primo_mv __initmv = { ...@@ -260,6 +259,7 @@ struct alpha_machine_vector mikasa_primo_mv __initmv = {
init_irq: mikasa_init_irq, init_irq: mikasa_init_irq,
init_rtc: common_init_rtc, init_rtc: common_init_rtc,
init_pci: cia_init_pci, init_pci: cia_init_pci,
kill_arch: cia_kill_arch,
pci_map_irq: mikasa_map_irq, pci_map_irq: mikasa_map_irq,
pci_swizzle: common_swizzle, pci_swizzle: common_swizzle,
}; };
......
...@@ -316,7 +316,6 @@ struct alpha_machine_vector noritake_mv __initmv = { ...@@ -316,7 +316,6 @@ struct alpha_machine_vector noritake_mv __initmv = {
init_irq: noritake_init_irq, init_irq: noritake_init_irq,
init_rtc: common_init_rtc, init_rtc: common_init_rtc,
init_pci: common_init_pci, init_pci: common_init_pci,
kill_arch: NULL,
pci_map_irq: noritake_map_irq, pci_map_irq: noritake_map_irq,
pci_swizzle: noritake_swizzle, pci_swizzle: noritake_swizzle,
}; };
...@@ -342,6 +341,7 @@ struct alpha_machine_vector noritake_primo_mv __initmv = { ...@@ -342,6 +341,7 @@ struct alpha_machine_vector noritake_primo_mv __initmv = {
init_irq: noritake_init_irq, init_irq: noritake_init_irq,
init_rtc: common_init_rtc, init_rtc: common_init_rtc,
init_pci: cia_init_pci, init_pci: cia_init_pci,
kill_arch: cia_kill_arch,
pci_map_irq: noritake_map_irq, pci_map_irq: noritake_map_irq,
pci_swizzle: noritake_swizzle, pci_swizzle: noritake_swizzle,
}; };
......
...@@ -85,6 +85,7 @@ ruffian_init_rtc(void) ...@@ -85,6 +85,7 @@ ruffian_init_rtc(void)
static void static void
ruffian_kill_arch (int mode) ruffian_kill_arch (int mode)
{ {
cia_kill_arch(mode);
#if 0 #if 0
/* This only causes re-entry to ARCSBIOS */ /* This only causes re-entry to ARCSBIOS */
/* Perhaps this works for other PYXIS as well? */ /* Perhaps this works for other PYXIS as well? */
......
...@@ -172,7 +172,7 @@ struct alpha_machine_vector sx164_mv __initmv = { ...@@ -172,7 +172,7 @@ struct alpha_machine_vector sx164_mv __initmv = {
init_irq: sx164_init_irq, init_irq: sx164_init_irq,
init_rtc: common_init_rtc, init_rtc: common_init_rtc,
init_pci: sx164_init_pci, init_pci: sx164_init_pci,
kill_arch: NULL, kill_arch: cia_kill_arch,
pci_map_irq: sx164_map_irq, pci_map_irq: sx164_map_irq,
pci_swizzle: common_swizzle, pci_swizzle: common_swizzle,
}; };
......
...@@ -286,7 +286,7 @@ struct alpha_machine_vector takara_mv __initmv = { ...@@ -286,7 +286,7 @@ struct alpha_machine_vector takara_mv __initmv = {
init_irq: takara_init_irq, init_irq: takara_init_irq,
init_rtc: common_init_rtc, init_rtc: common_init_rtc,
init_pci: takara_init_pci, init_pci: takara_init_pci,
kill_arch: NULL, kill_arch: cia_kill_arch,
pci_map_irq: takara_map_irq, pci_map_irq: takara_map_irq,
pci_swizzle: takara_swizzle, pci_swizzle: takara_swizzle,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment