mirror of
https://github.com/openbsd/src.git
synced 2026-04-29 00:27:11 +00:00
remove incomplete/never finished loongson hibernate code
This was started many years ago and never finished. Ongoing work in hibernate is complicated by having this old code present. ok miod
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $OpenBSD: files.loongson,v 1.26 2020/09/30 22:23:41 patrick Exp $
|
||||
# $OpenBSD: files.loongson,v 1.27 2026/04/06 19:34:08 mlarkin Exp $
|
||||
|
||||
# Standard stanzas config(8) can't run without
|
||||
maxpartitions 16
|
||||
@@ -26,7 +26,6 @@ file arch/loongson/loongson/loongson2_machdep.c
|
||||
file arch/loongson/loongson/loongson3_intr.c cpu_loongson3
|
||||
file arch/loongson/loongson/loongson3_machdep.c cpu_loongson3
|
||||
file arch/loongson/loongson/machdep.c
|
||||
file arch/loongson/loongson/hibernate_machdep.c hibernate
|
||||
file arch/loongson/loongson/pciide_machdep.c pciide
|
||||
file arch/loongson/loongson/pmon.c
|
||||
file arch/loongson/loongson/pmon32.S
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: apm.c,v 1.44 2024/05/29 06:39:13 jsg Exp $ */
|
||||
/* $OpenBSD: apm.c,v 1.45 2026/04/06 19:34:08 mlarkin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Alexander Guy. All rights reserved.
|
||||
@@ -45,7 +45,6 @@
|
||||
#include <sys/buf.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/hibernate.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/conf.h>
|
||||
@@ -235,17 +234,6 @@ apmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
else
|
||||
error = apm_suspend(APM_IOC_SUSPEND);
|
||||
break;
|
||||
#ifdef HIBERNATE
|
||||
case APM_IOC_HIBERNATE:
|
||||
if ((flag & FWRITE) == 0)
|
||||
error = EBADF;
|
||||
else if (sys_platform->suspend == NULL ||
|
||||
sys_platform->resume == NULL)
|
||||
error = EOPNOTSUPP;
|
||||
else
|
||||
error = apm_suspend(APM_IOC_HIBERNATE);
|
||||
break;
|
||||
#endif
|
||||
case APM_IOC_PRN_CTL:
|
||||
if ((flag & FWRITE) == 0)
|
||||
error = EBADF;
|
||||
@@ -392,17 +380,6 @@ apm_suspend(int state)
|
||||
|
||||
suspend_randomness();
|
||||
|
||||
#ifdef HIBERNATE
|
||||
if (state == APM_IOC_HIBERNATE) {
|
||||
uvm_pmr_zero_everything();
|
||||
if (hibernate_suspend()) {
|
||||
printf("apm: hibernate_suspend failed");
|
||||
uvm_pmr_dirty_everything();
|
||||
return (ECANCELED);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* XXX
|
||||
* Flag to disk drivers that they should "power down" the disk
|
||||
* when we get to DVACT_POWERDOWN.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: apmvar.h,v 1.6 2019/01/22 02:36:30 phessler Exp $ */
|
||||
/* $OpenBSD: apmvar.h,v 1.7 2026/04/06 19:34:08 mlarkin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Alexander Guy
|
||||
@@ -67,7 +67,6 @@
|
||||
#define APM_USER_SUSPEND_REQ 0x000A
|
||||
#define APM_SYS_STANDBY_RESUME 0x000B
|
||||
#define APM_CAPABILITY_CHANGE 0x000C /* apm v1.2 */
|
||||
#define APM_USER_HIBERNATE_REQ 0x000D
|
||||
#define APM_EVENT_MASK 0xffff
|
||||
|
||||
#define APM_EVENT_COMPOSE(t,i) ((((i) & 0x7fff) << 16)|((t) & APM_EVENT_MASK))
|
||||
@@ -117,7 +116,6 @@ struct apm_ctl {
|
||||
if the percentage changes */
|
||||
#define APM_IOC_STANDBY_REQ _IO('A', 7) /* request standby */
|
||||
#define APM_IOC_SUSPEND_REQ _IO('A', 8) /* request suspend */
|
||||
#define APM_IOC_HIBERNATE _IO('A', 9) /* put system into hibernate */
|
||||
|
||||
#ifdef _KERNEL
|
||||
void apm_setinfohook(int (*)(struct apm_power_info *));
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/* $OpenBSD: hibernate.h,v 1.3 2018/06/21 07:33:30 mlarkin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 Paul Irofti.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <machine/hibernate_var.h>
|
||||
|
||||
/* Loongson hibernate support structures and functions */
|
||||
|
||||
int get_hibernate_info_md(union hibernate_info *);
|
||||
void hibernate_flush(void);
|
||||
void hibernate_enter_resume_mapping(vaddr_t, paddr_t, int);
|
||||
int hibernate_inflate_skip(union hibernate_info *, paddr_t);
|
||||
int hibernate_suspend(void);
|
||||
void hibernate_switch_stack_machdep(void);
|
||||
void hibernate_resume_machdep(vaddr_t);
|
||||
void hibernate_activate_resume_pt_machdep(void);
|
||||
void hibernate_enable_intr_machdep(void);
|
||||
void hibernate_disable_intr_machdep(void);
|
||||
@@ -1,39 +0,0 @@
|
||||
/* $OpenBSD: hibernate_var.h,v 1.1 2013/06/02 21:46:04 pirofti Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 Paul Irofti.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* Loongson hibernate support definitions */
|
||||
|
||||
#define PAGE_MASK_4M ((256 * PAGE_SIZE) - 1)
|
||||
|
||||
#define PIGLET_PAGE_MASK ~((paddr_t)PAGE_MASK_4M)
|
||||
|
||||
/*
|
||||
* Steal hibernate pages right after the first page which is reserved
|
||||
* for the exception area.
|
||||
* */
|
||||
#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 1)
|
||||
#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 2)
|
||||
#define HIBERNATE_COPY_PAGE (PAGE_SIZE * 3)
|
||||
#define HIBERNATE_HIBALLOC_PAGE (PAGE_SIZE * 4)
|
||||
|
||||
#define HIBERNATE_RESERVED_PAGES 4
|
||||
|
||||
/* Use 4MB hibernation chunks */
|
||||
#define HIBERNATE_CHUNK_SIZE 0x400000
|
||||
|
||||
#define HIBERNATE_CHUNK_TABLE_SIZE 0x100000
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: autoconf.c,v 1.11 2022/09/02 20:06:56 miod Exp $ */
|
||||
/* $OpenBSD: autoconf.c,v 1.12 2026/04/06 19:34:08 mlarkin Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2009 Miodrag Vallat.
|
||||
*
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <sys/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/hibernate.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
@@ -134,10 +133,6 @@ diskconf(void)
|
||||
|
||||
setroot(bootdv, 0, RB_USERREQ);
|
||||
dumpconf();
|
||||
|
||||
#ifdef HIBERNATE
|
||||
hibernate_resume();
|
||||
#endif /* HIBERNATE */
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
/* $OpenBSD: hibernate_machdep.c,v 1.9 2026/03/13 15:54:47 mlarkin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 Paul Irofti.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/hibernate.h>
|
||||
#include <sys/timeout.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
#include <uvm/uvm_pmemrange.h>
|
||||
|
||||
#include <mips64/cache.h>
|
||||
|
||||
#include <machine/hibernate.h>
|
||||
#include <machine/hibernate_var.h>
|
||||
#include <machine/kcore.h>
|
||||
#include <machine/pmap.h>
|
||||
#include <machine/memconf.h>
|
||||
|
||||
#include "wd.h"
|
||||
#include "ahci.h"
|
||||
#include "softraid.h"
|
||||
#include "sd.h"
|
||||
|
||||
#if NWD > 0
|
||||
#include <dev/ata/atavar.h>
|
||||
#include <dev/ata/wdvar.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Loongson MD Hibernate functions
|
||||
*
|
||||
* see Loongson hibernate.h for lowmem layout used during hibernate
|
||||
*/
|
||||
|
||||
/*
|
||||
* Returns the hibernate write I/O function to use on this machine
|
||||
*/
|
||||
hibio_fn
|
||||
get_hibernate_io_function(dev_t dev)
|
||||
{
|
||||
char *blkname = findblkname(major(dev));
|
||||
|
||||
if (blkname == NULL)
|
||||
return NULL;
|
||||
|
||||
#if NWD > 0
|
||||
if (strcmp(blkname, "wd") == 0)
|
||||
return wd_hibernate_io;
|
||||
#endif
|
||||
#if NSD > 0
|
||||
if (strcmp(blkname, "sd") == 0) {
|
||||
extern struct cfdriver sd_cd;
|
||||
extern int ahci_hibernate_io(dev_t dev, daddr_t blkno,
|
||||
vaddr_t addr, size_t size, int op, void *page);
|
||||
extern int sr_hibernate_io(dev_t dev, daddr_t blkno,
|
||||
vaddr_t addr, size_t size, int op, void *page);
|
||||
struct device *dv = disk_lookup(&sd_cd, DISKUNIT(dev));
|
||||
|
||||
#if NAHCI > 0
|
||||
if (dv && dv->dv_parent && dv->dv_parent->dv_parent &&
|
||||
strcmp(dv->dv_parent->dv_parent->dv_cfdata->cf_driver->cd_name,
|
||||
"ahci") == 0)
|
||||
return ahci_hibernate_io;
|
||||
#endif
|
||||
#if NSOFTRAID > 0
|
||||
if (dv && dv->dv_parent && dv->dv_parent->dv_parent &&
|
||||
strcmp(dv->dv_parent->dv_parent->dv_cfdata->cf_driver->cd_name,
|
||||
"softraid") == 0)
|
||||
return sr_hibernate_io;
|
||||
}
|
||||
#endif
|
||||
#endif /* NSD > 0 */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gather MD-specific data and store into hiber_info
|
||||
*/
|
||||
int
|
||||
get_hibernate_info_md(union hibernate_info *hiber_info)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Calculate memory ranges */
|
||||
hiber_info->nranges = 0;
|
||||
hiber_info->image_size = 0;
|
||||
|
||||
for (i = 0; i < MAXMEMSEGS && mem_layout[i].mem_last_page != 0; i++) {
|
||||
/* XXX: Adjust for stolen pages later */
|
||||
hiber_info->ranges[i].base =
|
||||
mem_layout[i].mem_first_page >> PAGE_SHIFT;
|
||||
hiber_info->ranges[i].end =
|
||||
mem_layout[i].mem_last_page >> PAGE_SHIFT;
|
||||
hiber_info->image_size +=
|
||||
hiber_info->ranges[i].end - hiber_info->ranges[i].base;
|
||||
hiber_info->nranges++;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Enter a mapping for va->pa in the resume pagetable
|
||||
*/
|
||||
void
|
||||
hibernate_enter_resume_mapping(vaddr_t va, paddr_t pa, int size)
|
||||
{
|
||||
/* XXX TBD */
|
||||
}
|
||||
|
||||
/*
|
||||
* Create the resume-time page table. This table maps the image(pig) area,
|
||||
* the kernel text area, and various utility pages for use during resume,
|
||||
* since we cannot overwrite the resuming kernel's page table during inflate
|
||||
* and expect things to work properly.
|
||||
*/
|
||||
void
|
||||
hibernate_populate_resume_pt(union hibernate_info *hib_info,
|
||||
paddr_t image_start, paddr_t image_end)
|
||||
{
|
||||
/* XXX TBD */
|
||||
}
|
||||
|
||||
/*
|
||||
* During inflate, certain pages that contain our bookkeeping information
|
||||
* (eg, the chunk table, scratch pages, etc) need to be skipped over and
|
||||
* not inflated into.
|
||||
*
|
||||
* Returns 1 if the physical page at dest should be skipped, 0 otherwise
|
||||
*/
|
||||
int
|
||||
hibernate_inflate_skip(union hibernate_info *hib_info, paddr_t dest)
|
||||
{
|
||||
if (dest >= hib_info->piglet_pa &&
|
||||
dest < (hib_info->piglet_pa + 4 * HIBERNATE_CHUNK_SIZE))
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
hibernate_enable_intr_machdep(void)
|
||||
{
|
||||
enableintr();
|
||||
}
|
||||
|
||||
void
|
||||
hibernate_disable_intr_machdep(void)
|
||||
{
|
||||
disableintr();
|
||||
}
|
||||
|
||||
void
|
||||
hibernate_flush(void)
|
||||
{
|
||||
Mips_SyncCache(curcpu());
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: locore.S,v 1.9 2021/02/11 14:44:13 visa Exp $ */
|
||||
/* $OpenBSD: locore.S,v 1.10 2026/04/06 19:34:08 mlarkin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
|
||||
@@ -74,25 +74,6 @@ locore_start:
|
||||
nop
|
||||
.end locore_start
|
||||
|
||||
#ifdef HIBERNATE
|
||||
|
||||
/* Switch to hibernate resume pagetable */
|
||||
LEAF(hibernate_activate_resume_pt_machdep, 0) /* { */
|
||||
/* XXX TBD */
|
||||
j ra
|
||||
END(hibernate_activate_resume_pt_machdep) /* } */
|
||||
|
||||
LEAF(hibernate_switch_stack_machdep, 0) /* { */
|
||||
/* XXX TBD */
|
||||
j ra
|
||||
END(hibernate_switch_stack_machdep) /* } */
|
||||
|
||||
LEAF(hibernate_resume_machdep, 0) /* { */
|
||||
j ra
|
||||
END(hibernate_resume_machdep) /* } */
|
||||
|
||||
#endif /* HIBERNATE */
|
||||
|
||||
#ifdef MULTIPROCESSOR
|
||||
|
||||
LEAF(hw_cpu_spinup_trampoline, 0)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: loongson2_machdep.c,v 1.17 2019/12/20 13:34:41 visa Exp $ */
|
||||
/* $OpenBSD: loongson2_machdep.c,v 1.18 2026/04/06 19:34:08 mlarkin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2010 Miodrag Vallat.
|
||||
@@ -30,10 +30,6 @@
|
||||
#include <machine/memconf.h>
|
||||
#include <machine/pmon.h>
|
||||
|
||||
#ifdef HIBERNATE
|
||||
#include <machine/hibernate_var.h>
|
||||
#endif /* HIBERNATE */
|
||||
|
||||
#include <loongson/dev/bonitoreg.h>
|
||||
|
||||
extern struct phys_mem_desc mem_layout[MAXMEMSEGS];
|
||||
@@ -164,9 +160,6 @@ loongson2f_setup(u_long memlo, u_long memhi)
|
||||
memlo /* + memhi */;
|
||||
loongson_dma_base = PCI_DDR_BASE ^ DDR_PHYSICAL_BASE;
|
||||
}
|
||||
#ifdef HIBERNATE
|
||||
mem_layout[0].mem_first_page += HIBERNATE_RESERVED_PAGES;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allow access to memory beyond 256MB, by programming the
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: loongson3_machdep.c,v 1.1 2015/08/15 22:31:38 miod Exp $ */
|
||||
/* $OpenBSD: loongson3_machdep.c,v 1.2 2026/04/06 19:34:08 mlarkin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, 2014 Miodrag Vallat.
|
||||
@@ -29,10 +29,6 @@
|
||||
#include <machine/memconf.h>
|
||||
#include <machine/pmon.h>
|
||||
|
||||
#ifdef HIBERNATE
|
||||
#include <machine/hibernate_var.h>
|
||||
#endif /* HIBERNATE */
|
||||
|
||||
extern struct phys_mem_desc mem_layout[MAXMEMSEGS];
|
||||
|
||||
void loongson3a_setup(u_long, u_long);
|
||||
@@ -61,9 +57,6 @@ loongson3a_setup(u_long memlo, u_long memhi)
|
||||
/* do NOT stomp on exception area */
|
||||
mem_layout[0].mem_first_page = atop(MEMLO_BASE) + 1;
|
||||
mem_layout[0].mem_last_page = atop(MEMLO_BASE) + memlo;
|
||||
#ifdef HIBERNATE
|
||||
mem_layout[0].mem_first_page += HIBERNATE_RESERVED_PAGES;
|
||||
#endif
|
||||
|
||||
if (memhi != 0) {
|
||||
#ifdef notyet
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: machdep.c,v 1.102 2026/04/05 13:11:58 kn Exp $ */
|
||||
/* $OpenBSD: machdep.c,v 1.103 2026/04/06 19:34:08 mlarkin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, 2014 Miodrag Vallat.
|
||||
@@ -76,10 +76,6 @@
|
||||
#include <machine/memconf.h>
|
||||
#include <machine/pmon.h>
|
||||
|
||||
#ifdef HIBERNATE
|
||||
#include <machine/hibernate_var.h>
|
||||
#endif /* HIBERNATE */
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
@@ -705,9 +701,6 @@ mips_init(uint64_t argc, uint64_t argv, uint64_t envp, uint64_t cv,
|
||||
lastkernpa = CKSEG0_TO_PHYS((vaddr_t)ekern);
|
||||
|
||||
firstkernpage = atop(trunc_page(firstkernpa));
|
||||
#ifdef HIBERNATE
|
||||
firstkernpage -= HIBERNATE_RESERVED_PAGES;
|
||||
#endif
|
||||
lastkernpage = atop(round_page(lastkernpa));
|
||||
|
||||
if (loongson_memlo_alias != 0) {
|
||||
|
||||
Reference in New Issue
Block a user