uninorthvar.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*-
  2. * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  3. *
  4. * Copyright (C) 2002 Benno Rice.
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
  17. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  18. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  19. * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  21. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  22. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  23. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  24. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  25. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. *
  27. * $FreeBSD$
  28. */
  29. #ifndef _POWERPC_POWERMAC_UNINORTHVAR_H_
  30. #define _POWERPC_POWERMAC_UNINORTHVAR_H_
  31. #include <dev/ofw/ofw_bus_subr.h>
  32. #include <dev/ofw/ofw_pci.h>
  33. #include <dev/ofw/ofwpci.h>
  34. struct uninorth_softc {
  35. struct ofw_pci_softc pci_sc;
  36. vm_offset_t sc_addr;
  37. vm_offset_t sc_data;
  38. int sc_ver;
  39. int sc_skipslot;
  40. struct mtx sc_cfg_mtx;
  41. };
  42. struct unin_chip_softc {
  43. uint64_t sc_physaddr;
  44. uint64_t sc_size;
  45. vm_offset_t sc_addr;
  46. struct rman sc_mem_rman;
  47. int sc_version;
  48. };
  49. /*
  50. * Format of a unin reg property entry.
  51. */
  52. struct unin_chip_reg {
  53. u_int32_t mr_base;
  54. u_int32_t mr_size;
  55. };
  56. /*
  57. * Per unin device structure.
  58. */
  59. struct unin_chip_devinfo {
  60. int udi_interrupts[6];
  61. int udi_ninterrupts;
  62. int udi_base;
  63. struct ofw_bus_devinfo udi_obdinfo;
  64. struct resource_list udi_resources;
  65. };
  66. /*
  67. * Version register
  68. */
  69. #define UNIN_VERS 0x0
  70. /*
  71. * Clock-control register
  72. */
  73. #define UNIN_CLOCKCNTL 0x20
  74. #define UNIN_CLOCKCNTL_GMAC 0x2
  75. /*
  76. * Power management register
  77. */
  78. #define UNIN_PWR_MGMT 0x30
  79. #define UNIN_PWR_NORMAL 0x00
  80. #define UNIN_PWR_IDLE2 0x01
  81. #define UNIN_PWR_SLEEP 0x02
  82. #define UNIN_PWR_SAVE 0x03
  83. #define UNIN_PWR_MASK 0x03
  84. /*
  85. * Hardware initialization state register
  86. */
  87. #define UNIN_HWINIT_STATE 0x70
  88. #define UNIN_SLEEPING 0x01
  89. #define UNIN_RUNNING 0x02
  90. /*
  91. * Toggle registers
  92. */
  93. #define UNIN_TOGGLE_REG 0xe0
  94. #define UNIN_MPIC_RESET 0x2
  95. #define UNIN_MPIC_OUTPUT_ENABLE 0x4
  96. extern int unin_chip_sleep(device_t dev, int idle);
  97. extern int unin_chip_wake(device_t dev);
  98. #endif /* _POWERPC_POWERMAC_UNINORTHVAR_H_ */