vga_isa.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* $OpenBSD: vga_isa.c,v 1.10 2015/07/18 00:48:05 miod Exp $ */
  2. /* $NetBSD: vga_isa.c,v 1.3 1998/06/12 18:45:48 drochner Exp $ */
  3. /*
  4. * Copyright (c) 1995, 1996 Carnegie-Mellon University.
  5. * All rights reserved.
  6. *
  7. * Author: Chris G. Demetriou
  8. *
  9. * Permission to use, copy, modify and distribute this software and
  10. * its documentation is hereby granted, provided that both the copyright
  11. * notice and this permission notice appear in all copies of the
  12. * software, derivative works or modified versions, and any portions
  13. * thereof, and that both notices appear in supporting documentation.
  14. *
  15. * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  16. * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
  17. * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  18. *
  19. * Carnegie Mellon requests users of this software to return to
  20. *
  21. * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
  22. * School of Computer Science
  23. * Carnegie Mellon University
  24. * Pittsburgh PA 15213-3890
  25. *
  26. * any improvements or extensions that they make and grant Carnegie the
  27. * rights to redistribute these changes.
  28. */
  29. #include <sys/param.h>
  30. #include <sys/systm.h>
  31. #include <sys/kernel.h>
  32. #include <sys/device.h>
  33. #include <sys/malloc.h>
  34. #include <dev/isa/isavar.h>
  35. #include <dev/ic/mc6845reg.h>
  36. #include <dev/ic/pcdisplayvar.h>
  37. #include <dev/ic/vgareg.h>
  38. #include <dev/wscons/wsconsio.h>
  39. #include <dev/wscons/wsdisplayvar.h>
  40. #include <dev/ic/vgavar.h>
  41. #include <dev/isa/vga_isavar.h>
  42. struct vga_isa_softc {
  43. struct device sc_dev;
  44. #if 0
  45. struct vga_config *sc_vc; /* VGA configuration */
  46. #endif
  47. };
  48. int vga_isa_match(struct device *, void *, void *);
  49. void vga_isa_attach(struct device *, struct device *, void *);
  50. struct cfattach vga_isa_ca = {
  51. sizeof(struct vga_isa_softc), vga_isa_match, vga_isa_attach,
  52. };
  53. int
  54. vga_isa_match(struct device *parent, void *match, void *aux)
  55. {
  56. struct isa_attach_args *ia = aux;
  57. /* If values are hardwired to something that they can't be, punt. */
  58. if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != 0x3b0) ||
  59. /* ia->ia_iosize != 0 || XXX isa.c */
  60. (ia->ia_maddr != MADDRUNK && ia->ia_maddr != 0xa0000) ||
  61. (ia->ia_msize != 0 && ia->ia_msize != 0x20000) ||
  62. ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK)
  63. return (0);
  64. if (!vga_is_console(ia->ia_iot, WSDISPLAY_TYPE_ISAVGA) &&
  65. !vga_common_probe(ia->ia_iot, ia->ia_memt))
  66. return (0);
  67. ia->ia_iobase = 0x3b0; /* XXX mono 0x3b0 color 0x3c0 */
  68. ia->ia_iosize = 0x30; /* XXX 0x20 */
  69. ia->ia_maddr = 0xa0000;
  70. ia->ia_msize = 0x20000;
  71. return (2); /* more than generic pcdisplay */
  72. }
  73. void
  74. vga_isa_attach(struct device *parent, struct device *self, void *aux)
  75. {
  76. struct isa_attach_args *ia = aux;
  77. #if 0
  78. struct vga_isa_softc *sc = (struct vga_isa_softc *)self;
  79. #endif
  80. printf("\n");
  81. vga_common_attach(self, ia->ia_iot, ia->ia_memt,
  82. WSDISPLAY_TYPE_ISAVGA);
  83. }
  84. int
  85. vga_isa_cnattach(bus_space_tag_t iot, bus_space_tag_t memt)
  86. {
  87. return (vga_cnattach(iot, memt, WSDISPLAY_TYPE_ISAVGA, 1));
  88. }