dcdbas.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * dcdbas.h: Definitions for Dell Systems Management Base driver
  3. *
  4. * Copyright (C) 1995-2005 Dell Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License v2.0 as published by
  8. * the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #ifndef _DCDBAS_H_
  16. #define _DCDBAS_H_
  17. #include <linux/device.h>
  18. #include <linux/sysfs.h>
  19. #include <linux/types.h>
  20. #define MAX_SMI_DATA_BUF_SIZE (256 * 1024)
  21. #define HC_ACTION_NONE (0)
  22. #define HC_ACTION_HOST_CONTROL_POWEROFF BIT(1)
  23. #define HC_ACTION_HOST_CONTROL_POWERCYCLE BIT(2)
  24. #define HC_SMITYPE_NONE (0)
  25. #define HC_SMITYPE_TYPE1 (1)
  26. #define HC_SMITYPE_TYPE2 (2)
  27. #define HC_SMITYPE_TYPE3 (3)
  28. #define ESM_APM_CMD (0x0A0)
  29. #define ESM_APM_POWER_CYCLE (0x10)
  30. #define ESM_STATUS_CMD_UNSUCCESSFUL (-1)
  31. #define CMOS_BASE_PORT (0x070)
  32. #define CMOS_PAGE1_INDEX_PORT (0)
  33. #define CMOS_PAGE1_DATA_PORT (1)
  34. #define CMOS_PAGE2_INDEX_PORT_PIIX4 (2)
  35. #define CMOS_PAGE2_DATA_PORT_PIIX4 (3)
  36. #define PE1400_APM_CONTROL_PORT (0x0B0)
  37. #define PCAT_APM_CONTROL_PORT (0x0B2)
  38. #define PCAT_APM_STATUS_PORT (0x0B3)
  39. #define PE1300_CMOS_CMD_STRUCT_PTR (0x38)
  40. #define PE1400_CMOS_CMD_STRUCT_PTR (0x70)
  41. #define MAX_SYSMGMT_SHORTCMD_PARMBUF_LEN (14)
  42. #define MAX_SYSMGMT_LONGCMD_SGENTRY_NUM (16)
  43. #define TIMEOUT_USEC_SHORT_SEMA_BLOCKING (10000)
  44. #define EXPIRED_TIMER (0)
  45. #define SMI_CMD_MAGIC (0x534D4931)
  46. #define DCDBAS_DEV_ATTR_RW(_name) \
  47. DEVICE_ATTR(_name,0600,_name##_show,_name##_store);
  48. #define DCDBAS_DEV_ATTR_RO(_name) \
  49. DEVICE_ATTR(_name,0400,_name##_show,NULL);
  50. #define DCDBAS_DEV_ATTR_WO(_name) \
  51. DEVICE_ATTR(_name,0200,NULL,_name##_store);
  52. #define DCDBAS_BIN_ATTR_RW(_name) \
  53. struct bin_attribute bin_attr_##_name = { \
  54. .attr = { .name = __stringify(_name), \
  55. .mode = 0600 }, \
  56. .read = _name##_read, \
  57. .write = _name##_write, \
  58. }
  59. struct smi_cmd {
  60. __u32 magic;
  61. __u32 ebx;
  62. __u32 ecx;
  63. __u16 command_address;
  64. __u8 command_code;
  65. __u8 reserved;
  66. __u8 command_buffer[1];
  67. } __attribute__ ((packed));
  68. struct apm_cmd {
  69. __u8 command;
  70. __s8 status;
  71. __u16 reserved;
  72. union {
  73. struct {
  74. __u8 parm[MAX_SYSMGMT_SHORTCMD_PARMBUF_LEN];
  75. } __attribute__ ((packed)) shortreq;
  76. struct {
  77. __u16 num_sg_entries;
  78. struct {
  79. __u32 size;
  80. __u64 addr;
  81. } __attribute__ ((packed))
  82. sglist[MAX_SYSMGMT_LONGCMD_SGENTRY_NUM];
  83. } __attribute__ ((packed)) longreq;
  84. } __attribute__ ((packed)) parameters;
  85. } __attribute__ ((packed));
  86. int dcdbas_smi_request(struct smi_cmd *smi_cmd);
  87. #endif /* _DCDBAS_H_ */