piix_pci.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. /*
  2. * QEMU i440FX/PIIX3 PCI Bridge Emulation
  3. *
  4. * Copyright (c) 2006 Fabrice Bellard
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to deal
  8. * in the Software without restriction, including without limitation the rights
  9. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. * copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. * THE SOFTWARE.
  23. */
  24. #include "hw.h"
  25. #include "pc.h"
  26. #include "pci.h"
  27. #include "pci_host.h"
  28. #include "isa.h"
  29. #include "sysbus.h"
  30. #include "range.h"
  31. #include "xen.h"
  32. /*
  33. * I440FX chipset data sheet.
  34. * http://download.intel.com/design/chipsets/datashts/29054901.pdf
  35. */
  36. typedef PCIHostState I440FXState;
  37. #define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */
  38. #define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */
  39. #define XEN_PIIX_NUM_PIRQS 128ULL
  40. #define PIIX_PIRQC 0x60
  41. typedef struct PIIX3State {
  42. PCIDevice dev;
  43. /*
  44. * bitmap to track pic levels.
  45. * The pic level is the logical OR of all the PCI irqs mapped to it
  46. * So one PIC level is tracked by PIIX_NUM_PIRQS bits.
  47. *
  48. * PIRQ is mapped to PIC pins, we track it by
  49. * PIIX_NUM_PIRQS * PIIX_NUM_PIC_IRQS = 64 bits with
  50. * pic_irq * PIIX_NUM_PIRQS + pirq
  51. */
  52. #if PIIX_NUM_PIC_IRQS * PIIX_NUM_PIRQS > 64
  53. #error "unable to encode pic state in 64bit in pic_levels."
  54. #endif
  55. uint64_t pic_levels;
  56. qemu_irq *pic;
  57. /* This member isn't used. Just for save/load compatibility */
  58. int32_t pci_irq_levels_vmstate[PIIX_NUM_PIRQS];
  59. } PIIX3State;
  60. typedef struct PAMMemoryRegion {
  61. MemoryRegion mem;
  62. bool initialized;
  63. } PAMMemoryRegion;
  64. struct PCII440FXState {
  65. PCIDevice dev;
  66. MemoryRegion *system_memory;
  67. MemoryRegion *pci_address_space;
  68. MemoryRegion *ram_memory;
  69. MemoryRegion pci_hole;
  70. MemoryRegion pci_hole_64bit;
  71. PAMMemoryRegion pam_regions[13];
  72. MemoryRegion smram_region;
  73. uint8_t smm_enabled;
  74. bool smram_enabled;
  75. PIIX3State *piix3;
  76. };
  77. #define I440FX_PAM 0x59
  78. #define I440FX_PAM_SIZE 7
  79. #define I440FX_SMRAM 0x72
  80. static void piix3_set_irq(void *opaque, int pirq, int level);
  81. static void piix3_write_config_xen(PCIDevice *dev,
  82. uint32_t address, uint32_t val, int len);
  83. /* return the global irq number corresponding to a given device irq
  84. pin. We could also use the bus number to have a more precise
  85. mapping. */
  86. static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx)
  87. {
  88. int slot_addend;
  89. slot_addend = (pci_dev->devfn >> 3) - 1;
  90. return (pci_intx + slot_addend) & 3;
  91. }
  92. static void update_pam(PCII440FXState *d, uint32_t start, uint32_t end, int r,
  93. PAMMemoryRegion *mem)
  94. {
  95. if (mem->initialized) {
  96. memory_region_del_subregion(d->system_memory, &mem->mem);
  97. memory_region_destroy(&mem->mem);
  98. }
  99. // printf("ISA mapping %08x-0x%08x: %d\n", start, end, r);
  100. switch(r) {
  101. case 3:
  102. /* RAM */
  103. memory_region_init_alias(&mem->mem, "pam-ram", d->ram_memory,
  104. start, end - start);
  105. break;
  106. case 1:
  107. /* ROM (XXX: not quite correct) */
  108. memory_region_init_alias(&mem->mem, "pam-rom", d->ram_memory,
  109. start, end - start);
  110. memory_region_set_readonly(&mem->mem, true);
  111. break;
  112. case 2:
  113. case 0:
  114. /* XXX: should distinguish read/write cases */
  115. memory_region_init_alias(&mem->mem, "pam-pci", d->pci_address_space,
  116. start, end - start);
  117. break;
  118. }
  119. memory_region_add_subregion_overlap(d->system_memory,
  120. start, &mem->mem, 1);
  121. mem->initialized = true;
  122. }
  123. static void i440fx_update_memory_mappings(PCII440FXState *d)
  124. {
  125. int i, r;
  126. uint32_t smram;
  127. memory_region_transaction_begin();
  128. update_pam(d, 0xf0000, 0x100000, (d->dev.config[I440FX_PAM] >> 4) & 3,
  129. &d->pam_regions[0]);
  130. for(i = 0; i < 12; i++) {
  131. r = (d->dev.config[(i >> 1) + (I440FX_PAM + 1)] >> ((i & 1) * 4)) & 3;
  132. update_pam(d, 0xc0000 + 0x4000 * i, 0xc0000 + 0x4000 * (i + 1), r,
  133. &d->pam_regions[i+1]);
  134. }
  135. smram = d->dev.config[I440FX_SMRAM];
  136. if ((d->smm_enabled && (smram & 0x08)) || (smram & 0x40)) {
  137. if (!d->smram_enabled) {
  138. memory_region_del_subregion(d->system_memory, &d->smram_region);
  139. d->smram_enabled = true;
  140. }
  141. } else {
  142. if (d->smram_enabled) {
  143. memory_region_add_subregion_overlap(d->system_memory, 0xa0000,
  144. &d->smram_region, 1);
  145. d->smram_enabled = false;
  146. }
  147. }
  148. memory_region_transaction_commit();
  149. }
  150. static void i440fx_set_smm(int val, void *arg)
  151. {
  152. PCII440FXState *d = arg;
  153. val = (val != 0);
  154. if (d->smm_enabled != val) {
  155. d->smm_enabled = val;
  156. i440fx_update_memory_mappings(d);
  157. }
  158. }
  159. static void i440fx_write_config(PCIDevice *dev,
  160. uint32_t address, uint32_t val, int len)
  161. {
  162. PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev);
  163. /* XXX: implement SMRAM.D_LOCK */
  164. pci_default_write_config(dev, address, val, len);
  165. if (ranges_overlap(address, len, I440FX_PAM, I440FX_PAM_SIZE) ||
  166. range_covers_byte(address, len, I440FX_SMRAM)) {
  167. i440fx_update_memory_mappings(d);
  168. }
  169. }
  170. static int i440fx_load_old(QEMUFile* f, void *opaque, int version_id)
  171. {
  172. PCII440FXState *d = opaque;
  173. int ret, i;
  174. ret = pci_device_load(&d->dev, f);
  175. if (ret < 0)
  176. return ret;
  177. i440fx_update_memory_mappings(d);
  178. qemu_get_8s(f, &d->smm_enabled);
  179. if (version_id == 2) {
  180. for (i = 0; i < PIIX_NUM_PIRQS; i++) {
  181. qemu_get_be32(f); /* dummy load for compatibility */
  182. }
  183. }
  184. return 0;
  185. }
  186. static int i440fx_post_load(void *opaque, int version_id)
  187. {
  188. PCII440FXState *d = opaque;
  189. i440fx_update_memory_mappings(d);
  190. return 0;
  191. }
  192. static const VMStateDescription vmstate_i440fx = {
  193. .name = "I440FX",
  194. .version_id = 3,
  195. .minimum_version_id = 3,
  196. .minimum_version_id_old = 1,
  197. .load_state_old = i440fx_load_old,
  198. .post_load = i440fx_post_load,
  199. .fields = (VMStateField []) {
  200. VMSTATE_PCI_DEVICE(dev, PCII440FXState),
  201. VMSTATE_UINT8(smm_enabled, PCII440FXState),
  202. VMSTATE_END_OF_LIST()
  203. }
  204. };
  205. static int i440fx_pcihost_initfn(SysBusDevice *dev)
  206. {
  207. I440FXState *s = FROM_SYSBUS(I440FXState, dev);
  208. memory_region_init_io(&s->conf_mem, &pci_host_conf_le_ops, s,
  209. "pci-conf-idx", 4);
  210. sysbus_add_io(dev, 0xcf8, &s->conf_mem);
  211. sysbus_init_ioports(&s->busdev, 0xcf8, 4);
  212. memory_region_init_io(&s->data_mem, &pci_host_data_le_ops, s,
  213. "pci-conf-data", 4);
  214. sysbus_add_io(dev, 0xcfc, &s->data_mem);
  215. sysbus_init_ioports(&s->busdev, 0xcfc, 4);
  216. return 0;
  217. }
  218. static int i440fx_initfn(PCIDevice *dev)
  219. {
  220. PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev);
  221. d->dev.config[I440FX_SMRAM] = 0x02;
  222. cpu_smm_register(&i440fx_set_smm, d);
  223. return 0;
  224. }
  225. static PCIBus *i440fx_common_init(const char *device_name,
  226. PCII440FXState **pi440fx_state,
  227. int *piix3_devfn,
  228. qemu_irq *pic,
  229. MemoryRegion *address_space_mem,
  230. MemoryRegion *address_space_io,
  231. ram_addr_t ram_size,
  232. target_phys_addr_t pci_hole_start,
  233. target_phys_addr_t pci_hole_size,
  234. target_phys_addr_t pci_hole64_start,
  235. target_phys_addr_t pci_hole64_size,
  236. MemoryRegion *pci_address_space,
  237. MemoryRegion *ram_memory)
  238. {
  239. DeviceState *dev;
  240. PCIBus *b;
  241. PCIDevice *d;
  242. I440FXState *s;
  243. PIIX3State *piix3;
  244. PCII440FXState *f;
  245. dev = qdev_create(NULL, "i440FX-pcihost");
  246. s = FROM_SYSBUS(I440FXState, sysbus_from_qdev(dev));
  247. s->address_space = address_space_mem;
  248. b = pci_bus_new(&s->busdev.qdev, NULL, pci_address_space,
  249. address_space_io, 0);
  250. s->bus = b;
  251. qdev_init_nofail(dev);
  252. d = pci_create_simple(b, 0, device_name);
  253. *pi440fx_state = DO_UPCAST(PCII440FXState, dev, d);
  254. f = *pi440fx_state;
  255. f->system_memory = address_space_mem;
  256. f->pci_address_space = pci_address_space;
  257. f->ram_memory = ram_memory;
  258. memory_region_init_alias(&f->pci_hole, "pci-hole", f->pci_address_space,
  259. pci_hole_start, pci_hole_size);
  260. memory_region_add_subregion(f->system_memory, pci_hole_start, &f->pci_hole);
  261. memory_region_init_alias(&f->pci_hole_64bit, "pci-hole64",
  262. f->pci_address_space,
  263. pci_hole64_start, pci_hole64_size);
  264. if (pci_hole64_size) {
  265. memory_region_add_subregion(f->system_memory, pci_hole64_start,
  266. &f->pci_hole_64bit);
  267. }
  268. memory_region_init_alias(&f->smram_region, "smram-region",
  269. f->pci_address_space, 0xa0000, 0x20000);
  270. f->smram_enabled = true;
  271. /* Xen supports additional interrupt routes from the PCI devices to
  272. * the IOAPIC: the four pins of each PCI device on the bus are also
  273. * connected to the IOAPIC directly.
  274. * These additional routes can be discovered through ACPI. */
  275. if (xen_enabled()) {
  276. piix3 = DO_UPCAST(PIIX3State, dev,
  277. pci_create_simple_multifunction(b, -1, true, "PIIX3-xen"));
  278. pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq,
  279. piix3, XEN_PIIX_NUM_PIRQS);
  280. } else {
  281. piix3 = DO_UPCAST(PIIX3State, dev,
  282. pci_create_simple_multifunction(b, -1, true, "PIIX3"));
  283. pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3,
  284. PIIX_NUM_PIRQS);
  285. }
  286. piix3->pic = pic;
  287. (*pi440fx_state)->piix3 = piix3;
  288. *piix3_devfn = piix3->dev.devfn;
  289. ram_size = ram_size / 8 / 1024 / 1024;
  290. if (ram_size > 255)
  291. ram_size = 255;
  292. (*pi440fx_state)->dev.config[0x57]=ram_size;
  293. i440fx_update_memory_mappings(f);
  294. return b;
  295. }
  296. PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn,
  297. qemu_irq *pic,
  298. MemoryRegion *address_space_mem,
  299. MemoryRegion *address_space_io,
  300. ram_addr_t ram_size,
  301. target_phys_addr_t pci_hole_start,
  302. target_phys_addr_t pci_hole_size,
  303. target_phys_addr_t pci_hole64_start,
  304. target_phys_addr_t pci_hole64_size,
  305. MemoryRegion *pci_memory, MemoryRegion *ram_memory)
  306. {
  307. PCIBus *b;
  308. b = i440fx_common_init("i440FX", pi440fx_state, piix3_devfn, pic,
  309. address_space_mem, address_space_io, ram_size,
  310. pci_hole_start, pci_hole_size,
  311. pci_hole64_size, pci_hole64_size,
  312. pci_memory, ram_memory);
  313. return b;
  314. }
  315. /* PIIX3 PCI to ISA bridge */
  316. static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq)
  317. {
  318. qemu_set_irq(piix3->pic[pic_irq],
  319. !!(piix3->pic_levels &
  320. (((1ULL << PIIX_NUM_PIRQS) - 1) <<
  321. (pic_irq * PIIX_NUM_PIRQS))));
  322. }
  323. static void piix3_set_irq_level(PIIX3State *piix3, int pirq, int level)
  324. {
  325. int pic_irq;
  326. uint64_t mask;
  327. pic_irq = piix3->dev.config[PIIX_PIRQC + pirq];
  328. if (pic_irq >= PIIX_NUM_PIC_IRQS) {
  329. return;
  330. }
  331. mask = 1ULL << ((pic_irq * PIIX_NUM_PIRQS) + pirq);
  332. piix3->pic_levels &= ~mask;
  333. piix3->pic_levels |= mask * !!level;
  334. piix3_set_irq_pic(piix3, pic_irq);
  335. }
  336. static void piix3_set_irq(void *opaque, int pirq, int level)
  337. {
  338. PIIX3State *piix3 = opaque;
  339. piix3_set_irq_level(piix3, pirq, level);
  340. }
  341. /* irq routing is changed. so rebuild bitmap */
  342. static void piix3_update_irq_levels(PIIX3State *piix3)
  343. {
  344. int pirq;
  345. piix3->pic_levels = 0;
  346. for (pirq = 0; pirq < PIIX_NUM_PIRQS; pirq++) {
  347. piix3_set_irq_level(piix3, pirq,
  348. pci_bus_get_irq_level(piix3->dev.bus, pirq));
  349. }
  350. }
  351. static void piix3_write_config(PCIDevice *dev,
  352. uint32_t address, uint32_t val, int len)
  353. {
  354. pci_default_write_config(dev, address, val, len);
  355. if (ranges_overlap(address, len, PIIX_PIRQC, 4)) {
  356. PIIX3State *piix3 = DO_UPCAST(PIIX3State, dev, dev);
  357. int pic_irq;
  358. piix3_update_irq_levels(piix3);
  359. for (pic_irq = 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) {
  360. piix3_set_irq_pic(piix3, pic_irq);
  361. }
  362. }
  363. }
  364. static void piix3_write_config_xen(PCIDevice *dev,
  365. uint32_t address, uint32_t val, int len)
  366. {
  367. xen_piix_pci_write_config_client(address, val, len);
  368. piix3_write_config(dev, address, val, len);
  369. }
  370. static void piix3_reset(void *opaque)
  371. {
  372. PIIX3State *d = opaque;
  373. uint8_t *pci_conf = d->dev.config;
  374. pci_conf[0x04] = 0x07; // master, memory and I/O
  375. pci_conf[0x05] = 0x00;
  376. pci_conf[0x06] = 0x00;
  377. pci_conf[0x07] = 0x02; // PCI_status_devsel_medium
  378. pci_conf[0x4c] = 0x4d;
  379. pci_conf[0x4e] = 0x03;
  380. pci_conf[0x4f] = 0x00;
  381. pci_conf[0x60] = 0x80;
  382. pci_conf[0x61] = 0x80;
  383. pci_conf[0x62] = 0x80;
  384. pci_conf[0x63] = 0x80;
  385. pci_conf[0x69] = 0x02;
  386. pci_conf[0x70] = 0x80;
  387. pci_conf[0x76] = 0x0c;
  388. pci_conf[0x77] = 0x0c;
  389. pci_conf[0x78] = 0x02;
  390. pci_conf[0x79] = 0x00;
  391. pci_conf[0x80] = 0x00;
  392. pci_conf[0x82] = 0x00;
  393. pci_conf[0xa0] = 0x08;
  394. pci_conf[0xa2] = 0x00;
  395. pci_conf[0xa3] = 0x00;
  396. pci_conf[0xa4] = 0x00;
  397. pci_conf[0xa5] = 0x00;
  398. pci_conf[0xa6] = 0x00;
  399. pci_conf[0xa7] = 0x00;
  400. pci_conf[0xa8] = 0x0f;
  401. pci_conf[0xaa] = 0x00;
  402. pci_conf[0xab] = 0x00;
  403. pci_conf[0xac] = 0x00;
  404. pci_conf[0xae] = 0x00;
  405. d->pic_levels = 0;
  406. }
  407. static int piix3_post_load(void *opaque, int version_id)
  408. {
  409. PIIX3State *piix3 = opaque;
  410. piix3_update_irq_levels(piix3);
  411. return 0;
  412. }
  413. static void piix3_pre_save(void *opaque)
  414. {
  415. int i;
  416. PIIX3State *piix3 = opaque;
  417. for (i = 0; i < ARRAY_SIZE(piix3->pci_irq_levels_vmstate); i++) {
  418. piix3->pci_irq_levels_vmstate[i] =
  419. pci_bus_get_irq_level(piix3->dev.bus, i);
  420. }
  421. }
  422. static const VMStateDescription vmstate_piix3 = {
  423. .name = "PIIX3",
  424. .version_id = 3,
  425. .minimum_version_id = 2,
  426. .minimum_version_id_old = 2,
  427. .post_load = piix3_post_load,
  428. .pre_save = piix3_pre_save,
  429. .fields = (VMStateField []) {
  430. VMSTATE_PCI_DEVICE(dev, PIIX3State),
  431. VMSTATE_INT32_ARRAY_V(pci_irq_levels_vmstate, PIIX3State,
  432. PIIX_NUM_PIRQS, 3),
  433. VMSTATE_END_OF_LIST()
  434. }
  435. };
  436. static int piix3_initfn(PCIDevice *dev)
  437. {
  438. PIIX3State *d = DO_UPCAST(PIIX3State, dev, dev);
  439. isa_bus_new(&d->dev.qdev, pci_address_space_io(dev));
  440. qemu_register_reset(piix3_reset, d);
  441. return 0;
  442. }
  443. static PCIDeviceInfo i440fx_info[] = {
  444. {
  445. .qdev.name = "i440FX",
  446. .qdev.desc = "Host bridge",
  447. .qdev.size = sizeof(PCII440FXState),
  448. .qdev.vmsd = &vmstate_i440fx,
  449. .qdev.no_user = 1,
  450. .no_hotplug = 1,
  451. .init = i440fx_initfn,
  452. .config_write = i440fx_write_config,
  453. .vendor_id = PCI_VENDOR_ID_INTEL,
  454. .device_id = PCI_DEVICE_ID_INTEL_82441,
  455. .revision = 0x02,
  456. .class_id = PCI_CLASS_BRIDGE_HOST,
  457. },{
  458. .qdev.name = "PIIX3",
  459. .qdev.desc = "ISA bridge",
  460. .qdev.size = sizeof(PIIX3State),
  461. .qdev.vmsd = &vmstate_piix3,
  462. .qdev.no_user = 1,
  463. .no_hotplug = 1,
  464. .init = piix3_initfn,
  465. .config_write = piix3_write_config,
  466. .vendor_id = PCI_VENDOR_ID_INTEL,
  467. .device_id = PCI_DEVICE_ID_INTEL_82371SB_0, // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
  468. .class_id = PCI_CLASS_BRIDGE_ISA,
  469. },{
  470. .qdev.name = "PIIX3-xen",
  471. .qdev.desc = "ISA bridge",
  472. .qdev.size = sizeof(PIIX3State),
  473. .qdev.vmsd = &vmstate_piix3,
  474. .qdev.no_user = 1,
  475. .no_hotplug = 1,
  476. .init = piix3_initfn,
  477. .config_write = piix3_write_config_xen,
  478. .vendor_id = PCI_VENDOR_ID_INTEL,
  479. .device_id = PCI_DEVICE_ID_INTEL_82371SB_0, // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
  480. .class_id = PCI_CLASS_BRIDGE_ISA,
  481. },{
  482. /* end of list */
  483. }
  484. };
  485. static SysBusDeviceInfo i440fx_pcihost_info = {
  486. .init = i440fx_pcihost_initfn,
  487. .qdev.name = "i440FX-pcihost",
  488. .qdev.fw_name = "pci",
  489. .qdev.size = sizeof(I440FXState),
  490. .qdev.no_user = 1,
  491. };
  492. static void i440fx_register(void)
  493. {
  494. sysbus_register_withprop(&i440fx_pcihost_info);
  495. pci_qdev_register_many(i440fx_info);
  496. }
  497. device_init(i440fx_register);