Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

dev.h 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #ifndef DEV_H
  2. #define DEV_H
  3. #include "isa.h"
  4. #include "pci.h"
  5. /* Need to check the packing of this struct if Etherboot is ported */
  6. struct dev_id
  7. {
  8. unsigned short vendor_id;
  9. unsigned short device_id;
  10. unsigned char bus_type;
  11. #define PCI_BUS_TYPE 1
  12. #define ISA_BUS_TYPE 2
  13. };
  14. /* Dont use sizeof, that will include the padding */
  15. #define DEV_ID_SIZE 8
  16. struct pci_probe_state
  17. {
  18. #ifdef CONFIG_PCI
  19. struct pci_device dev;
  20. int advance;
  21. #else
  22. int dummy;
  23. #endif
  24. };
  25. struct isa_probe_state
  26. {
  27. #ifdef CONFIG_ISA
  28. const struct isa_driver *driver;
  29. int advance;
  30. #else
  31. int dummy;
  32. #endif
  33. };
  34. union probe_state
  35. {
  36. struct pci_probe_state pci;
  37. struct isa_probe_state isa;
  38. };
  39. struct dev
  40. {
  41. void (*disable)P((struct dev *));
  42. struct dev_id devid; /* device ID string (sent to DHCP server) */
  43. int index; /* Index of next device on this controller to probe */
  44. int type; /* Type of device I am probing for */
  45. int how_probe; /* First, next or awake */
  46. int to_probe; /* Flavor of device I am probing */
  47. int failsafe; /* Failsafe probe requested */
  48. int type_index; /* Index of this device (within type) */
  49. #define PROBE_NONE 0
  50. #define PROBE_PCI 1
  51. #define PROBE_ISA 2
  52. union probe_state state;
  53. };
  54. #define NIC_DRIVER 0
  55. #define DISK_DRIVER 1
  56. #define FLOPPY_DRIVER 2
  57. #define BRIDGE_DRIVER 1000
  58. #define PROBE_FIRST (-1)
  59. #define PROBE_NEXT 0
  60. #define PROBE_AWAKE 1 /* After calling disable bring up the same device */
  61. /* The probe result codes are selected
  62. * to allow them to be fed back into the probe
  63. * routine and get a successful probe.
  64. */
  65. #define PROBE_FAILED PROBE_FIRST
  66. #define PROBE_WORKED PROBE_NEXT
  67. extern int probe(struct dev *dev);
  68. extern void disable(struct dev *dev);
  69. /* Boot option values
  70. * option & BOOT_TYPE_MASK should equal a driver for probing
  71. */
  72. #define BOOT_NIC 0x0 /* Boot from a nic */
  73. #define BOOT_DISK 0x1 /* Boot from disk */
  74. #define BOOT_FLOPPY 0x2 /* Boot from a floppy */
  75. #define BOOT_NOTHING 0x3 /* Last valid boot choice */
  76. /* Do magic failsafe boot processing */
  77. #define BOOT_FAILSAFE 0x8
  78. #define BOOT_BITS 4
  79. #define BOOT_MASK ((1 << (BOOT_BITS)) - 1)
  80. #define BOOT_TYPE_MASK ((1 << (BOOT_BITS - 1)) - 1)
  81. #define MAX_BOOT_ENTRIES 3
  82. #define BOOT_ALL_VALUE (1<<BOOT_FIRST|1<<BOOT_SECOND|1<<BOOT_THIRD)
  83. /* These could be customised for different languages perhaps */
  84. #if BOOT_ALL_VALUE&(1<<BOOT_DISK)
  85. #define BOOT_DISK_PROMPT "(D)isk "
  86. #else
  87. #define BOOT_DISK_PROMPT
  88. #endif
  89. #if BOOT_ALL_VALUE&(1<<BOOT_FLOPPY)
  90. #define BOOT_FLOPPY_PROMPT "(F)loppy "
  91. #else
  92. #define BOOT_FLOPPY_PROMPT
  93. #endif
  94. #define ASK_PROMPT \
  95. "Boot from (N)etwork " BOOT_DISK_PROMPT BOOT_FLOPPY_PROMPT "or (Q)uit? "
  96. #define ANS_NETWORK 'N'
  97. #define ANS_DISK 'D'
  98. #define ANS_FLOPPY 'F'
  99. #define ANS_QUIT 'Q'
  100. #define ANS_DEFAULT '\n'
  101. #endif /* DEV_H */